Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
renderdevicedriver_iface.h
Go to the documentation of this file.
1// Copyright 2016 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// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXGE_RENDERDEVICEDRIVER_IFACE_H_
8#define CORE_FXGE_RENDERDEVICEDRIVER_IFACE_H_
9
10#include <stdint.h>
11
12#include <memory>
13
14#include "core/fxcrt/fx_coordinates.h"
15#include "core/fxcrt/retain_ptr.h"
16#include "core/fxge/dib/fx_dib.h"
17#include "third_party/base/containers/span.h"
18
19class CFX_DIBBase;
20class CFX_DIBitmap;
21class CFX_Font;
24class CFX_Matrix;
25class CFX_Path;
26class CPDF_ShadingPattern;
28class TextCharPos;
31struct FX_RECT;
32
33enum class DeviceType : bool {
36};
37
39 public:
41
42 virtual DeviceType GetDeviceType() const = 0;
43 virtual int GetDeviceCaps(int caps_id) const = 0;
44
45 virtual void SaveState() = 0;
46 virtual void RestoreState(bool bKeepSaved) = 0;
47
48 virtual void SetBaseClip(const FX_RECT& rect);
49 virtual bool SetClip_PathFill(const CFX_Path& path,
50 const CFX_Matrix* pObject2Device,
51 const CFX_FillRenderOptions& fill_options) = 0;
52 virtual bool SetClip_PathStroke(const CFX_Path& path,
53 const CFX_Matrix* pObject2Device,
54 const CFX_GraphStateData* pGraphState);
55 virtual bool DrawPath(const CFX_Path& path,
56 const CFX_Matrix* pObject2Device,
57 const CFX_GraphStateData* pGraphState,
58 uint32_t fill_color,
59 uint32_t stroke_color,
60 const CFX_FillRenderOptions& fill_options,
61 BlendMode blend_type) = 0;
62 virtual bool FillRectWithBlend(const FX_RECT& rect,
63 uint32_t fill_color,
64 BlendMode blend_type);
65 virtual bool DrawCosmeticLine(const CFX_PointF& ptMoveTo,
66 const CFX_PointF& ptLineTo,
67 uint32_t color,
68 BlendMode blend_type);
69
70 virtual bool GetClipBox(FX_RECT* pRect) = 0;
71 virtual bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
72 int left,
73 int top);
74 virtual RetainPtr<CFX_DIBitmap> GetBackDrop();
75 virtual bool SetDIBits(const RetainPtr<const CFX_DIBBase>& pBitmap,
76 uint32_t color,
77 const FX_RECT& src_rect,
78 int dest_left,
79 int dest_top,
80 BlendMode blend_type) = 0;
81 virtual bool StretchDIBits(RetainPtr<const CFX_DIBBase> bitmap,
82 uint32_t color,
83 int dest_left,
84 int dest_top,
85 int dest_width,
86 int dest_height,
87 const FX_RECT* pClipRect,
88 const FXDIB_ResampleOptions& options,
89 BlendMode blend_type) = 0;
90 virtual bool StartDIBits(RetainPtr<const CFX_DIBBase> bitmap,
91 float alpha,
92 uint32_t color,
93 const CFX_Matrix& matrix,
94 const FXDIB_ResampleOptions& options,
95 std::unique_ptr<CFX_ImageRenderer>* handle,
96 BlendMode blend_type) = 0;
97 virtual bool ContinueDIBits(CFX_ImageRenderer* handle,
98 PauseIndicatorIface* pPause);
99 virtual bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
100 CFX_Font* pFont,
101 const CFX_Matrix& mtObject2Device,
102 float font_size,
103 uint32_t color,
104 const CFX_TextRenderOptions& options);
105 virtual int GetDriverType() const;
106 virtual bool DrawShading(const CPDF_ShadingPattern* pPattern,
107 const CFX_Matrix* pMatrix,
108 const FX_RECT& clip_rect,
109 int alpha,
110 bool bAlphaMode);
111#if defined(PDF_USE_SKIA)
112 virtual bool SetBitsWithMask(RetainPtr<const CFX_DIBBase> bitmap,
114 int left,
115 int top,
116 float alpha,
118 virtual void SetGroupKnockout(bool group_knockout);
119
120 // For `CFX_SkiaDeviceDriver` only:
121 // Syncs the current rendering result from the internal buffer to the output
122 // bitmap if such internal buffer exists.
123 virtual bool SyncInternalBitmaps();
124#endif
125
126 // Multiplies the device by a constant alpha, returning `true` on success.
127 virtual bool MultiplyAlpha(float alpha) = 0;
128
129 // Multiplies the device by an alpha mask, returning `true` on success.
130 virtual bool MultiplyAlphaMask(const RetainPtr<const CFX_DIBBase>& mask) = 0;
131};
132
133#endif // CORE_FXGE_RENDERDEVICEDRIVER_IFACE_H_
BorderStyle
bool Create(int width, int height, FXDIB_Format format, RetainPtr< CFX_DIBitmap > pBackdropBitmap)
bool Attach(RetainPtr< CFX_DIBitmap > pBitmap)
~CFX_DefaultRenderDevice() override
bool AttachWithBackdropAndGroupKnockout(RetainPtr< CFX_DIBitmap > pBitmap, RetainPtr< CFX_DIBitmap > pBackdropBitmap, bool bGroupKnockout)
bool AttachWithRgbByteOrder(RetainPtr< CFX_DIBitmap > pBitmap, bool bRgbByteOrder)
StateRestorer(CFX_RenderDevice *pDevice)
void DrawBorder(const CFX_Matrix *pUser2Device, const CFX_FloatRect &rect, float fWidth, const CFX_Color &color, const CFX_Color &crLeftTop, const CFX_Color &crRightBottom, BorderStyle nStyle, int32_t nTransparency)
bool StretchBitMask(RetainPtr< CFX_DIBBase > bitmap, int left, int top, int dest_width, int dest_height, uint32_t color)
bool MultiplyAlpha(float alpha)
bool DrawTextPath(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, float font_size, const CFX_Matrix &mtText2User, const CFX_Matrix *pUser2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, CFX_Path *pClippingPath, const CFX_FillRenderOptions &fill_options)
bool SetClip_Rect(const FX_RECT &pRect)
bool SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options)
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, int left, int top, int dest_width, int dest_height)
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState)
RenderDeviceDriverIface * GetDeviceDriver() const
void SetBaseClip(const FX_RECT &rect)
bool GetDIBits(const RetainPtr< CFX_DIBitmap > &pBitmap, int left, int top)
bool FillRect(const FX_RECT &rect, uint32_t color)
bool StretchDIBitsWithFlagsAndBlend(RetainPtr< const CFX_DIBBase > bitmap, int left, int top, int dest_width, int dest_height, const FXDIB_ResampleOptions &options, BlendMode blend_mode)
bool MultiplyAlphaMask(const RetainPtr< const CFX_DIBBase > &mask)
bool ContinueDIBits(CFX_ImageRenderer *handle, PauseIndicatorIface *pPause)
void DrawFillRect(const CFX_Matrix *pUser2Device, const CFX_FloatRect &rect, const FX_COLORREF &color)
RetainPtr< const CFX_DIBitmap > GetBitmap() const
void SetDeviceDriver(std::unique_ptr< RenderDeviceDriverIface > pDriver)
bool DrawShading(const CPDF_ShadingPattern *pPattern, const CFX_Matrix *pMatrix, const FX_RECT &clip_rect, int alpha, bool bAlphaMode)
static CFX_Matrix GetFlipMatrix(float width, float height, float left, float top)
void DrawFillArea(const CFX_Matrix &mtUser2Device, const std::vector< CFX_PointF > &points, const FX_COLORREF &color)
bool StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t argb, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle)
bool StretchBitMaskWithFlags(RetainPtr< CFX_DIBBase > bitmap, int left, int top, int dest_width, int dest_height, uint32_t argb, const FXDIB_ResampleOptions &options)
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options)
RetainPtr< CFX_DIBitmap > GetBackDrop()
void SetBitmap(RetainPtr< CFX_DIBitmap > bitmap)
void DrawShadow(const CFX_Matrix &mtUser2Device, const CFX_FloatRect &rect, int32_t nTransparency, int32_t nStartGray, int32_t nEndGray)
bool SetDIBitsWithBlend(const RetainPtr< const CFX_DIBBase > &pBitmap, int left, int top, BlendMode blend_mode)
void DrawStrokeLine(const CFX_Matrix *pUser2Device, const CFX_PointF &ptMoveTo, const CFX_PointF &ptLineTo, const FX_COLORREF &color, float fWidth)
bool StartDIBitsWithBlend(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t argb, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle, BlendMode blend_mode)
int GetRenderCaps() const
bool DrawNormalText(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, float font_size, const CFX_Matrix &mtText2Device, uint32_t fill_color, const CFX_TextRenderOptions &options)
bool DrawPathWithBlend(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options, BlendMode blend_type)
void DrawStrokeRect(const CFX_Matrix &mtUser2Device, const CFX_FloatRect &rect, const FX_COLORREF &color, float fWidth)
RetainPtr< CFX_DIBitmap > GetBitmap()
int GetHeight() const
const FX_RECT & GetClipBox() const
int GetDeviceCaps(int id) const
void RestoreState(bool bKeepSaved)
bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, int left, int top)
bool CreateCompatibleBitmap(const RetainPtr< CFX_DIBitmap > &pDIB, int width, int height) const
DeviceType GetDeviceType() const
bool SetBitMask(const RetainPtr< CFX_DIBBase > &pBitmap, int left, int top, uint32_t argb)
void DrawFillRect(const CFX_Matrix *pUser2Device, const CFX_FloatRect &rect, const CFX_Color &color, int32_t nTransparency)
void VerifySavedHelloWorldDocumentWithPassword(const char *password)
void VerifySavedModifiedHelloWorldDocumentWithPassword(const char *password)
void OpenAndVerifyHelloWorldDocumentWithPassword(const char *filename, const char *password)
RetainPtr< CPDF_Object > RemoveFor(ByteStringView key)
CPDF_Parser * GetParser() const
CPDF_Dictionary * GetMutableTrailerForTesting()
FPDF_DOCUMENT OpenSavedDocumentWithPassword(const char *password)
void CloseSavedDocument()
static void CompareBitmap(FPDF_BITMAP bitmap, int expected_width, int expected_height, const char *expected_md5sum)
void UnloadPage(FPDF_PAGE page)
FPDF_DOCUMENT document() const
void CloseSavedPage(FPDF_PAGE page)
FPDF_PAGE LoadPage(int page_number)
FPDF_PAGE LoadSavedPage(int page_number)
virtual bool MultiplyAlphaMask(const RetainPtr< const CFX_DIBBase > &mask)=0
virtual bool DrawDeviceText(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color, const CFX_TextRenderOptions &options)
virtual bool GetDIBits(const RetainPtr< CFX_DIBitmap > &pBitmap, int left, int top)
virtual void SetBaseClip(const FX_RECT &rect)
virtual bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT *pClipRect, const FXDIB_ResampleOptions &options, BlendMode blend_type)=0
virtual int GetDeviceCaps(int caps_id) const =0
virtual bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, uint32_t color, const FX_RECT &src_rect, int dest_left, int dest_top, BlendMode blend_type)=0
virtual bool GetClipBox(FX_RECT *pRect)=0
virtual RetainPtr< CFX_DIBitmap > GetBackDrop()
virtual bool DrawShading(const CPDF_ShadingPattern *pPattern, const CFX_Matrix *pMatrix, const FX_RECT &clip_rect, int alpha, bool bAlphaMode)
virtual void SaveState()=0
virtual void RestoreState(bool bKeepSaved)=0
virtual bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options, BlendMode blend_type)=0
virtual bool MultiplyAlpha(float alpha)=0
virtual bool DrawCosmeticLine(const CFX_PointF &ptMoveTo, const CFX_PointF &ptLineTo, uint32_t color, BlendMode blend_type)
virtual DeviceType GetDeviceType() const =0
virtual bool FillRectWithBlend(const FX_RECT &rect, uint32_t fill_color, BlendMode blend_type)
virtual bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState)
virtual bool StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle, BlendMode blend_type)=0
virtual bool SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options)=0
virtual ~RenderDeviceDriverIface()
virtual bool ContinueDIBits(CFX_ImageRenderer *handle, PauseIndicatorIface *pPause)
TEST_F(CPDFSecurityHandlerEmbedderTest, Unencrypted)
#define FPDF_FILLMODE_ALTERNATE
Definition fpdf_edit.h:52
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, int fillmode, FPDF_BOOL stroke)
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, unsigned int R, unsigned int G, unsigned int B, unsigned int A)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x, float y, float w, float h)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page)
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_LoadCustomDocument(FPDF_FILEACCESS *pFileAccess, FPDF_BYTESTRING password)
BlendMode
Definition fx_dib.h:49
FXDIB_Format
Definition fx_dib.h:19
const char * HelloWorldChecksum()
const char * HelloWorldRemovedChecksum()