Home | History | Annotate | Download | only in include
      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 _FX_AGG_DEVICE_DRIVER_
      8 #define _FX_AGG_DEVICE_DRIVER_
      9 #include "fxfx_agg_path_storage.h"
     10 #include "fxfx_agg_rasterizer_scanline_aa.h"
     11 class CAgg_PathData : public CFX_Object
     12 {
     13 public:
     14     CAgg_PathData() {}
     15     ~CAgg_PathData() {}
     16     FX_NAMESPACE_DECLARE(agg, path_storage)	m_PathData;
     17     void			BuildPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device);
     18 };
     19 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver
     20 {
     21 public:
     22     CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout);
     23     virtual ~CFX_AggDeviceDriver();
     24     void				InitPlatform();
     25     void				DestroyPlatform();
     26 
     27 
     28     virtual int			GetDeviceCaps(int caps_id);
     29 
     30 
     31     virtual void		SaveState();
     32     virtual void		RestoreState(FX_BOOL bKeepSaved);
     33 
     34 
     35     virtual FX_BOOL		SetClip_PathFill(const CFX_PathData* pPathData,
     36                                          const CFX_AffineMatrix* pObject2Device,
     37                                          int fill_mode
     38                                      );
     39 
     40 
     41     virtual FX_BOOL		SetClip_PathStroke(const CFX_PathData* pPathData,
     42                                            const CFX_AffineMatrix* pObject2Device,
     43                                            const CFX_GraphStateData* pGraphState
     44                                        );
     45 
     46 
     47     virtual FX_BOOL		DrawPath(const CFX_PathData* pPathData,
     48                                  const CFX_AffineMatrix* pObject2Device,
     49                                  const CFX_GraphStateData* pGraphState,
     50                                  FX_DWORD fill_color,
     51                                  FX_DWORD stroke_color,
     52                                  int fill_mode,
     53                                  int alpha_flag,
     54                                  void* pIccTransform,
     55                                  int blend_type
     56                              );
     57 
     58     virtual FX_BOOL		SetPixel(int x, int y, FX_DWORD color,
     59                                  int alpha_flag, void* pIccTransform);
     60 
     61     virtual FX_BOOL		FillRect(const FX_RECT* pRect,
     62                                  FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type);
     63 
     64 
     65     virtual FX_BOOL		DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color,
     66                                          int alpha_flag, void* pIccTransform, int blend_type)
     67     {
     68         return FALSE;
     69     }
     70 
     71     virtual FX_BOOL		GetClipBox(FX_RECT* pRect);
     72 
     73 
     74     virtual FX_BOOL		GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE);
     75     virtual CFX_DIBitmap*   GetBackDrop()
     76     {
     77         return m_pOriDevice;
     78     }
     79 
     80     virtual FX_BOOL		SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type,
     81                                   int alpha_flag, void* pIccTransform);
     82     virtual FX_BOOL		StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top,
     83                                       int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags,
     84                                       int alpha_flag, void* pIccTransform, int blend_type);
     85 
     86     virtual FX_BOOL		StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color,
     87                                     const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle,
     88                                     int alpha_flag, void* pIccTransform, int blend_type);
     89     virtual FX_BOOL		ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause);
     90     virtual void		CancelDIBits(FX_LPVOID handle);
     91 
     92     virtual FX_BOOL     DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont,
     93                                        CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color,
     94                                        int alpha_flag, void* pIccTransform);
     95     virtual FX_BOOL		RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout,
     96                                          int alpha_flag, void* pIccTransform);
     97 
     98     void				SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer);
     99 
    100     virtual	FX_LPBYTE	GetBuffer() const
    101     {
    102         return m_pBitmap->GetBuffer();
    103     }
    104     virtual int			GetDriverType()
    105     {
    106         return 1;
    107     }
    108 
    109     CFX_DIBitmap*		m_pBitmap;
    110     CFX_ClipRgn*		m_pClipRgn;
    111     CFX_PtrArray		m_StateStack;
    112     void*				m_pPlatformGraphics;
    113     void*				m_pPlatformBitmap;
    114     void*				m_pDwRenderTartget;
    115     int					m_FillFlags;
    116     int					m_DitherBits;
    117     FX_BOOL				m_bRgbByteOrder;
    118     CFX_DIBitmap*       m_pOriDevice;
    119     FX_BOOL             m_bGroupKnockout;
    120 };
    121 #endif
    122