Use number of components from ICC profile and alternate color space
[pdfium.git] / core / src / fpdfapi / fpdf_page / pageint.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4  
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _PAGEINT_H_
8 #define _PAGEINT_H_
9
10 #include "../../../include/fpdfapi/fpdf_pageobj.h"
11 #define PARSE_STEP_LIMIT                100
12 #define STREAM_PARSE_BUFSIZE    20480
13 class CPDF_QuickFontCache;
14 #ifndef _FPDFAPI_MINI_
15 class CPDF_StreamParser : public CFX_Object
16 {
17 public:
18
19     CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize);
20     ~CPDF_StreamParser();
21
22     CPDF_Stream*                ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode);
23     typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType;
24
25     SyntaxType                  ParseNextElement();
26     FX_LPBYTE                   GetWordBuf()
27     {
28         return m_WordBuffer;
29     }
30     FX_DWORD                    GetWordSize()
31     {
32         return m_WordSize;
33     }
34     CPDF_Object*                GetObject()
35     {
36         CPDF_Object* pObj = m_pLastObj;
37         m_pLastObj = NULL;
38         return pObj;
39     }
40     FX_DWORD                    GetPos()
41     {
42         return m_Pos;
43     }
44     void                                SetPos(FX_DWORD pos)
45     {
46         m_Pos = pos;
47     }
48
49     CPDF_Object*                ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, FX_BOOL bInArray = FALSE);
50     void                                SkipPathObject();
51 protected:
52     void                                GetNextWord(FX_BOOL& bIsNumber);
53     CFX_ByteString              ReadString();
54     CFX_ByteString              ReadHexString();
55     const FX_BYTE*              m_pBuf;
56     FX_DWORD                    m_Size;
57     FX_DWORD                    m_Pos;
58     FX_BYTE                             m_WordBuffer[256];
59     FX_DWORD                    m_WordSize;
60     CPDF_Object*                m_pLastObj;
61 };
62 #endif
63 typedef enum {
64     PDFOP_CloseFillStrokePath = 0, PDFOP_FillStrokePath,
65     PDFOP_CloseEOFillStrokePath, PDFOP_EOFillStrokePath,
66     PDFOP_BeginMarkedContent_Dictionary, PDFOP_BeginImage,
67     PDFOP_BeginMarkedContent, PDFOP_BeginText,
68     PDFOP_BeginSectionUndefined, PDFOP_CurveTo_123,
69     PDFOP_ConcatMatrix, PDFOP_SetColorSpace_Fill,
70     PDFOP_SetColorSpace_Stroke, PDFOP_SetDash,
71     PDFOP_SetCharWidth, PDFOP_SetCachedDevice,
72     PDFOP_ExecuteXObject, PDFOP_MarkPlace_Dictionary,
73     PDFOP_EndImage, PDFOP_EndMarkedContent,
74     PDFOP_EndText, PDFOP_EndSectionUndefined,
75     PDFOP_FillPath, PDFOP_FillPathOld,
76     PDFOP_EOFillPath, PDFOP_SetGray_Fill,
77     PDFOP_SetGray_Stroke, PDFOP_SetExtendGraphState,
78     PDFOP_ClosePath, PDFOP_SetFlat,
79     PDFOP_BeginImageData, PDFOP_SetLineJoin,
80     PDFOP_SetLineCap, PDFOP_SetCMYKColor_Fill,
81     PDFOP_SetCMYKColor_Stroke, PDFOP_LineTo,
82     PDFOP_MoveTo, PDFOP_SetMiterLimit,
83     PDFOP_MarkPlace, PDFOP_EndPath,
84     PDFOP_SaveGraphState, PDFOP_RestoreGraphState,
85     PDFOP_Rectangle, PDFOP_SetRGBColor_Fill,
86     PDFOP_SetRGBColor_Stroke, PDFOP_SetRenderIntent,
87     PDFOP_CloseStrokePath, PDFOP_StrokePath,
88     PDFOP_SetColor_Fill, PDFOP_SetColor_Stroke,
89     PDFOP_SetColorPS_Fill, PDFOP_SetColorPS_Stroke,
90     PDFOP_ShadeFill, PDFOP_SetCharSpace,
91     PDFOP_MoveTextPoint, PDFOP_MoveTextPoint_SetLeading,
92     PDFOP_SetFont, PDFOP_ShowText,
93     PDFOP_ShowText_Positioning, PDFOP_SetTextLeading,
94     PDFOP_SetTextMatrix, PDFOP_SetTextRenderMode,
95     PDFOP_SetTextRise, PDFOP_SetWordSpace,
96     PDFOP_SetHorzScale, PDFOP_MoveToNextLine,
97     PDFOP_CurveTo_23, PDFOP_SetLineWidth,
98     PDFOP_Clip, PDFOP_EOClip,
99     PDFOP_CurveTo_13, PDFOP_NextLineShowText,
100     PDFOP_NextLineShowText_Space, PDFOP_Invalid
101 } PDFOP;
102 #define PARAM_BUF_SIZE  16
103 typedef struct {
104     int                 m_Type;
105     union {
106         struct {
107             FX_BOOL             m_bInteger;
108             union {
109                 int             m_Integer;
110                 FX_FLOAT m_Float;
111             };
112         } m_Number;
113         CPDF_Object*    m_pObject;
114         struct {
115             int                 m_Len;
116             char                m_Buffer[32];
117         } m_Name;
118     };
119 } _ContentParam;
120 #if defined(_FPDFAPI_MINI_)
121 #define _FPDF_MAX_FORM_LEVEL_           17
122 #else
123 #define _FPDF_MAX_FORM_LEVEL_           30
124 #endif
125 #define _FPDF_MAX_TYPE3_FORM_LEVEL_     4
126 #define _FPDF_MAX_OBJECT_STACK_SIZE_ 512
127 class CPDF_StreamContentParser : public CFX_Object
128 {
129 public:
130     CPDF_StreamContentParser();
131     ~CPDF_StreamContentParser();
132     FX_BOOL Initialize();
133     void        PrepareParse(CPDF_Document* pDoc, CPDF_Dictionary* pPageResources, CPDF_Dictionary* pParentResources,
134                          CFX_AffineMatrix* pmtContentToUser,
135                          CPDF_PageObjects* pObjList, CPDF_Dictionary* pResources,
136                          CFX_FloatRect* pBBox, CPDF_ParseOptions* pOptions,
137                          CPDF_AllStates* pAllStates, int level);
138     CPDF_Document*              m_pDocument;
139     CPDF_Dictionary*    m_pPageResources;
140     CPDF_Dictionary*    m_pParentResources;
141     CPDF_PageObjects*   m_pObjectList;
142     CPDF_Dictionary*    m_pResources;
143     int                                 m_Level;
144     CFX_AffineMatrix    m_mtContentToUser;
145     CFX_FloatRect               m_BBox;
146     CPDF_ParseOptions   m_Options;
147     _ContentParam               m_ParamBuf1[PARAM_BUF_SIZE];
148     FX_DWORD                    m_ParamStartPos;
149     FX_DWORD                    m_ParamCount;
150     void                                AddNumberParam(FX_LPCSTR str, int len);
151     void                                AddObjectParam(CPDF_Object* pObj);
152     void                                AddNameParam(FX_LPCSTR name, int size);
153     int                                 GetNextParamPos();
154     void                                ClearAllParams();
155     CPDF_Object*                GetObject(FX_DWORD index);
156     CFX_ByteString              GetString(FX_DWORD index);
157     FX_FLOAT                    GetNumber(FX_DWORD index);
158     FX_FLOAT            GetNumber16(FX_DWORD index);
159     int                                 GetInteger(FX_DWORD index)
160     {
161         return (FX_INT32)(GetNumber(index));
162     }
163     FX_BOOL                             OnOperator(FX_LPCSTR op);
164     void                                BigCaseCaller(int index);
165     FX_BOOL                             m_bAbort;
166 #ifndef _FPDFAPI_MINI_
167     CPDF_StreamParser*  m_pSyntax;
168     FX_DWORD                    GetParsePos()
169     {
170         return m_pSyntax->GetPos();
171     }
172 #else
173     int                                 m_WordState;
174     void                                InputData(FX_LPCBYTE src_buf, FX_DWORD src_size);
175     void                                Finish();
176     void                                StartArray();
177     void                                EndArray();
178     void                                StartDict();
179     void                                EndDict();
180     void                                EndName();
181     void                                EndNumber();
182     void                                EndKeyword();
183     void                                EndHexString();
184     void                                EndString();
185     void                                EndImageDict();
186     void                                EndInlineImage();
187     FX_LPBYTE                   m_pWordBuf;
188     FX_DWORD                    m_WordSize;
189     CFX_BinaryBuf               m_StringBuf;
190     int                                 m_StringLevel, m_StringState, m_EscCode;
191     void                                AddContainer(CPDF_Object* pObject);
192     FX_BOOL                             SetToCurObj(CPDF_Object* pObject);
193     FX_LPBYTE                   m_pDictName;
194     FX_BOOL                             m_bDictName;
195     CPDF_Object**               m_pObjectStack;
196     FX_BOOL*                    m_pObjectState;
197     FX_DWORD                    m_ObjectSize;
198     int                                 m_InlineImageState;
199     FX_BYTE                             m_InlineWhiteChar;
200     CFX_BinaryBuf               m_ImageSrcBuf;
201     FX_LPBYTE                   m_pStreamBuf;
202 #endif
203     CPDF_AllStates*             m_pCurStates;
204     CPDF_ContentMark    m_CurContentMark;
205     CFX_PtrArray                m_ClipTextList;
206     CPDF_TextObject*    m_pLastTextObject;
207     FX_FLOAT                    m_DefFontSize;
208     void                                AddTextObject(CFX_ByteString* pText, FX_FLOAT fInitKerning, FX_FLOAT* pKerning, int count);
209
210     void                                ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y);
211     void                                ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y);
212     void                                OnChangeTextMatrix();
213 #ifndef _FPDFAPI_MINI_
214     FX_DWORD                    Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_DWORD max_cost);
215     void                                ParsePathObject();
216 #endif
217     int                                 m_CompatCount;
218     FX_PATHPOINT*               m_pPathPoints;
219     int                                 m_PathPointCount;
220     int                                 m_PathAllocSize;
221     FX_FLOAT                    m_PathStartX, m_PathStartY;
222     FX_FLOAT                    m_PathCurrentX, m_PathCurrentY;
223     int                                 m_PathClipType;
224     void                                AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag);
225     void                                AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h);
226     void                                AddPathObject(int FillType, FX_BOOL bStroke);
227     CPDF_ImageObject*   AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline);
228     void                                AddDuplicateImage();
229     void                                AddForm(CPDF_Stream*);
230     CFX_ByteString              m_LastImageName;
231     CPDF_Image*                 m_pLastImage;
232     CFX_BinaryBuf               m_LastImageDict, m_LastImageData;
233     CPDF_Dictionary*    m_pLastImageDict;
234     CPDF_Dictionary*    m_pLastCloneImageDict;
235     FX_BOOL                             m_bReleaseLastDict;
236     FX_BOOL                             m_bSameLastDict;
237     void                                SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph);
238     FX_BOOL                             m_bColored;
239     FX_FLOAT                    m_Type3Data[6];
240     FX_BOOL                             m_bResourceMissing;
241     CFX_PtrArray                m_StateStack;
242     void                                SaveStates(CPDF_AllStates*);
243     void                                RestoreStates(CPDF_AllStates*);
244     CPDF_Font*                  FindFont(const CFX_ByteString& name);
245     CPDF_ColorSpace*    FindColorSpace(const CFX_ByteString& name);
246     CPDF_Pattern*               FindPattern(const CFX_ByteString& name, FX_BOOL bShading);
247     CPDF_Object*                FindResourceObj(FX_BSTR type, const CFX_ByteString& name);
248     void Handle_CloseFillStrokePath();
249     void Handle_FillStrokePath();
250     void Handle_CloseEOFillStrokePath();
251     void Handle_EOFillStrokePath();
252     void Handle_BeginMarkedContent_Dictionary();
253     void Handle_BeginImage();
254     void Handle_BeginMarkedContent();
255     void Handle_BeginText();
256     void Handle_BeginSectionUndefined();
257     void Handle_CurveTo_123();
258     void Handle_ConcatMatrix();
259     void Handle_SetColorSpace_Fill();
260     void Handle_SetColorSpace_Stroke();
261     void Handle_SetDash();
262     void Handle_SetCharWidth();
263     void Handle_SetCachedDevice();
264     void Handle_ExecuteXObject();
265     void Handle_MarkPlace_Dictionary();
266     void Handle_EndImage();
267     void Handle_EndMarkedContent();
268     void Handle_EndText();
269     void Handle_EndSectionUndefined();
270     void Handle_FillPath();
271     void Handle_FillPathOld();
272     void Handle_EOFillPath();
273     void Handle_SetGray_Fill();
274     void Handle_SetGray_Stroke();
275     void Handle_SetExtendGraphState();
276     void Handle_ClosePath();
277     void Handle_SetFlat();
278     void Handle_BeginImageData();
279     void Handle_SetLineJoin();
280     void Handle_SetLineCap();
281     void Handle_SetCMYKColor_Fill();
282     void Handle_SetCMYKColor_Stroke();
283     void Handle_LineTo();
284     void Handle_MoveTo();
285     void Handle_SetMiterLimit();
286     void Handle_MarkPlace();
287     void Handle_EndPath();
288     void Handle_SaveGraphState();
289     void Handle_RestoreGraphState();
290     void Handle_Rectangle();
291     void Handle_SetRGBColor_Fill();
292     void Handle_SetRGBColor_Stroke();
293     void Handle_SetRenderIntent();
294     void Handle_CloseStrokePath();
295     void Handle_StrokePath();
296     void Handle_SetColor_Fill();
297     void Handle_SetColor_Stroke();
298     void Handle_SetColorPS_Fill();
299     void Handle_SetColorPS_Stroke();
300     void Handle_ShadeFill();
301     void Handle_SetCharSpace();
302     void Handle_MoveTextPoint();
303     void Handle_MoveTextPoint_SetLeading();
304     void Handle_SetFont();
305     void Handle_ShowText();
306     void Handle_ShowText_Positioning();
307     void Handle_SetTextLeading();
308     void Handle_SetTextMatrix();
309     void Handle_SetTextRenderMode();
310     void Handle_SetTextRise();
311     void Handle_SetWordSpace();
312     void Handle_SetHorzScale();
313     void Handle_MoveToNextLine();
314     void Handle_CurveTo_23();
315     void Handle_SetLineWidth();
316     void Handle_Clip();
317     void Handle_EOClip();
318     void Handle_CurveTo_13();
319     void Handle_NextLineShowText();
320     void Handle_NextLineShowText_Space();
321     void Handle_Invalid();
322 };
323 class CPDF_ContentParser : public CFX_Object
324 {
325 public:
326     CPDF_ContentParser();
327     ~CPDF_ContentParser();
328     typedef enum { Ready, ToBeContinued, Done } ParseStatus;
329     ParseStatus                 GetStatus()
330     {
331         return m_Status;
332     }
333     void                                Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions);
334     void                                Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* pParentMatrix,
335                               CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOptions, int level);
336     void                                Continue(IFX_Pause* pPause);
337     int                                 EstimateProgress();
338 protected:
339     void                                Clear();
340     ParseStatus                 m_Status;
341     CPDF_PageObjects*   m_pObjects;
342     FX_BOOL                             m_bForm;
343     CPDF_ParseOptions   m_Options;
344     CPDF_Type3Char*             m_pType3Char;
345     int                                 m_InternalStage;
346     CPDF_StreamAcc*             m_pSingleStream;
347     CPDF_StreamAcc**    m_pStreamArray;
348     FX_DWORD                    m_nStreams;
349     FX_LPBYTE                   m_pData;
350     FX_DWORD                    m_Size;
351     class CPDF_StreamContentParser*     m_pParser;
352     FX_DWORD                    m_CurrentOffset;
353     CPDF_StreamFilter*  m_pStreamFilter;
354 };
355 class CPDF_AllStates : public CPDF_GraphicStates
356 {
357 public:
358     CPDF_AllStates();
359     ~CPDF_AllStates();
360     void        Copy(const CPDF_AllStates& src);
361     void        ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser* pParser);
362     void        SetLineDash(CPDF_Array*, FX_FLOAT, FX_FLOAT scale);
363     CFX_AffineMatrix            m_TextMatrix, m_CTM, m_ParentMatrix;
364     FX_FLOAT                            m_TextX, m_TextY, m_TextLineX, m_TextLineY;
365     FX_FLOAT                            m_TextLeading, m_TextRise, m_TextHorzScale;
366 };
367 template <class ObjClass> class CPDF_CountedObject : public CFX_Object
368 {
369 public:
370     ObjClass    m_Obj;
371     FX_DWORD    m_nCount;
372 };
373 typedef CFX_MapPtrTemplate<CPDF_Dictionary*, CPDF_CountedObject<CPDF_Font*>*>           CPDF_FontMap;
374 typedef CFX_MapPtrTemplate<CPDF_Object*, CPDF_CountedObject<CPDF_ColorSpace*>*>         CPDF_ColorSpaceMap;
375 typedef CFX_MapPtrTemplate<CPDF_Object*, CPDF_CountedObject<CPDF_Pattern*>*>            CPDF_PatternMap;
376 typedef CFX_MapPtrTemplate<FX_DWORD, CPDF_CountedObject<CPDF_Image*>*>                          CPDF_ImageMap;
377 typedef CFX_MapPtrTemplate<CPDF_Stream*, CPDF_CountedObject<CPDF_IccProfile*>*>         CPDF_IccProfileMap;
378 typedef CFX_MapPtrTemplate<CPDF_Stream*, CPDF_CountedObject<CPDF_StreamAcc*>*>          CPDF_FontFileMap;
379 template <class KeyType, class ValueType>
380 KeyType PDF_DocPageData_FindValue(const CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<ValueType>*> &map, ValueType findValue, CPDF_CountedObject<ValueType>*& findData)
381 {
382     FX_POSITION pos = map.GetStartPosition();
383     while (pos) {
384         KeyType findKey;
385         map.GetNextAssoc(pos, findKey, findData);
386         if (findData->m_Obj == findValue) {
387             return findKey;
388         }
389     }
390     findData = NULL;
391     return (KeyType)(FX_UINTPTR)NULL;
392 }
393 template <class KeyType, class ValueType>
394 FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<ValueType>*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE)
395 {
396     if (!findKey && !findValue) {
397         return FALSE;
398     }
399     CPDF_CountedObject<ValueType>* findData = NULL;
400     if (!findKey) {
401         findKey = PDF_DocPageData_FindValue<KeyType, ValueType>(map, findValue, findData);
402     } else if (!map.Lookup(findKey, findData)) {
403         return FALSE;
404     }
405     if (findData && ((-- findData->m_nCount) == 0 || bForce)) {
406         delete findData->m_Obj;
407         delete findData;
408         map.RemoveKey(findKey);
409         return TRUE;
410     }
411     return FALSE;
412 }
413 class CPDF_DocPageData : public CFX_Object
414 {
415 public:
416     CPDF_DocPageData(CPDF_Document *pPDFDoc);
417     ~CPDF_DocPageData();
418     void                        Clear(FX_BOOL bRelease = FALSE);
419     CPDF_Font*                  GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly);
420     CPDF_Font*                  GetStandardFont(FX_BSTR fontName, CPDF_FontEncoding* pEncoding);
421     void                        ReleaseFont(CPDF_Dictionary* pFontDict);
422     CPDF_ColorSpace*            GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictionary* pResources);
423     CPDF_ColorSpace*            GetCopiedColorSpace(CPDF_Object* pCSObj);
424     void                        ReleaseColorSpace(CPDF_Object* pColorSpace);
425     CPDF_Pattern*               GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* matrix);
426     void                        ReleasePattern(CPDF_Object* pPatternObj);
427     CPDF_Image*                 GetImage(CPDF_Object* pImageStream);
428     void                        ReleaseImage(CPDF_Object* pImageStream);
429     CPDF_IccProfile*            GetIccProfile(CPDF_Stream* pIccProfileStream);
430     void                        ReleaseIccProfile(CPDF_Stream* pIccProfileStream, CPDF_IccProfile* pIccProfile);
431     CPDF_StreamAcc*             GetFontFileStreamAcc(CPDF_Stream* pFontStream);
432     void                        ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOOL bForce = FALSE);
433     FX_BOOL                     IsForceClear() const {return m_bForceClear;}
434
435     CPDF_Document*              m_pPDFDoc;
436     CPDF_FontMap                m_FontMap;
437     CPDF_ColorSpaceMap          m_ColorSpaceMap;
438     CPDF_PatternMap             m_PatternMap;
439     CPDF_ImageMap               m_ImageMap;
440     CPDF_IccProfileMap          m_IccProfileMap;
441     CFX_MapByteStringToPtr      m_HashProfileMap;
442     CPDF_FontFileMap            m_FontFileMap;
443     FX_BOOL                     m_bForceClear;
444 };
445 class CPDF_Function : public CFX_Object
446 {
447 public:
448     static CPDF_Function*       Load(CPDF_Object* pFuncObj);
449     virtual ~CPDF_Function();
450     FX_BOOL             Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const;
451     int                 CountInputs()
452     {
453         return m_nInputs;
454     }
455     int                 CountOutputs()
456     {
457         return m_nOutputs;
458     }
459 protected:
460     CPDF_Function();
461     int                 m_nInputs, m_nOutputs;
462     FX_FLOAT*   m_pDomains;
463     FX_FLOAT*   m_pRanges;
464     FX_BOOL             Init(CPDF_Object* pObj);
465     virtual FX_BOOL     v_Init(CPDF_Object* pObj) = 0;
466     virtual FX_BOOL     v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
467 };
468 class CPDF_IccProfile : public CFX_Object
469 {
470 public:
471     CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize);
472     ~CPDF_IccProfile();
473     FX_INT32 GetComponents() { return m_nSrcComponents; }
474     FX_BOOL                                     m_bsRGB;
475     FX_INT32                m_nSrcComponents;
476     FX_LPVOID                           m_pTransform;
477 };
478 class CPDF_DeviceCS : public CPDF_ColorSpace
479 {
480 public:
481     CPDF_DeviceCS(int family);
482     virtual FX_BOOL     GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const;
483     FX_BOOL     SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const;
484     FX_BOOL     v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const;
485     FX_BOOL     v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const;
486     virtual void        TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const;
487 };
488 class CPDF_PatternCS : public CPDF_ColorSpace
489 {
490 public:
491     CPDF_PatternCS();
492     ~CPDF_PatternCS();
493     virtual FX_BOOL             v_Load(CPDF_Document* pDoc, CPDF_Array* pArray);
494     virtual FX_BOOL             GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const;
495     virtual CPDF_ColorSpace*    GetBaseCS() const
496     {
497         return m_pBaseCS;
498     }
499     CPDF_ColorSpace*    m_pBaseCS;
500 };
501 #define MAX_PAGE_OBJECTS_UNIFY_NAMING                           4096
502 class CPDF_ResourceNaming : public CFX_Object
503 {
504 public:
505     struct _NamingState : public CFX_Object {
506         CFX_ByteString  m_Prefix;
507         int                             m_nIndex;
508     };
509     ~CPDF_ResourceNaming();
510     CFX_ByteString              GetName(const CPDF_Dictionary* pResList, FX_LPCSTR szType);
511 protected:
512     CFX_MapByteStringToPtr      m_NamingCache;
513 };
514
515 #endif  // _PAGEINT_H_