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_PAGE_CPDF_IMAGE_H_ | 7 #ifndef CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ |
8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ | 8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "core/fpdfapi/parser/cpdf_stream.h" | 12 #include "core/fpdfapi/parser/cpdf_stream.h" |
11 #include "core/fxcrt/fx_system.h" | 13 #include "core/fxcrt/fx_system.h" |
12 | 14 |
13 #define PDF_IMAGE_NO_COMPRESS 0x0000 | 15 #define PDF_IMAGE_NO_COMPRESS 0x0000 |
14 #define PDF_IMAGE_LOSSY_COMPRESS 0x0001 | 16 #define PDF_IMAGE_LOSSY_COMPRESS 0x0001 |
15 #define PDF_IMAGE_LOSSLESS_COMPRESS 0x0002 | 17 #define PDF_IMAGE_LOSSLESS_COMPRESS 0x0002 |
16 #define PDF_IMAGE_MASK_LOSSY_COMPRESS 0x0004 | 18 #define PDF_IMAGE_MASK_LOSSY_COMPRESS 0x0004 |
17 #define PDF_IMAGE_MASK_LOSSLESS_COMPRESS 0x0008 | |
18 | 19 |
19 class CFX_DIBSource; | 20 class CFX_DIBSource; |
20 class CFX_DIBitmap; | 21 class CFX_DIBitmap; |
21 class CPDF_Dictionay; | |
22 class CPDF_Document; | 22 class CPDF_Document; |
23 class CPDF_Page; | 23 class CPDF_Page; |
24 class IFX_Pause; | 24 class IFX_Pause; |
25 class IFX_SeekableReadStream; | 25 class IFX_SeekableReadStream; |
26 class IFX_SeekableWriteStream; | |
27 | 26 |
28 class CPDF_Image { | 27 class CPDF_Image { |
29 public: | 28 public: |
30 explicit CPDF_Image(CPDF_Document* pDoc); | 29 explicit CPDF_Image(CPDF_Document* pDoc); |
31 CPDF_Image(CPDF_Document* pDoc, std::unique_ptr<CPDF_Stream> pStream); | 30 CPDF_Image(CPDF_Document* pDoc, std::unique_ptr<CPDF_Stream> pStream); |
32 CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum); | 31 CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum); |
33 ~CPDF_Image(); | 32 ~CPDF_Image(); |
34 | 33 |
35 CPDF_Image* Clone(); | 34 CPDF_Image* Clone(); |
36 void ConvertStreamToIndirectObject(); | 35 void ConvertStreamToIndirectObject(); |
37 | 36 |
38 CPDF_Dictionary* GetInlineDict() const { return m_pDict; } | 37 CPDF_Dictionary* GetInlineDict() const { return m_pDict; } |
39 CPDF_Stream* GetStream() const { return m_pStream; } | 38 CPDF_Stream* GetStream() const { return m_pStream; } |
40 CPDF_Dictionary* GetDict() const { | 39 CPDF_Dictionary* GetDict() const { |
41 return m_pStream ? m_pStream->GetDict() : nullptr; | 40 return m_pStream ? m_pStream->GetDict() : nullptr; |
42 } | 41 } |
43 CPDF_Dictionary* GetOC() const { return m_pOC; } | 42 CPDF_Dictionary* GetOC() const { return m_pOC; } |
44 CPDF_Document* GetDocument() const { return m_pDocument; } | 43 CPDF_Document* GetDocument() const { return m_pDocument; } |
45 | 44 |
46 int32_t GetPixelHeight() const { return m_Height; } | 45 int32_t GetPixelHeight() const { return m_Height; } |
47 int32_t GetPixelWidth() const { return m_Width; } | 46 int32_t GetPixelWidth() const { return m_Width; } |
48 | 47 |
49 bool IsInline() const { return !!m_pOwnedStream; } | 48 bool IsInline() const { return m_bIsInline; } |
50 bool IsMask() const { return m_bIsMask; } | 49 bool IsMask() const { return m_bIsMask; } |
51 bool IsInterpol() const { return m_bInterpolate; } | 50 bool IsInterpol() const { return m_bInterpolate; } |
52 | 51 |
53 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, | 52 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, |
54 uint32_t* pMatteColor = nullptr, | 53 uint32_t* pMatteColor = nullptr, |
55 bool bStdCS = false, | 54 bool bStdCS = false, |
56 uint32_t GroupFamily = 0, | 55 uint32_t GroupFamily = 0, |
57 bool bLoadMask = false) const; | 56 bool bLoadMask = false) const; |
58 | 57 |
59 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); | 58 void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); |
(...skipping 13 matching lines...) Expand all Loading... |
73 CFX_DIBSource* m_pDIBSource = nullptr; | 72 CFX_DIBSource* m_pDIBSource = nullptr; |
74 CFX_DIBSource* m_pMask = nullptr; | 73 CFX_DIBSource* m_pMask = nullptr; |
75 uint32_t m_MatteColor = 0; | 74 uint32_t m_MatteColor = 0; |
76 | 75 |
77 private: | 76 private: |
78 void FinishInitialization(); | 77 void FinishInitialization(); |
79 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); | 78 CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); |
80 | 79 |
81 int32_t m_Height = 0; | 80 int32_t m_Height = 0; |
82 int32_t m_Width = 0; | 81 int32_t m_Width = 0; |
| 82 bool m_bIsInline = false; |
83 bool m_bIsMask = false; | 83 bool m_bIsMask = false; |
84 bool m_bInterpolate = false; | 84 bool m_bInterpolate = false; |
85 CPDF_Document* const m_pDocument; | 85 CPDF_Document* const m_pDocument; |
86 CPDF_Stream* m_pStream = nullptr; | 86 CPDF_Stream* m_pStream = nullptr; |
87 CPDF_Dictionary* m_pDict = nullptr; | 87 CPDF_Dictionary* m_pDict = nullptr; |
88 std::unique_ptr<CPDF_Stream> m_pOwnedStream; | 88 std::unique_ptr<CPDF_Stream> m_pOwnedStream; |
89 std::unique_ptr<CPDF_Dictionary> m_pOwnedDict; | 89 std::unique_ptr<CPDF_Dictionary> m_pOwnedDict; |
90 CPDF_Dictionary* m_pOC = nullptr; | 90 CPDF_Dictionary* m_pOC = nullptr; |
91 }; | 91 }; |
92 | 92 |
93 #endif // CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ | 93 #endif // CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_ |
OLD | NEW |