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_INCLUDE_CPDF_IMAGE_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ |
| 9 |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
| 11 #include "core/fxcrt/include/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(); |
| 32 |
| 33 FX_BOOL LoadImageF(CPDF_Stream* pImageStream, FX_BOOL bInline); |
| 34 |
| 35 void Release(); |
| 36 |
| 37 CPDF_Image* Clone(); |
| 38 |
| 39 CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } |
| 40 CPDF_Stream* GetStream() const { return m_pStream; } |
| 41 CPDF_Dictionary* GetDict() const { |
| 42 return m_pStream ? m_pStream->GetDict() : NULL; |
| 43 } |
| 44 CPDF_Dictionary* GetOC() const { return m_pOC; } |
| 45 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 46 |
| 47 int32_t GetPixelHeight() const { return m_Height; } |
| 48 int32_t GetPixelWidth() const { return m_Width; } |
| 49 |
| 50 FX_BOOL IsInline() { return m_bInline; } |
| 51 FX_BOOL IsMask() const { return m_bIsMask; } |
| 52 FX_BOOL IsInterpol() const { return m_bInterpolate; } |
| 53 |
| 54 CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = NULL, |
| 55 FX_DWORD* pMatteColor = NULL, |
| 56 FX_BOOL bStdCS = FALSE, |
| 57 FX_DWORD GroupFamily = 0, |
| 58 FX_BOOL bLoadMask = FALSE) const; |
| 59 |
| 60 void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } |
| 61 void SetImage(const CFX_DIBitmap* pDIBitmap, |
| 62 int32_t iCompress, |
| 63 IFX_FileWrite* pFileWrite = NULL, |
| 64 IFX_FileRead* pFileRead = NULL, |
| 65 const CFX_DIBitmap* pMask = NULL); |
| 66 void SetJpegImage(uint8_t* pImageData, FX_DWORD size); |
| 67 void SetJpegImage(IFX_FileRead* pFile); |
| 68 |
| 69 void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); |
| 70 |
| 71 FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource, |
| 72 CPDF_Dictionary* pPageResource, |
| 73 FX_BOOL bStdCS = FALSE, |
| 74 FX_DWORD GroupFamily = 0, |
| 75 FX_BOOL bLoadMask = FALSE); |
| 76 FX_BOOL Continue(IFX_Pause* pPause); |
| 77 CFX_DIBSource* DetachBitmap(); |
| 78 CFX_DIBSource* DetachMask(); |
| 79 |
| 80 CFX_DIBSource* m_pDIBSource; |
| 81 CFX_DIBSource* m_pMask; |
| 82 FX_DWORD m_MatteColor; |
| 83 |
| 84 private: |
| 85 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); |
| 86 |
| 87 CPDF_Stream* m_pStream; |
| 88 FX_BOOL m_bInline; |
| 89 CPDF_Dictionary* m_pInlineDict; |
| 90 int32_t m_Height; |
| 91 int32_t m_Width; |
| 92 FX_BOOL m_bIsMask; |
| 93 FX_BOOL m_bInterpolate; |
| 94 CPDF_Document* m_pDocument; |
| 95 CPDF_Dictionary* m_pOC; |
| 96 }; |
| 97 |
| 98 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGE_H_ |
OLD | NEW |