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
cfx_graphstate.cpp
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#include "core/fxge/cfx_graphstate.h"
8
9#include <utility>
10
12
13CFX_GraphState::CFX_GraphState(const CFX_GraphState& that) = default;
14
15CFX_GraphState::~CFX_GraphState() = default;
16
18 m_Ref.Emplace();
19}
20
21void CFX_GraphState::SetLineDash(std::vector<float> dashes,
22 float phase,
23 float scale) {
24 CFX_GraphStateData* pData = m_Ref.GetPrivateCopy();
25 pData->m_DashPhase = phase * scale;
26 for (float& val : dashes)
27 val *= scale;
28 pData->m_DashArray = std::move(dashes);
29}
30
31void CFX_GraphState::SetLineDashPhase(float phase) {
32 CFX_GraphStateData* pData = m_Ref.GetPrivateCopy();
33 pData->m_DashPhase = phase;
34}
35
37 std::vector<float> ret;
38
39 if (m_Ref.GetObject())
40 ret = m_Ref.GetObject()->m_DashArray;
41
42 return ret;
43}
44
46 return m_Ref.GetObject() ? m_Ref.GetObject()->m_DashArray.size() : 0;
47}
48
50 return m_Ref.GetObject() ? m_Ref.GetObject()->m_DashPhase : 1.0f;
51}
52
54 return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineWidth : 1.0f;
55}
56
57void CFX_GraphState::SetLineWidth(float width) {
58 m_Ref.GetPrivateCopy()->m_LineWidth = width;
59}
60
62 return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineCap
63 : CFX_GraphStateData::LineCap::kButt;
64}
66 m_Ref.GetPrivateCopy()->m_LineCap = cap;
67}
68
70 return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineJoin
71 : CFX_GraphStateData::LineJoin::kMiter;
72}
73
75 m_Ref.GetPrivateCopy()->m_LineJoin = join;
76}
77
79 return m_Ref.GetObject() ? m_Ref.GetObject()->m_MiterLimit : 10.f;
80}
81
82void CFX_GraphState::SetMiterLimit(float limit) {
83 m_Ref.GetPrivateCopy()->m_MiterLimit = limit;
84}
float GetLineDashPhase() const
void SetLineWidth(float width)
CFX_GraphState(const CFX_GraphState &that)
std::vector< float > GetLineDashArray() const
void SetMiterLimit(float limit)
void SetLineJoin(CFX_GraphStateData::LineJoin join)
float GetMiterLimit() const
void SetLineDashPhase(float phase)
void SetLineDash(std::vector< float > dashes, float phase, float scale)
float GetLineWidth() const
CFX_GraphStateData::LineCap GetLineCap() const
size_t GetLineDashSize() const
CFX_GraphStateData::LineJoin GetLineJoin() const
void SetLineCap(CFX_GraphStateData::LineCap cap)