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
cfgas_gegraphics.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 XFA_FGAS_GRAPHICS_CFGAS_GEGRAPHICS_H_
8#define XFA_FGAS_GRAPHICS_CFGAS_GEGRAPHICS_H_
9
10#include <memory>
11#include <vector>
12
13#include "core/fxcrt/fx_coordinates.h"
14#include "core/fxcrt/fx_memory.h"
15#include "core/fxcrt/retain_ptr.h"
16#include "core/fxcrt/unowned_ptr.h"
17#include "core/fxge/cfx_fillrenderoptions.h"
18#include "core/fxge/cfx_graphstatedata.h"
19#include "third_party/base/containers/span.h"
20#include "xfa/fgas/graphics/cfgas_gecolor.h"
21
22class CFGAS_GEPath;
23class CFX_DIBBase;
25
27 public:
29 public:
30 FX_STACK_ALLOCATED();
31
32 explicit StateRestorer(CFGAS_GEGraphics* graphics);
34
35 private:
36 UnownedPtr<CFGAS_GEGraphics> const graphics_;
37 };
38
39 explicit CFGAS_GEGraphics(CFX_RenderDevice* renderDevice);
41
42 CFX_RectF GetClipRect() const;
43 const CFX_Matrix* GetMatrix() const;
45
47 void SetLineDash(float dashPhase, pdfium::span<const float> dashArray);
48 void SetSolidLineDash();
49 void SetLineWidth(float lineWidth);
50 void EnableActOnDash();
51 void SetStrokeColor(const CFGAS_GEColor& color);
52 void SetFillColor(const CFGAS_GEColor& color);
53 void SetClipRect(const CFX_RectF& rect);
54 void StrokePath(const CFGAS_GEPath& path, const CFX_Matrix& matrix);
55 void FillPath(const CFGAS_GEPath& path,
57 const CFX_Matrix& matrix);
58 void ConcatMatrix(const CFX_Matrix& matrix);
59
60 private:
61 struct TInfo {
62 TInfo();
63 explicit TInfo(const TInfo& info);
64 TInfo& operator=(const TInfo& other);
65
66 CFX_GraphStateData graphState;
67 CFX_Matrix CTM;
68 bool isActOnDash = false;
69 CFGAS_GEColor strokeColor{nullptr};
70 CFGAS_GEColor fillColor{nullptr};
71 };
72
73 void SaveGraphState();
74 void RestoreGraphState();
75
76 void RenderDeviceStrokePath(const CFGAS_GEPath& path,
77 const CFX_Matrix& matrix);
78 void RenderDeviceFillPath(const CFGAS_GEPath& path,
80 const CFX_Matrix& matrix);
81 void FillPathWithPattern(const CFGAS_GEPath& path,
82 const CFX_FillRenderOptions& fill_options,
83 const CFX_Matrix& matrix);
84 void FillPathWithShading(const CFGAS_GEPath& path,
85 const CFX_FillRenderOptions& fill_options,
86 const CFX_Matrix& matrix);
87 void SetDIBitsWithMatrix(RetainPtr<CFX_DIBBase> source,
88 const CFX_Matrix& matrix);
89
90 UnownedPtr<CFX_RenderDevice> const m_renderDevice;
91 TInfo m_info;
92 std::vector<std::unique_ptr<TInfo>> m_infoStack;
93};
94
95#endif // XFA_FGAS_GRAPHICS_CFGAS_GEGRAPHICS_H_
StateRestorer(CFGAS_GEGraphics *graphics)
void FillPath(const CFGAS_GEPath &path, CFX_FillRenderOptions::FillType fill_type, const CFX_Matrix &matrix)
void SetLineDash(float dashPhase, pdfium::span< const float > dashArray)
void SetLineWidth(float lineWidth)
CFX_RenderDevice * GetRenderDevice()
CFGAS_GEGraphics(CFX_RenderDevice *renderDevice)
void SetClipRect(const CFX_RectF &rect)
void SetStrokeColor(const CFGAS_GEColor &color)
void ConcatMatrix(const CFX_Matrix &matrix)
const CFX_Matrix * GetMatrix() const
CFX_RectF GetClipRect() const
void SetLineCap(CFX_GraphStateData::LineCap lineCap)
void SetFillColor(const CFGAS_GEColor &color)
void StrokePath(const CFGAS_GEPath &path, const CFX_Matrix &matrix)
bool Contains(const CFX_PointF &point) const
void Inflate(float x, float y)
CFX_PointF Transform(const CFX_PointF &point) const
CFX_Matrix GetInverse() const
CFX_Matrix()=default
CFX_FloatRect ToFloatRect() const
bool IntersectWith(const CFX_RectF &rt) const
CFX_RectF(const FX_RECT &that)
CPDFSDK_PageView * GetPageView() const
absl::optional< CFX_PointF > PageToDevice(const FX_RECT &rect, int rotate, const CFX_PointF &page_point) const override
CXFA_FFPageView * GetXFAPageView() const
CPDF_Document * GetDocument() const override
CFX_Matrix GetDisplayMatrix(const FX_RECT &rect, int iRotate) const override
CPDFXFA_Page * AsXFAPage() override
CPDF_Page * AsPDFPage() override
float GetPageWidth() const override
~CPDFXFA_Page() override
CPDFSDK_Annot * GetLastXFAAnnot(CPDFSDK_PageView *page_view) const
CPDFSDK_Annot * GetPrevXFAAnnot(CPDFSDK_Annot *pSDKAnnot) const
CPDFSDK_Annot * GetFirstXFAAnnot(CPDFSDK_PageView *page_view) const
CPDFSDK_Annot * GetNextXFAAnnot(CPDFSDK_Annot *pSDKAnnot) const
absl::optional< CFX_PointF > DeviceToPage(const FX_RECT &rect, int rotate, const CFX_PointF &device_point) const override
void DrawFocusAnnot(CFX_RenderDevice *pDevice, CPDFSDK_Annot *pAnnot, const CFX_Matrix &mtUser2Device, const FX_RECT &rtClip)
int HasFormFieldAtPoint(const CFX_PointF &point) const
float GetPageHeight() const override
void LoadPDFPageFromDict(RetainPtr< CPDF_Dictionary > pPageDict)
CXFA_FFWidget * GetXFAFFWidget() const
bool DoHitTest(const CFX_PointF &point) override
void ReplaceSelection(const WideString &text) override
~CPDFXFA_Widget() override
bool Redo() override
WideString GetSelectedText() override
void OnMouseEnter(Mask< FWL_EVENTFLAG > nFlags) override
bool Undo() override
bool OnSetFocus(Mask< FWL_EVENTFLAG > nFlags) override
bool SetIndexSelected(int index, bool selected) override
bool SelectAllText() override
bool OnMouseMove(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
CFX_FloatRect GetViewBBox() override
bool CanUndo() override
bool OnKillFocus(Mask< FWL_EVENTFLAG > nFlags) override
bool IsIndexSelected(int index) override
bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlags) override
bool OnRButtonUp(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
bool OnMouseWheel(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point, const CFX_Vector &delta) override
CPDF_Annot::Subtype GetAnnotSubtype() const override
bool OnRButtonDown(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
CPDFSDK_Annot::UnsafeInputHandlers * GetUnsafeInputHandlers() override
WideString GetText() override
CPDFXFA_Widget(CXFA_FFWidget *pXFAFFWidget, CPDFSDK_PageView *pPageView)
CPDFXFA_Widget * AsXFAWidget() override
void OnMouseExit(Mask< FWL_EVENTFLAG > nFlags) override
bool CanRedo() override
bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
CFX_FloatRect GetRect() const override
bool OnLButtonDblClk(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
bool OnChar(uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags) override
void OnDraw(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device, bool bDrawAnnots) override
void ReplaceAndKeepSelection(const WideString &text) override
CXFA_FFWidgetHandler * GetWidgetHandler()
CXFA_FFPageView * GetPageView(int32_t nIndex) const
CXFA_FFDocView * GetDocView() const
CFX_Matrix GetDisplayMatrix(const FX_RECT &rtDisp, int32_t iRotate) const
CXFA_FFWidget::IteratorIface * CreateGCedTraverseWidgetIterator(Mask< XFA_WidgetStatus > dwWidgetFilter)
CFX_RectF GetPageViewRect() const
CXFA_FFWidget * MoveToNext() override
void RenderWidget(CXFA_FFWidget *hWidget, CFGAS_GEGraphics *pGS, const CFX_Matrix &matrix, bool bHighlight)
virtual CXFA_FFWidget * MoveToLast()=0
virtual CXFA_FFWidget * MoveToFirst()=0
virtual CXFA_FFWidget * MoveToPrevious()=0
virtual CXFA_FFWidget * GetCurrentWidget()=0
virtual CXFA_FFWidget * MoveToNext()=0
virtual bool SetCurrentWidget(CXFA_FFWidget *hWidget)=0
const CFX_RectF & GetWidgetRect() const
virtual void RenderWidget(CFGAS_GEGraphics *pGS, const CFX_Matrix &matrix, HighlightOption highlight)
virtual FormFieldType GetFormFieldType()
virtual CFX_RectF GetBBox(FocusOption focus)
CPDFXFA_Widget * ToXFAWidget(CPDFSDK_Annot *pAnnot)
XFA_WidgetStatus
Definition fxfa.h:61
FormType
Definition fxfa.h:38
@ kXFAForeground