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_pathobject.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/fpdfapi/page/cpdf_pathobject.h"
8
9CPDF_PathObject::CPDF_PathObject(int32_t content_stream)
10 : CPDF_PageObject(content_stream) {}
11
12CPDF_PathObject::CPDF_PathObject() : CPDF_PathObject(kNoContentStream) {}
13
14CPDF_PathObject::~CPDF_PathObject() = default;
15
16CPDF_PageObject::Type CPDF_PathObject::GetType() const {
17 return Type::kPath;
18}
19
20void CPDF_PathObject::Transform(const CFX_Matrix& matrix) {
21 m_Matrix.Concat(matrix);
23 SetDirty(true);
24}
25
26bool CPDF_PathObject::IsPath() const {
27 return true;
28}
29
30CPDF_PathObject* CPDF_PathObject::AsPath() {
31 return this;
32}
33
34const CPDF_PathObject* CPDF_PathObject::AsPath() const {
35 return this;
36}
37
38void CPDF_PathObject::CalcBoundingBox() {
39 if (!m_Path.HasRef())
40 return;
41 CFX_FloatRect rect;
42 float width = graph_state().GetLineWidth();
43 if (m_bStroke && width != 0) {
44 rect = m_Path.GetBoundingBoxForStrokePath(width,
45 graph_state().GetMiterLimit());
46 } else {
47 rect = m_Path.GetBoundingBox();
48 }
49 rect = m_Matrix.TransformRect(rect);
50
51 if (width == 0 && m_bStroke)
52 rect.Inflate(0.5f, 0.5f);
53 SetRect(rect);
54}
55
56void CPDF_PathObject::SetPathMatrix(const CFX_Matrix& matrix) {
57 m_Matrix = matrix;
59}
void Inflate(float x, float y)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
void Concat(const CFX_Matrix &right)
void SetRect(const CFX_FloatRect &rect)
void SetDirty(bool value)
CPDF_PageObject(int32_t content_stream)
static constexpr int32_t kNoContentStream
const CFX_GraphState & graph_state() const
bool IsPath() const override
~CPDF_PathObject() override
CPDF_PathObject * AsPath() override
void SetPathMatrix(const CFX_Matrix &matrix)
void Transform(const CFX_Matrix &matrix) override
const CPDF_PathObject * AsPath() const override
Type GetType() const override
CPDF_PathObject(int32_t content_stream)