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
cpdf_imagerenderer.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_FPDFAPI_RENDER_CPDF_IMAGERENDERER_H_
8#define CORE_FPDFAPI_RENDER_CPDF_IMAGERENDERER_H_
9
10#include <memory>
11
12#include "core/fxcrt/fx_coordinates.h"
13#include "core/fxcrt/retain_ptr.h"
14#include "core/fxcrt/unowned_ptr.h"
15#include "core/fxge/dib/cfx_imagerenderer.h"
16#include "core/fxge/dib/fx_dib.h"
17#include "third_party/abseil-cpp/absl/types/optional.h"
18
19class CFX_DIBBase;
20class CFX_DefaultRenderDevice;
23class CPDF_ImageObject;
24class CPDF_Pattern;
27
29 public:
30 explicit CPDF_ImageRenderer(CPDF_RenderStatus* pStatus);
32
33 bool Start(CPDF_ImageObject* pImageObject,
34 const CFX_Matrix& mtObj2Device,
35 bool bStdCS,
36 BlendMode blendType);
37
38 bool Start(RetainPtr<CFX_DIBBase> pDIBBase,
39 FX_ARGB bitmap_argb,
40 const CFX_Matrix& mtImage2Device,
41 const FXDIB_ResampleOptions& options,
42 bool bStdCS);
43
44 bool Continue(PauseIndicatorIface* pPause);
45 bool GetResult() const { return m_Result; }
46
47 private:
48 enum class Mode {
49 kNone = 0,
50 kDefault,
51 kBlend,
52 kTransform,
53 };
54
55 bool StartBitmapAlpha();
56 bool StartDIBBase();
57 bool StartRenderDIBBase();
58 bool StartLoadDIBBase();
59 bool ContinueDefault(PauseIndicatorIface* pPause);
60 bool ContinueBlend(PauseIndicatorIface* pPause);
61 bool ContinueTransform(PauseIndicatorIface* pPause);
62 bool DrawMaskedImage();
63 bool DrawPatternImage();
64 bool NotDrawing() const;
65 FX_RECT GetDrawRect() const;
66 CFX_Matrix GetDrawMatrix(const FX_RECT& rect) const;
67 void CalculateDrawImage(CFX_DefaultRenderDevice* pBitmapDevice1,
68 CFX_DefaultRenderDevice* pBitmapDevice2,
69 RetainPtr<CFX_DIBBase> pDIBBase,
70 const CFX_Matrix& mtNewMatrix,
71 const FX_RECT& rect) const;
72 const CPDF_RenderOptions& GetRenderOptions() const;
73 void HandleFilters();
74 absl::optional<FX_RECT> GetUnitRect() const;
75 bool GetDimensionsFromUnitRect(const FX_RECT& rect,
76 int* left,
77 int* top,
78 int* width,
79 int* height) const;
80
81 UnownedPtr<CPDF_RenderStatus> const m_pRenderStatus;
82 UnownedPtr<CPDF_ImageObject> m_pImageObject;
83 RetainPtr<CPDF_Pattern> m_pPattern;
84 RetainPtr<CFX_DIBBase> m_pDIBBase;
85 CFX_Matrix m_mtObj2Device;
86 CFX_Matrix m_ImageMatrix;
87 std::unique_ptr<CPDF_ImageLoader> const m_pLoader;
88 std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
89 std::unique_ptr<CFX_ImageRenderer> m_DeviceHandle;
90 Mode m_Mode = Mode::kNone;
91 float m_Alpha = 0.0f;
92 BlendMode m_BlendType = BlendMode::kNormal;
93 FX_ARGB m_FillArgb = 0;
94 FXDIB_ResampleOptions m_ResampleOptions;
95 bool m_bPatternColor = false;
96 bool m_bStdCS = false;
97 bool m_Result = true;
98};
99
100#endif // CORE_FPDFAPI_RENDER_CPDF_IMAGERENDERER_H_
bool Create(int width, int height, FXDIB_Format format, RetainPtr< CFX_DIBitmap > pBackdropBitmap)
FX_RECT GetOuterRect() const
CFX_Matrix & operator=(const CFX_Matrix &other)=default
void Translate(int32_t x, int32_t y)
CFX_FloatRect GetUnitRect() const
void Translate(float x, float y)
void Transform(const CFX_Matrix &matrix)
Definition cfx_path.cpp:392
void AppendRect(float left, float bottom, float right, float top)
Definition cfx_path.cpp:309
bool IsPattern() const
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)
float GetStrokeAlpha() const
BlendMode GetBlendType() const
CPDF_ImageRenderer(CPDF_RenderStatus *pStatus)
bool Start(RetainPtr< CFX_DIBBase > pDIBBase, FX_ARGB bitmap_argb, const CFX_Matrix &mtImage2Device, const FXDIB_ResampleOptions &options, bool bStdCS)
bool Continue(PauseIndicatorIface *pPause)
bool Start(CPDF_ImageObject *pImageObject, const CFX_Matrix &mtObj2Device, bool bStdCS, BlendMode blendType)
CPDF_Document * GetDocument() const override
Definition cpdf_page.cpp:51
const Options & GetOptions() const
bool CheckOCGDictVisible(const CPDF_Dictionary *pOC) const
bool ColorModeIs(Type mode) const
void SetOptions(const CPDF_RenderOptions &options)
void SetStdCS(bool bStdCS)
void Initialize(const CPDF_RenderStatus *pParentStatus, const CPDF_GraphicStates *pInitialStates)
#define FXARGB_MUL_ALPHA(argb, alpha)
Definition fx_dib.h:128
BlendMode
Definition fx_dib.h:49
#define FXARGB_B(argb)
Definition fx_dib.h:127
#define FXARGB_G(argb)
Definition fx_dib.h:126
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
#define FXARGB_R(argb)
Definition fx_dib.h:125
FXDIB_Format
Definition fx_dib.h:19
int FXSYS_roundf(float f)
Definition fx_system.cpp:92
#define FXRC_BLEND_MODE
bool bInterpolateBilinear
Definition fx_dib.h:41
int Height() const
int32_t bottom
int32_t right
int Width() const
int32_t top
int32_t left
bool IsEmpty() const