42 #ifndef QPAINTERPATH_H
43 #define QPAINTERPATH_H
60 struct QPainterPathPrivateDeleter;
61 class QPainterPathData;
62 class QPainterPathStrokerPrivate;
83 bool isMoveTo()
const {
return type == MoveToElement; }
84 bool isLineTo()
const {
return type == LineToElement; }
85 bool isCurveTo()
const {
return type == CurveToElement; }
95 explicit QPainterPath(
const QPointF &startPoint);
96 QPainterPath(
const QPainterPath &other);
97 QPainterPath &operator=(
const QPainterPath &other);
98 #ifdef Q_COMPILER_RVALUE_REFS
99 inline QPainterPath &operator=(QPainterPath &&other)
100 {
qSwap(d_ptr, other.d_ptr);
return *
this; }
103 inline void swap(QPainterPath &other) { d_ptr.swap(other.d_ptr); }
108 inline void moveTo(qreal
x, qreal
y);
111 inline void lineTo(qreal
x, qreal
y);
113 void arcMoveTo(
const QRectF &rect, qreal angle);
114 inline void arcMoveTo(qreal
x, qreal
y, qreal
w, qreal
h, qreal angle);
116 void arcTo(
const QRectF &rect, qreal startAngle, qreal arcLength);
117 inline void arcTo(qreal
x, qreal
y, qreal
w, qreal
h, qreal startAngle, qreal arcLength);
120 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
121 qreal endPtx, qreal endPty);
123 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
125 QPointF currentPosition()
const;
127 void addRect(
const QRectF &rect);
128 inline void addRect(qreal
x, qreal
y, qreal
w, qreal
h);
129 void addEllipse(
const QRectF &rect);
130 inline void addEllipse(qreal
x, qreal
y, qreal
w, qreal
h);
131 inline void addEllipse(
const QPointF &
center, qreal rx, qreal ry);
132 void addPolygon(
const QPolygonF &polygon);
133 void addText(
const QPointF &point,
const QFont &
f,
const QString &text);
134 inline void addText(qreal
x, qreal
y,
const QFont &
f,
const QString &text);
135 void addPath(
const QPainterPath &path);
136 void addRegion(
const QRegion ®ion);
138 void addRoundedRect(
const QRectF &rect, qreal xRadius, qreal yRadius,
140 inline void addRoundedRect(qreal
x, qreal
y, qreal
w, qreal
h,
141 qreal xRadius, qreal yRadius,
144 void addRoundRect(
const QRectF &rect,
int xRnd,
int yRnd);
145 inline void addRoundRect(qreal
x, qreal
y, qreal
w, qreal
h,
147 inline void addRoundRect(
const QRectF &rect,
int roundness);
148 inline void addRoundRect(qreal
x, qreal
y, qreal
w, qreal
h,
151 void connectPath(
const QPainterPath &path);
153 bool contains(
const QPointF &pt)
const;
154 bool contains(
const QRectF &rect)
const;
155 bool intersects(
const QRectF &rect)
const;
157 void translate(qreal
dx, qreal
dy);
160 QPainterPath translated(qreal
dx, qreal
dy)
const;
163 QRectF boundingRect()
const;
164 QRectF controlPointRect()
const;
169 inline bool isEmpty()
const;
171 QPainterPath toReversed()
const;
179 inline int elementCount()
const;
181 inline void setElementPositionAt(
int i, qreal
x, qreal
y);
184 qreal percentAtLength(qreal
t)
const;
185 QPointF pointAtPercent(qreal
t)
const;
186 qreal angleAtPercent(qreal
t)
const;
187 qreal slopeAtPercent(qreal
t)
const;
189 bool intersects(
const QPainterPath &
p)
const;
190 bool contains(
const QPainterPath &
p)
const;
191 QPainterPath united(
const QPainterPath &
r)
const;
192 QPainterPath intersected(
const QPainterPath &
r)
const;
193 QPainterPath subtracted(
const QPainterPath &
r)
const;
194 QPainterPath subtractedInverted(
const QPainterPath &
r)
const;
196 QPainterPath simplified()
const;
198 bool operator==(
const QPainterPath &other)
const;
199 bool operator!=(
const QPainterPath &other)
const;
201 QPainterPath
operator&(
const QPainterPath &other)
const;
202 QPainterPath
operator|(
const QPainterPath &other)
const;
203 QPainterPath
operator+(
const QPainterPath &other)
const;
204 QPainterPath
operator-(
const QPainterPath &other)
const;
205 QPainterPath &operator&=(
const QPainterPath &other);
206 QPainterPath &operator|=(
const QPainterPath &other);
207 QPainterPath &
operator+=(
const QPainterPath &other);
208 QPainterPath &operator-=(
const QPainterPath &other);
213 inline void ensureData() {
if (!d_ptr) ensureData_helper(); }
214 void ensureData_helper();
215 inline void detach();
216 void detach_helper();
218 void computeBoundingRect()
const;
219 void computeControlPointRect()
const;
221 QPainterPathData *d_func()
const {
return reinterpret_cast<QPainterPathData *
>(d_ptr.
data()); }
223 friend class QPainterPathData;
225 friend class QPainterPathStrokerPrivate;
228 friend class QVectorPath;
229 friend Q_GUI_EXPORT
const QVectorPath &qtVectorPathForPath(
const QPainterPath &);
231 #ifndef QT_NO_DATASTREAM
237 class QPainterPathPrivate
240 friend class QPainterPath;
241 friend class QPainterPathData;
243 friend class QPainterPathStrokerPrivate;
246 friend class QVectorPath;
247 friend struct QPainterPathPrivateDeleter;
248 #ifndef QT_NO_DATASTREAM
259 #ifndef QT_NO_DATASTREAM
271 void setWidth(qreal
width);
280 void setMiterLimit(qreal
length);
281 qreal miterLimit()
const;
283 void setCurveThreshold(qreal threshold);
284 qreal curveThreshold()
const;
290 void setDashOffset(qreal
offset);
291 qreal dashOffset()
const;
293 QPainterPath createStroke(
const QPainterPath &path)
const;
298 friend class QX11PaintEngine;
315 arcTo(
QRectF(x, y, w, h), startAngle, arcLength);
320 arcMoveTo(
QRectF(x, y, w, h), angle);
324 qreal endPtx, qreal endPty)
337 addEllipse(
QRectF(x, y, w, h));
342 addEllipse(
QRectF(center.
x() - rx, center.
y() - ry, 2 * rx, 2 * ry));
347 addRect(
QRectF(x, y, w, h));
351 qreal xRadius, qreal yRadius,
354 addRoundedRect(
QRectF(x, y, w, h), xRadius, yRadius, mode);
360 addRoundRect(
QRectF(x, y, w, h), xRnd, yRnd);
366 int xRnd = roundness;
367 int yRnd = roundness;
369 xRnd =
int(roundness * rect.
height()/rect.
width());
372 addRoundRect(rect, xRnd, yRnd);
378 addRoundRect(
QRectF(x, y, w, h), roundness);
383 addText(
QPointF(x, y), f, text);
387 { translate(offset.
x(), offset.
y()); }
390 {
return translated(offset.
x(), offset.
y()); }
394 return !d_ptr || (d_ptr->elements.
size() == 1 && d_ptr->elements.
first().
type == MoveToElement);
399 return d_ptr ? d_ptr->elements.
size() : 0;
405 Q_ASSERT(i >= 0 && i < elementCount());
406 return d_ptr->elements.
at(i);
412 Q_ASSERT(i >= 0 && i < elementCount());
420 inline void QPainterPath::detach()
427 #ifndef QT_NO_DEBUG_STREAM
435 #endif // QPAINTERPATH_H
void translate(qreal dx, qreal dy)
const T & at(int i) const
GLdouble GLdouble GLdouble r
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
void lineTo(const QPointF &p)
void quadTo(const QPointF &ctrlPt, const QPointF &endPt)
bool operator==(const Element &e) const
QByteArray & operator+=(QByteArray &a, const QStringBuilder< A, B > &b)
void addText(const QPointF &point, const QFont &f, const QString &text)
void swap(QPainterPath &other)
void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt)
friend Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QPainterPath &)
void addRoundRect(const QRectF &rect, int xRnd, int yRnd)
bool operator!=(const Element &e) const
void setElementPositionAt(int i, qreal x, qreal y)
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
Q_CORE_EXPORT QBitArray operator&(const QBitArray &, const QBitArray &)
QPainterPath translated(qreal dx, qreal dy) const
#define QT_BEGIN_NAMESPACE
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
Q_DECLARE_TYPEINFO(QPainterPath::Element, Q_PRIMITIVE_TYPE)
friend Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QPainterPath &)
void addEllipse(const QRectF &rect)
const QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
GLuint GLsizei GLsizei * length
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
bool operator!=(const QByteArray &a1, const QByteArray &a2)
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QPainterPath &)
void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength)
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QPainterPath &)
int int int int int int h
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
void addRect(const QRectF &rect)
const QPainterPath::Element & elementAt(int i) const
const QPoint operator-(const QPoint &p1, const QPoint &p2)
void arcMoveTo(const QRectF &rect, qreal angle)
Q_CORE_EXPORT QBitArray operator|(const QBitArray &, const QBitArray &)
GLubyte GLubyte GLubyte GLubyte w
void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)