OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPDFImage_DEFINED | 10 #ifndef SkPDFImage_DEFINED |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 * @param paint Used to calculate alpha, masks, etc. | 47 * @param paint Used to calculate alpha, masks, etc. |
48 * @return The image XObject or NUll if there is nothing to draw for | 48 * @return The image XObject or NUll if there is nothing to draw for |
49 * the given parameters. | 49 * the given parameters. |
50 */ | 50 */ |
51 static SkPDFImage* CreateImage(const SkBitmap& bitmap, | 51 static SkPDFImage* CreateImage(const SkBitmap& bitmap, |
52 const SkIRect& srcRect, | 52 const SkIRect& srcRect, |
53 SkPicture::EncodeBitmap encoder); | 53 SkPicture::EncodeBitmap encoder); |
54 | 54 |
55 virtual ~SkPDFImage(); | 55 virtual ~SkPDFImage(); |
56 | 56 |
57 /** Add a Soft Mask (alpha or shape channel) to the image. Refs mask. | |
58 * @param mask A gray scale image representing the mask. | |
59 * @return The mask argument is returned. | |
60 */ | |
61 SkPDFImage* addSMask(SkPDFImage* mask); | |
62 | |
63 bool isEmpty() { | 57 bool isEmpty() { |
64 return fSrcRect.isEmpty(); | 58 return fSrcRect.isEmpty(); |
65 } | 59 } |
66 | 60 |
67 // The SkPDFObject interface. | |
68 virtual void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects, | |
69 SkTSet<SkPDFObject*>* newResourceObjects); | |
70 | |
71 private: | 61 private: |
72 SkBitmap fBitmap; | 62 SkBitmap fBitmap; |
73 bool fIsAlpha; | 63 bool fIsAlpha; |
74 SkIRect fSrcRect; | 64 SkIRect fSrcRect; |
75 SkPicture::EncodeBitmap fEncoder; | 65 SkPicture::EncodeBitmap fEncoder; |
76 bool fStreamValid; | 66 bool fStreamValid; |
77 | 67 |
78 SkTDArray<SkPDFObject*> fResources; | |
79 | |
80 /** Create a PDF image XObject. Entries for the image properties are | 68 /** Create a PDF image XObject. Entries for the image properties are |
81 * automatically added to the stream dictionary. | 69 * automatically added to the stream dictionary. |
82 * @param stream The image stream. May be NULL. Otherwise, this | 70 * @param stream The image stream. May be NULL. Otherwise, this |
83 * (instead of the input bitmap) will be used as the | 71 * (instead of the input bitmap) will be used as the |
84 * PDF's content stream, possibly with lossless encoding. | 72 * PDF's content stream, possibly with lossless encoding. |
85 * Will be duplicated, and left in indeterminate state. | 73 * Will be duplicated, and left in indeterminate state. |
86 * @param bitmap The image. If a stream is not given, its color data | 74 * @param bitmap The image. If a stream is not given, its color data |
87 * will be used as the image. If a stream is given, this | 75 * will be used as the image. If a stream is given, this |
88 * is used for configuration only. | 76 * is used for configuration only. |
89 * @param isAlpha Whether or not this is the alpha of an image. | 77 * @param isAlpha Whether or not this is the alpha of an image. |
(...skipping 11 matching lines...) Expand all Loading... |
101 SkPDFImage(SkPDFImage& pdfImage); | 89 SkPDFImage(SkPDFImage& pdfImage); |
102 | 90 |
103 // Populate the stream dictionary. This method returns false if | 91 // Populate the stream dictionary. This method returns false if |
104 // fSubstitute should be used. | 92 // fSubstitute should be used. |
105 virtual bool populate(SkPDFCatalog* catalog); | 93 virtual bool populate(SkPDFCatalog* catalog); |
106 | 94 |
107 typedef SkPDFStream INHERITED; | 95 typedef SkPDFStream INHERITED; |
108 }; | 96 }; |
109 | 97 |
110 #endif | 98 #endif |
OLD | NEW |