src/gui/painting/qbezier_p.h
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    57 #include "QtCore/qline.h"
    57 #include "QtCore/qline.h"
    58 #include "QtCore/qrect.h"
    58 #include "QtCore/qrect.h"
    59 #include "QtCore/qvector.h"
    59 #include "QtCore/qvector.h"
    60 #include "QtCore/qlist.h"
    60 #include "QtCore/qlist.h"
    61 #include "QtCore/qpair.h"
    61 #include "QtCore/qpair.h"
       
    62 #include "QtGui/qtransform.h"
    62 
    63 
    63 QT_BEGIN_NAMESPACE
    64 QT_BEGIN_NAMESPACE
    64 
    65 
    65 class QPolygonF;
    66 class QPolygonF;
    66 
    67 
    76     inline QPointF normalVector(qreal t) const;
    77     inline QPointF normalVector(qreal t) const;
    77 
    78 
    78     inline QPointF derivedAt(qreal t) const;
    79     inline QPointF derivedAt(qreal t) const;
    79     inline QPointF secondDerivedAt(qreal t) const;
    80     inline QPointF secondDerivedAt(qreal t) const;
    80 
    81 
    81     QPolygonF toPolygon() const;
    82     QPolygonF toPolygon(qreal bezier_flattening_threshold = 0.5) const;
    82     void addToPolygon(QPolygonF *p) const;
    83     void addToPolygon(QPolygonF *p, qreal bezier_flattening_threshold = 0.5) const;
    83     void addToPolygonIterative(QPolygonF *p) const;
    84 
    84     void addToPolygonMixed(QPolygonF *p) const;
       
    85     QRectF bounds() const;
    85     QRectF bounds() const;
    86     qreal length(qreal error = 0.01) const;
    86     qreal length(qreal error = 0.01) const;
    87     void addIfClose(qreal *length, qreal error) const;
    87     void addIfClose(qreal *length, qreal error) const;
    88 
    88 
    89     qreal tAtLength(qreal len) const;
    89     qreal tAtLength(qreal len) const;
    94     QPointF pt1() const { return QPointF(x1, y1); }
    94     QPointF pt1() const { return QPointF(x1, y1); }
    95     QPointF pt2() const { return QPointF(x2, y2); }
    95     QPointF pt2() const { return QPointF(x2, y2); }
    96     QPointF pt3() const { return QPointF(x3, y3); }
    96     QPointF pt3() const { return QPointF(x3, y3); }
    97     QPointF pt4() const { return QPointF(x4, y4); }
    97     QPointF pt4() const { return QPointF(x4, y4); }
    98 
    98 
       
    99     QBezier mapBy(const QTransform &transform) const;
       
   100 
    99     inline QPointF midPoint() const;
   101     inline QPointF midPoint() const;
   100     inline QLineF midTangent() const;
   102     inline QLineF midTangent() const;
   101 
   103 
   102     inline QLineF startTangent() const;
   104     inline QLineF startTangent() const;
   103     inline QLineF endTangent() const;
   105     inline QLineF endTangent() const;
   104 
   106 
   105     inline void parameterSplitLeft(qreal t, QBezier *left);
   107     inline void parameterSplitLeft(qreal t, QBezier *left);
   106     inline void split(QBezier *firstHalf, QBezier *secondHalf) const;
   108     inline void split(QBezier *firstHalf, QBezier *secondHalf) const;
       
   109 
   107     int shifted(QBezier *curveSegments, int maxSegmets,
   110     int shifted(QBezier *curveSegments, int maxSegmets,
   108                 qreal offset, float threshold) const;
   111                 qreal offset, float threshold) const;
   109 
   112 
   110     QVector< QList<QBezier> > splitAtIntersections(QBezier &a);
       
   111 
       
   112     QBezier bezierOnInterval(qreal t0, qreal t1) const;
   113     QBezier bezierOnInterval(qreal t0, qreal t1) const;
   113 
   114     QBezier getSubRange(qreal t0, qreal t1) const;
   114     static QVector< QPair<qreal, qreal> > findIntersections(const QBezier &a,
       
   115                                                      const QBezier &b);
       
   116 
       
   117     static bool findIntersections(const QBezier &a, const QBezier &b,
       
   118                                   QVector<QPair<qreal, qreal> > *t);
       
   119 
   115 
   120     qreal x1, y1, x2, y2, x3, y3, x4, y4;
   116     qreal x1, y1, x2, y2, x3, y3, x4, y4;
   121 };
   117 };
   122 
   118 
   123 inline QPointF QBezier::midPoint() const
   119 inline QPointF QBezier::midPoint() const