aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/pdf/SkPDFDevice.h
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-13 03:50:38 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-13 03:50:38 +0000
commit6112c215fbdd53388e64ece36e6c7bba0fe3a451 (patch)
tree831fe90e87e56a1aea74c3f4148c2939bacb5655 /include/pdf/SkPDFDevice.h
parentd604481f7a2587f5b400d2a0a68a6491a0d584c7 (diff)
[PDF] Add support for SrcIn, SrcOut, DstIn, DstOut xfermodes.
This change uses the soft mask (aka soft clip) functionality of PDF to implement the xfermodes. It has to put existing content (dst) into a form xobject as well as putting the new (src) content into a different form xobject. It then draws one of them with the other as the soft mask. To accomplish this, we add a call to finishContentEntry after each call to setUpContentEntry - this is kind of a hack, but I don't see a better way to extract src. Unfortunately, soft mask is specified in the Graphic State PDF object (and not in the form xobject), so when handling one of these modes, we add a one time GS object to set the soft mask and invoke a simple GS to reset the soft mask when done. Review URL: http://codereview.appspot.com/4496041 git-svn-id: http://skia.googlecode.com/svn/trunk@1320 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/pdf/SkPDFDevice.h')
-rw-r--r--include/pdf/SkPDFDevice.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 9ab0ae51f6..cdae413a7d 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -28,6 +28,7 @@ class SkPDFArray;
class SkPDFDevice;
class SkPDFDict;
class SkPDFFont;
+class SkPDFFormXObject;
class SkPDFGraphicState;
class SkPDFObject;
class SkPDFShader;
@@ -155,6 +156,7 @@ private:
SkTScopedPtr<ContentEntry> fContentEntries;
ContentEntry* fCurrentContentEntry;
+ SkRefPtr<SkPDFFormXObject> fDstFormXObject;
// For use by the DeviceFactory.
SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack,
@@ -162,6 +164,7 @@ private:
void init();
void cleanUp();
+ void createFormXObjectFromDevice(SkRefPtr<SkPDFFormXObject>* xobject);
// If the paint or clip is such that we shouldn't draw anything, these
// return false and do not create a content entry.
@@ -174,12 +177,14 @@ private:
const SkRegion& clipRegion,
const SkMatrix& matrix,
const SkPaint& paint);
+ void finishContentEntry(const SkPaint& paint);
void populateGraphicStateEntryFromPaint(const SkMatrix& matrix,
const SkClipStack& clipStack,
const SkRegion& clipRegion,
const SkPaint& paint,
bool hasText,
GraphicStateEntry* entry);
+ int addGraphicStateResource(SkPDFGraphicState* gs);
void updateFont(const SkPaint& paint, uint16_t glyphID);
int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID);