• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • platform
  • graphics
Path.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * 2006 Rob Buis <buis@kde.org>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef Path_h
28#define Path_h
29
30#include "dom/dom_string.h"
31#include "platform/graphics/FloatPoint.h"
32#include "platform/graphics/FloatRect.h"
33#include <QPainterPath>
34
35typedef QPainterPath PlatformPath;
36
37namespace WebCore {
38 class AffineTransform;
39}
40
41namespace khtml {
42 using WebCore::AffineTransform;
43 using WebCore::FloatPoint;
44 using WebCore::FloatSize;
45 using WebCore::FloatRect;
46 //class String;
47
48 enum WindRule {
49 RULE_NONZERO = 0,
50 RULE_EVENODD = 1
51 };
52
53 enum PathElementType {
54 PathElementMoveToPoint,
55 PathElementAddLineToPoint,
56 PathElementAddQuadCurveToPoint,
57 PathElementAddCurveToPoint,
58 PathElementCloseSubpath
59 };
60
61 struct PathElement {
62 PathElementType type;
63 FloatPoint* points;
64 };
65
66 typedef void (*PathApplierFunction) (void* info, const PathElement*);
67
68 class Path {
69 public:
70 Path();
71 ~Path();
72
73 Path(const Path&);
74 Path& operator=(const Path&);
75
76 bool contains(const FloatPoint&, WindRule rule = RULE_NONZERO) const;
77 FloatRect boundingRect() const;
78
79 float length();
80 FloatPoint pointAtLength(float length, bool& ok);
81 float normalAngleAtLength(float length, bool& ok);
82
83 void clear();
84 bool isEmpty() const;
85
86 void moveTo(const FloatPoint&);
87 void addLineTo(const FloatPoint&);
88 void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point);
89 void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint&);
90 void addArcTo(const FloatPoint&, const FloatPoint&, float radius);
91 void closeSubpath();
92
93 void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
94 void addRect(const FloatRect&);
95 void addEllipse(const FloatRect&);
96
97 void translate(const FloatSize&);
98
99 void setWindingRule(WindRule rule) { m_rule = rule; }
100 WindRule windingRule() const { return m_rule; }
101
102 DOM::DOMString debugString() const;
103
104 PlatformPath* platformPath() const { return m_path; }
105
106 static Path createRoundedRectangle(const FloatRect&, const FloatSize& roundingRadii);
107 static Path createRoundedRectangle(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius);
108 static Path createRectangle(const FloatRect&);
109 static Path createEllipse(const FloatPoint& center, float rx, float ry);
110 static Path createCircle(const FloatPoint& center, float r);
111 static Path createLine(const FloatPoint&, const FloatPoint&);
112
113 void apply(void* info, PathApplierFunction) const;
114 void transform(const AffineTransform&);
115
116 private:
117 PlatformPath* m_path;
118 WindRule m_rule;
119 };
120
121}
122
123#endif
FloatPoint.h
FloatRect.h
PlatformPath
QPainterPath PlatformPath
Definition: Path.h:35
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
WebCore::AffineTransform
Definition: AffineTransform.h:47
WebCore::FloatPoint
Definition: FloatPoint.h:61
WebCore::FloatRect
Definition: FloatRect.h:59
WebCore::FloatSize
Definition: FloatSize.h:48
khtml::Path
Definition: Path.h:68
khtml::Path::~Path
~Path()
Definition: PathQt.cpp:49
khtml::Path::addLineTo
void addLineTo(const FloatPoint &)
Definition: PathQt.cpp:97
khtml::Path::addArc
void addArc(const FloatPoint &, float radius, float startAngle, float endAngle, bool anticlockwise)
Definition: PathQt.cpp:125
khtml::Path::setWindingRule
void setWindingRule(WindRule rule)
Definition: Path.h:99
khtml::Path::windingRule
WindRule windingRule() const
Definition: Path.h:100
khtml::Path::createRectangle
static Path createRectangle(const FloatRect &)
Definition: Path.cpp:207
khtml::Path::addQuadCurveTo
void addQuadCurveTo(const FloatPoint &controlPoint, const FloatPoint &point)
Definition: PathQt.cpp:102
khtml::Path::debugString
DOM::DOMString debugString() const
Definition: PathQt.cpp:189
khtml::Path::createLine
static Path createLine(const FloatPoint &, const FloatPoint &)
Definition: Path.cpp:268
khtml::Path::addArcTo
void addArcTo(const FloatPoint &, const FloatPoint &, float radius)
Definition: PathQt.cpp:112
khtml::Path::length
float length()
Definition: Path.cpp:90
khtml::Path::closeSubpath
void closeSubpath()
Definition: PathQt.cpp:119
khtml::Path::normalAngleAtLength
float normalAngleAtLength(float length, bool &ok)
Definition: Path.cpp:106
khtml::Path::transform
void transform(const AffineTransform &)
Definition: PathQt.cpp:266
khtml::Path::moveTo
void moveTo(const FloatPoint &)
Definition: PathQt.cpp:92
khtml::Path::addRect
void addRect(const FloatRect &)
Definition: PathQt.cpp:169
khtml::Path::isEmpty
bool isEmpty() const
Definition: PathQt.cpp:184
khtml::Path::translate
void translate(const FloatSize &)
Definition: PathQt.cpp:80
khtml::Path::pointAtLength
FloatPoint pointAtLength(float length, bool &ok)
Definition: Path.cpp:97
khtml::Path::boundingRect
FloatRect boundingRect() const
Definition: PathQt.cpp:87
khtml::Path::createRoundedRectangle
static Path createRoundedRectangle(const FloatRect &, const FloatSize &roundingRadii)
Definition: Path.cpp:115
khtml::Path::createCircle
static Path createCircle(const FloatPoint &center, float r)
Definition: Path.cpp:263
khtml::Path::platformPath
PlatformPath * platformPath() const
Definition: Path.h:104
khtml::Path::contains
bool contains(const FloatPoint &, WindRule rule=RULE_NONZERO) const
Definition: PathQt.cpp:69
khtml::Path::addBezierCurveTo
void addBezierCurveTo(const FloatPoint &controlPoint1, const FloatPoint &controlPoint2, const FloatPoint &)
Definition: PathQt.cpp:107
khtml::Path::Path
Path()
Definition: PathQt.cpp:44
khtml::Path::addEllipse
void addEllipse(const FloatRect &)
Definition: PathQt.cpp:174
khtml::Path::operator=
Path & operator=(const Path &)
Definition: PathQt.cpp:59
khtml::Path::createEllipse
static Path createEllipse(const FloatPoint &center, float rx, float ry)
Definition: Path.cpp:226
khtml::Path::clear
void clear()
Definition: PathQt.cpp:179
dom_string.h
ok
KGuiItem ok()
WebCore
Definition: CSSHelper.h:7
khtml
khtml::PathElementType
PathElementType
Definition: Path.h:53
khtml::PathElementCloseSubpath
@ PathElementCloseSubpath
Definition: Path.h:58
khtml::PathElementAddCurveToPoint
@ PathElementAddCurveToPoint
Definition: Path.h:57
khtml::PathElementAddLineToPoint
@ PathElementAddLineToPoint
Definition: Path.h:55
khtml::PathElementAddQuadCurveToPoint
@ PathElementAddQuadCurveToPoint
Definition: Path.h:56
khtml::PathElementMoveToPoint
@ PathElementMoveToPoint
Definition: Path.h:54
khtml::PathApplierFunction
void(* PathApplierFunction)(void *info, const PathElement *)
Definition: Path.h:66
khtml::WindRule
WindRule
Definition: Path.h:48
khtml::RULE_NONZERO
@ RULE_NONZERO
Definition: Path.h:49
khtml::RULE_EVENODD
@ RULE_EVENODD
Definition: Path.h:50
rule
The CSSNamespaceRule interface represents an.
khtml::PathElement
Definition: Path.h:61
khtml::PathElement::points
FloatPoint * points
Definition: Path.h:63
khtml::PathElement::type
PathElementType type
Definition: Path.h:62
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal