OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 CORE_FPDFAPI_FPDF_PAGE_CPDF_IMAGE_H_ | |
8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_IMAGE_H_ | |
9 | |
10 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" | |
11 #include "core/fxcrt/fx_system.h" | |
12 | |
13 #define PDF_IMAGE_NO_COMPRESS 0x0000 | |
14 #define PDF_IMAGE_LOSSY_COMPRESS 0x0001 | |
15 #define PDF_IMAGE_LOSSLESS_COMPRESS 0x0002 | |
16 #define PDF_IMAGE_MASK_LOSSY_COMPRESS 0x0004 | |
17 #define PDF_IMAGE_MASK_LOSSLESS_COMPRESS 0x0008 | |
18 | |
19 class CFX_DIBitmap; | |
20 class CFX_DIBSource; | |
21 class CPDF_Dictionay; | |
22 class CPDF_Document; | |
23 class CPDF_Page; | |
24 class IFX_FileRead; | |
25 class IFX_FileWrite; | |
26 class IFX_Pause; | |
27 | |
28 class CPDF_Image { | |
29 public: | |
30 explicit CPDF_Image(CPDF_Document* pDoc); | |
31 CPDF_Image(CPDF_Document* pDoc, CPDF_Stream* pStream, bool bInline); | |
32 ~CPDF_Image(); | |
33 | |
34 CPDF_Image* Clone(); | |
35 | |
36 CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } | |
37 CPDF_Stream* GetStream() const { return m_pStream; } | |
38 CPDF_Dictionary* GetDict() const { | |
39 return m_pStream ? m_pStream->GetDict() : nullptr; | |
40 } | |
41 CPDF_Dictionary* GetOC() const { return m_pOC; } | |
42 CPDF_Document* GetDocument() const { return m_pDocument; } | |
43 | |
44 int32_t GetPixelHeight() const { return m_Height; } | |
45 int32_t GetPixelWidth() const { return m_Width; } | |
46 | |
47 bool IsInline() const { return m_bInline; } | |
48 bool IsMask() const { return m_bIsMask; } | |
49 bool IsInterpol() const { return m_bInterpolate; } | |
50 | |
51 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, | |
52 uint32_t* pMatteColor = nullptr, | |
53 FX_BOOL bStdCS = FALSE, | |
54 uint32_t GroupFamily = 0, | |
55 FX_BOOL bLoadMask = FALSE) const; | |
56 | |
57 void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } | |
58 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); | |
59 void SetJpegImage(IFX_FileRead* pFile); | |
60 | |
61 void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); | |
62 | |
63 FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource, | |
64 CPDF_Dictionary* pPageResource, | |
65 FX_BOOL bStdCS = FALSE, | |
66 uint32_t GroupFamily = 0, | |
67 FX_BOOL bLoadMask = FALSE); | |
68 FX_BOOL Continue(IFX_Pause* pPause); | |
69 CFX_DIBSource* DetachBitmap(); | |
70 CFX_DIBSource* DetachMask(); | |
71 | |
72 CFX_DIBSource* m_pDIBSource; | |
73 CFX_DIBSource* m_pMask; | |
74 uint32_t m_MatteColor; | |
75 | |
76 private: | |
77 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); | |
78 | |
79 CPDF_Stream* m_pStream; | |
80 const bool m_bInline; | |
81 CPDF_Dictionary* m_pInlineDict; | |
82 int32_t m_Height; | |
83 int32_t m_Width; | |
84 bool m_bIsMask; | |
85 bool m_bInterpolate; | |
86 CPDF_Document* const m_pDocument; | |
87 CPDF_Dictionary* m_pOC; | |
88 }; | |
89 | |
90 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_IMAGE_H_ | |
OLD | NEW |