| OLD | NEW |
| (Empty) |
| 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 CORE_FXCODEC_INCLUDE_FX_CODEC_H_ | |
| 8 #define CORE_FXCODEC_INCLUDE_FX_CODEC_H_ | |
| 9 | |
| 10 #include <map> | |
| 11 #include <memory> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "core/fxcodec/codec/ccodec_basicmodule.h" | |
| 15 #include "core/fxcodec/codec/ccodec_faxmodule.h" | |
| 16 #include "core/fxcodec/codec/ccodec_flatemodule.h" | |
| 17 #include "core/fxcodec/codec/ccodec_iccmodule.h" | |
| 18 #include "core/fxcodec/codec/ccodec_jbig2module.h" | |
| 19 #include "core/fxcodec/codec/ccodec_jpegmodule.h" | |
| 20 #include "core/fxcodec/codec/ccodec_jpxmodule.h" | |
| 21 #include "core/fxcodec/codec/ccodec_scanlinedecoder.h" | |
| 22 #include "core/fxcodec/include/fx_codec_def.h" | |
| 23 #include "core/fxcrt/include/fx_basic.h" | |
| 24 #include "core/fxcrt/include/fx_coordinates.h" | |
| 25 | |
| 26 class CFX_DIBSource; | |
| 27 class CJPX_Decoder; | |
| 28 class CPDF_ColorSpace; | |
| 29 class CPDF_StreamAcc; | |
| 30 | |
| 31 #ifdef PDF_ENABLE_XFA | |
| 32 #include "core/fxcodec/codec/ccodec_bmpmodule.h" | |
| 33 #include "core/fxcodec/codec/ccodec_gifmodule.h" | |
| 34 #include "core/fxcodec/codec/ccodec_pngmodule.h" | |
| 35 #include "core/fxcodec/codec/ccodec_tiffmodule.h" | |
| 36 | |
| 37 class CCodec_ProgressiveDecoder; | |
| 38 | |
| 39 class CFX_DIBAttribute { | |
| 40 public: | |
| 41 CFX_DIBAttribute(); | |
| 42 ~CFX_DIBAttribute(); | |
| 43 | |
| 44 int32_t m_nXDPI; | |
| 45 int32_t m_nYDPI; | |
| 46 FX_FLOAT m_fAspectRatio; | |
| 47 uint16_t m_wDPIUnit; | |
| 48 CFX_ByteString m_strAuthor; | |
| 49 uint8_t m_strTime[20]; | |
| 50 int32_t m_nGifLeft; | |
| 51 int32_t m_nGifTop; | |
| 52 uint32_t* m_pGifLocalPalette; | |
| 53 uint32_t m_nGifLocalPalNum; | |
| 54 int32_t m_nBmpCompressType; | |
| 55 std::map<uint32_t, void*> m_Exif; | |
| 56 }; | |
| 57 #endif // PDF_ENABLE_XFA | |
| 58 | |
| 59 class CCodec_ModuleMgr { | |
| 60 public: | |
| 61 CCodec_ModuleMgr(); | |
| 62 ~CCodec_ModuleMgr(); | |
| 63 | |
| 64 CCodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } | |
| 65 CCodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } | |
| 66 CCodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } | |
| 67 CCodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } | |
| 68 CCodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } | |
| 69 CCodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } | |
| 70 CCodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } | |
| 71 | |
| 72 #ifdef PDF_ENABLE_XFA | |
| 73 CCodec_ProgressiveDecoder* CreateProgressiveDecoder(); | |
| 74 CCodec_PngModule* GetPngModule() const { return m_pPngModule.get(); } | |
| 75 CCodec_GifModule* GetGifModule() const { return m_pGifModule.get(); } | |
| 76 CCodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); } | |
| 77 CCodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); } | |
| 78 #endif // PDF_ENABLE_XFA | |
| 79 | |
| 80 protected: | |
| 81 std::unique_ptr<CCodec_BasicModule> m_pBasicModule; | |
| 82 std::unique_ptr<CCodec_FaxModule> m_pFaxModule; | |
| 83 std::unique_ptr<CCodec_JpegModule> m_pJpegModule; | |
| 84 std::unique_ptr<CCodec_JpxModule> m_pJpxModule; | |
| 85 std::unique_ptr<CCodec_Jbig2Module> m_pJbig2Module; | |
| 86 std::unique_ptr<CCodec_IccModule> m_pIccModule; | |
| 87 | |
| 88 #ifdef PDF_ENABLE_XFA | |
| 89 std::unique_ptr<CCodec_PngModule> m_pPngModule; | |
| 90 std::unique_ptr<CCodec_GifModule> m_pGifModule; | |
| 91 std::unique_ptr<CCodec_BmpModule> m_pBmpModule; | |
| 92 std::unique_ptr<CCodec_TiffModule> m_pTiffModule; | |
| 93 #endif // PDF_ENABLE_XFA | |
| 94 | |
| 95 std::unique_ptr<CCodec_FlateModule> m_pFlateModule; | |
| 96 }; | |
| 97 | |
| 98 void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels); | |
| 99 void sRGB_to_AdobeCMYK(FX_FLOAT R, | |
| 100 FX_FLOAT G, | |
| 101 FX_FLOAT B, | |
| 102 FX_FLOAT& c, | |
| 103 FX_FLOAT& m, | |
| 104 FX_FLOAT& y, | |
| 105 FX_FLOAT& k); | |
| 106 void AdobeCMYK_to_sRGB(FX_FLOAT c, | |
| 107 FX_FLOAT m, | |
| 108 FX_FLOAT y, | |
| 109 FX_FLOAT k, | |
| 110 FX_FLOAT& R, | |
| 111 FX_FLOAT& G, | |
| 112 FX_FLOAT& B); | |
| 113 void AdobeCMYK_to_sRGB1(uint8_t c, | |
| 114 uint8_t m, | |
| 115 uint8_t y, | |
| 116 uint8_t k, | |
| 117 uint8_t& R, | |
| 118 uint8_t& G, | |
| 119 uint8_t& B); | |
| 120 FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]); | |
| 121 void FaxG4Decode(const uint8_t* src_buf, | |
| 122 uint32_t src_size, | |
| 123 int* pbitpos, | |
| 124 uint8_t* dest_buf, | |
| 125 int width, | |
| 126 int height, | |
| 127 int pitch); | |
| 128 | |
| 129 #endif // CORE_FXCODEC_INCLUDE_FX_CODEC_H_ | |
| OLD | NEW |