| 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_FXGE_WIN32_FX_GE_PS_H_ |
| 8 #define CORE_FXGE_WIN32_FX_GE_PS_H_ |
| 9 |
| 10 #include "core/fxcrt/fx_coordinates.h" |
| 11 #include "core/fxcrt/fx_system.h" |
| 12 #include "core/fxge/cfx_graphstatedata.h" |
| 13 |
| 14 class CFX_DIBSource; |
| 15 class CFX_FaceCache; |
| 16 class CFX_Font; |
| 17 class CFX_FontCache; |
| 18 class CFX_Matrix; |
| 19 class CFX_PathData; |
| 20 class CPSFont; |
| 21 struct FXTEXT_CHARPOS; |
| 22 |
| 23 class IFX_PSOutput { |
| 24 public: |
| 25 virtual void Release() = 0; |
| 26 virtual void OutputPS(const FX_CHAR* str, int len) = 0; |
| 27 |
| 28 protected: |
| 29 virtual ~IFX_PSOutput() {} |
| 30 }; |
| 31 |
| 32 class CFX_PSRenderer { |
| 33 public: |
| 34 CFX_PSRenderer(); |
| 35 ~CFX_PSRenderer(); |
| 36 |
| 37 void Init(IFX_PSOutput* pOutput, |
| 38 int pslevel, |
| 39 int width, |
| 40 int height, |
| 41 bool bCmykOutput); |
| 42 bool StartRendering(); |
| 43 void EndRendering(); |
| 44 void SaveState(); |
| 45 void RestoreState(bool bKeepSaved); |
| 46 void SetClip_PathFill(const CFX_PathData* pPathData, |
| 47 const CFX_Matrix* pObject2Device, |
| 48 int fill_mode); |
| 49 void SetClip_PathStroke(const CFX_PathData* pPathData, |
| 50 const CFX_Matrix* pObject2Device, |
| 51 const CFX_GraphStateData* pGraphState); |
| 52 FX_RECT GetClipBox() { return m_ClipBox; } |
| 53 bool DrawPath(const CFX_PathData* pPathData, |
| 54 const CFX_Matrix* pObject2Device, |
| 55 const CFX_GraphStateData* pGraphState, |
| 56 uint32_t fill_color, |
| 57 uint32_t stroke_color, |
| 58 int fill_mode); |
| 59 bool SetDIBits(const CFX_DIBSource* pBitmap, |
| 60 uint32_t color, |
| 61 int dest_left, |
| 62 int dest_top); |
| 63 bool StretchDIBits(const CFX_DIBSource* pBitmap, |
| 64 uint32_t color, |
| 65 int dest_left, |
| 66 int dest_top, |
| 67 int dest_width, |
| 68 int dest_height, |
| 69 uint32_t flags); |
| 70 bool DrawDIBits(const CFX_DIBSource* pBitmap, |
| 71 uint32_t color, |
| 72 const CFX_Matrix* pMatrix, |
| 73 uint32_t flags); |
| 74 bool DrawText(int nChars, |
| 75 const FXTEXT_CHARPOS* pCharPos, |
| 76 CFX_Font* pFont, |
| 77 const CFX_Matrix* pObject2Device, |
| 78 FX_FLOAT font_size, |
| 79 uint32_t color); |
| 80 |
| 81 private: |
| 82 void OutputPath(const CFX_PathData* pPathData, |
| 83 const CFX_Matrix* pObject2Device); |
| 84 void SetGraphState(const CFX_GraphStateData* pGraphState); |
| 85 void SetColor(uint32_t color); |
| 86 void FindPSFontGlyph(CFX_FaceCache* pFaceCache, |
| 87 CFX_Font* pFont, |
| 88 const FXTEXT_CHARPOS& charpos, |
| 89 int& ps_fontnum, |
| 90 int& ps_glyphindex); |
| 91 void WritePSBinary(const uint8_t* data, int len); |
| 92 |
| 93 IFX_PSOutput* m_pOutput; |
| 94 int m_PSLevel; |
| 95 CFX_GraphStateData m_CurGraphState; |
| 96 bool m_bGraphStateSet; |
| 97 bool m_bCmykOutput; |
| 98 bool m_bColorSet; |
| 99 uint32_t m_LastColor; |
| 100 FX_RECT m_ClipBox; |
| 101 CFX_ArrayTemplate<CPSFont*> m_PSFontList; |
| 102 CFX_ArrayTemplate<FX_RECT> m_ClipBoxStack; |
| 103 bool m_bInited; |
| 104 }; |
| 105 |
| 106 #endif // CORE_FXGE_WIN32_FX_GE_PS_H_ |
| OLD | NEW |