1 // Copyright 2020 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CORE_FXGE_WIN32_CTEXT_ONLY_PRINTER_DRIVER_H_ 6 #define CORE_FXGE_WIN32_CTEXT_ONLY_PRINTER_DRIVER_H_ 7 8 #include <windows.h> 9 10 #include <memory> 11 12 #include "core/fxge/cfx_windowsrenderdevice.h" 13 14 class CTextOnlyPrinterDriver final : public RenderDeviceDriverIface { 15 public: 16 explicit CTextOnlyPrinterDriver(HDC hDC); 17 ~CTextOnlyPrinterDriver() override; 18 19 private: 20 // RenderDeviceDriverIface: 21 DeviceType GetDeviceType() const override; 22 int GetDeviceCaps(int caps_id) const override; 23 void SaveState() override; 24 void RestoreState(bool bKeepSaved) override; 25 bool SetClip_PathFill(const CFX_Path& path, 26 const CFX_Matrix* pObject2Device, 27 const CFX_FillRenderOptions& fill_options) override; 28 bool SetClip_PathStroke(const CFX_Path& path, 29 const CFX_Matrix* pObject2Device, 30 const CFX_GraphStateData* pGraphState) override; 31 bool DrawPath(const CFX_Path& path, 32 const CFX_Matrix* pObject2Device, 33 const CFX_GraphStateData* pGraphState, 34 uint32_t fill_color, 35 uint32_t stroke_color, 36 const CFX_FillRenderOptions& fill_options, 37 BlendMode blend_type) override; 38 bool GetClipBox(FX_RECT* pRect) override; 39 bool SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, 40 uint32_t color, 41 const FX_RECT& src_rect, 42 int left, 43 int top, 44 BlendMode blend_type) override; 45 bool StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, 46 uint32_t color, 47 int dest_left, 48 int dest_top, 49 int dest_width, 50 int dest_height, 51 const FX_RECT* pClipRect, 52 const FXDIB_ResampleOptions& options, 53 BlendMode blend_type) override; 54 bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, 55 int bitmap_alpha, 56 uint32_t color, 57 const CFX_Matrix& matrix, 58 const FXDIB_ResampleOptions& options, 59 std::unique_ptr<CFX_ImageRenderer>* handle, 60 BlendMode blend_type) override; 61 bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos, 62 CFX_Font* pFont, 63 const CFX_Matrix& mtObject2Device, 64 float font_size, 65 uint32_t color, 66 const CFX_TextRenderOptions& options) override; 67 bool MultiplyAlpha(float alpha) override; 68 bool MultiplyAlpha(const RetainPtr<CFX_DIBBase>& mask) override; 69 70 HDC m_hDC; 71 const int m_Width; 72 const int m_Height; 73 int m_nBitsPerPixel; 74 const int m_HorzSize; 75 const int m_VertSize; 76 float m_OriginY; 77 bool m_SetOrigin; 78 }; 79 80 #endif // CORE_FXGE_WIN32_CTEXT_ONLY_PRINTER_DRIVER_H_ 81