OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ |
8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ |
9 | 9 |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class CPDF_Dictionay; | 21 class CPDF_Dictionay; |
22 class CPDF_Document; | 22 class CPDF_Document; |
23 class CPDF_Page; | 23 class CPDF_Page; |
24 class IFX_FileRead; | 24 class IFX_FileRead; |
25 class IFX_FileWrite; | 25 class IFX_FileWrite; |
26 class IFX_Pause; | 26 class IFX_Pause; |
27 | 27 |
28 class CPDF_Image { | 28 class CPDF_Image { |
29 public: | 29 public: |
30 explicit CPDF_Image(CPDF_Document* pDoc); | 30 explicit CPDF_Image(CPDF_Document* pDoc); |
| 31 CPDF_Image(CPDF_Document* pDoc, CPDF_Stream* pStream, bool bInline); |
31 ~CPDF_Image(); | 32 ~CPDF_Image(); |
32 | 33 |
33 FX_BOOL LoadImageF(CPDF_Stream* pImageStream, FX_BOOL bInline); | |
34 | |
35 void Release(); | |
36 | |
37 CPDF_Image* Clone(); | 34 CPDF_Image* Clone(); |
38 | 35 |
39 CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } | 36 CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } |
40 CPDF_Stream* GetStream() const { return m_pStream; } | 37 CPDF_Stream* GetStream() const { return m_pStream; } |
41 CPDF_Dictionary* GetDict() const { | 38 CPDF_Dictionary* GetDict() const { |
42 return m_pStream ? m_pStream->GetDict() : nullptr; | 39 return m_pStream ? m_pStream->GetDict() : nullptr; |
43 } | 40 } |
44 CPDF_Dictionary* GetOC() const { return m_pOC; } | 41 CPDF_Dictionary* GetOC() const { return m_pOC; } |
45 CPDF_Document* GetDocument() const { return m_pDocument; } | 42 CPDF_Document* GetDocument() const { return m_pDocument; } |
46 | 43 |
47 int32_t GetPixelHeight() const { return m_Height; } | 44 int32_t GetPixelHeight() const { return m_Height; } |
48 int32_t GetPixelWidth() const { return m_Width; } | 45 int32_t GetPixelWidth() const { return m_Width; } |
49 | 46 |
50 FX_BOOL IsInline() { return m_bInline; } | 47 bool IsInline() const { return m_bInline; } |
51 FX_BOOL IsMask() const { return m_bIsMask; } | 48 bool IsMask() const { return m_bIsMask; } |
52 FX_BOOL IsInterpol() const { return m_bInterpolate; } | 49 bool IsInterpol() const { return m_bInterpolate; } |
53 | 50 |
54 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, | 51 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, |
55 uint32_t* pMatteColor = nullptr, | 52 uint32_t* pMatteColor = nullptr, |
56 FX_BOOL bStdCS = FALSE, | 53 FX_BOOL bStdCS = FALSE, |
57 uint32_t GroupFamily = 0, | 54 uint32_t GroupFamily = 0, |
58 FX_BOOL bLoadMask = FALSE) const; | 55 FX_BOOL bLoadMask = FALSE) const; |
59 | 56 |
60 void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } | 57 void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } |
61 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); | 58 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); |
62 void SetJpegImage(uint8_t* pImageData, uint32_t size); | |
63 void SetJpegImage(IFX_FileRead* pFile); | 59 void SetJpegImage(IFX_FileRead* pFile); |
64 | 60 |
65 void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); | 61 void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); |
66 | 62 |
67 FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource, | 63 FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource, |
68 CPDF_Dictionary* pPageResource, | 64 CPDF_Dictionary* pPageResource, |
69 FX_BOOL bStdCS = FALSE, | 65 FX_BOOL bStdCS = FALSE, |
70 uint32_t GroupFamily = 0, | 66 uint32_t GroupFamily = 0, |
71 FX_BOOL bLoadMask = FALSE); | 67 FX_BOOL bLoadMask = FALSE); |
72 FX_BOOL Continue(IFX_Pause* pPause); | 68 FX_BOOL Continue(IFX_Pause* pPause); |
73 CFX_DIBSource* DetachBitmap(); | 69 CFX_DIBSource* DetachBitmap(); |
74 CFX_DIBSource* DetachMask(); | 70 CFX_DIBSource* DetachMask(); |
75 | 71 |
76 CFX_DIBSource* m_pDIBSource; | 72 CFX_DIBSource* m_pDIBSource; |
77 CFX_DIBSource* m_pMask; | 73 CFX_DIBSource* m_pMask; |
78 uint32_t m_MatteColor; | 74 uint32_t m_MatteColor; |
79 | 75 |
80 private: | 76 private: |
81 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); | 77 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); |
82 | 78 |
83 CPDF_Stream* m_pStream; | 79 CPDF_Stream* m_pStream; |
84 FX_BOOL m_bInline; | 80 const bool m_bInline; |
85 CPDF_Dictionary* m_pInlineDict; | 81 CPDF_Dictionary* m_pInlineDict; |
86 int32_t m_Height; | 82 int32_t m_Height; |
87 int32_t m_Width; | 83 int32_t m_Width; |
88 FX_BOOL m_bIsMask; | 84 bool m_bIsMask; |
89 FX_BOOL m_bInterpolate; | 85 bool m_bInterpolate; |
90 CPDF_Document* m_pDocument; | 86 CPDF_Document* const m_pDocument; |
91 CPDF_Dictionary* m_pOC; | 87 CPDF_Dictionary* m_pOC; |
92 }; | 88 }; |
93 | 89 |
94 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ | 90 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ |
OLD | NEW |