src/svg/qsvggraphics_p.h
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    78 {
    78 {
    79 public:
    79 public:
    80     QSvgArc(QSvgNode *parent, const QPainterPath &path);
    80     QSvgArc(QSvgNode *parent, const QPainterPath &path);
    81     virtual void draw(QPainter *p, QSvgExtraStates &states);
    81     virtual void draw(QPainter *p, QSvgExtraStates &states);
    82     virtual Type type() const;
    82     virtual Type type() const;
    83     virtual QRectF bounds() const;
    83     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
    84 private:
    84 private:
    85     QPainterPath cubic;
    85     QPainterPath m_path;
    86     QRectF m_cachedBounds;
    86 };
    87 };
    87 
    88 
    88 class QSvgEllipse : public QSvgNode
    89 class QSvgCircle : public QSvgNode
    89 {
    90 {
    90 public:
    91 public:
    91     QSvgEllipse(QSvgNode *parent, const QRectF &rect);
    92     QSvgCircle(QSvgNode *parent, const QRectF &rect);
    92     virtual void draw(QPainter *p, QSvgExtraStates &states);
    93     virtual void draw(QPainter *p, QSvgExtraStates &states);
    93     virtual Type type() const;
    94     virtual Type type() const;
    94     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
    95     virtual QRectF bounds() const;
       
    96 private:
    95 private:
    97     QRectF m_bounds;
    96     QRectF m_bounds;
    98 };
    97 };
    99 
    98 
   100 class QSvgEllipse : public QSvgNode
    99 class QSvgCircle : public QSvgEllipse
   101 {
   100 {
   102 public:
   101 public:
   103     QSvgEllipse(QSvgNode *parent, const QRectF &rect);
   102     QSvgCircle(QSvgNode *parent, const QRectF &rect) : QSvgEllipse(parent, rect) { }
   104     virtual void draw(QPainter *p, QSvgExtraStates &states);
   103     virtual Type type() const;
   105     virtual Type type() const;
       
   106     virtual QRectF bounds() const;
       
   107 private:
       
   108     QRectF m_bounds;
       
   109 };
   104 };
   110 
   105 
   111 class QSvgImage : public QSvgNode
   106 class QSvgImage : public QSvgNode
   112 {
   107 {
   113 public:
   108 public:
   114     QSvgImage(QSvgNode *parent, const QImage &image,
   109     QSvgImage(QSvgNode *parent, const QImage &image,
   115               const QRect &bounds);
   110               const QRect &bounds);
   116     virtual void draw(QPainter *p, QSvgExtraStates &states);
   111     virtual void draw(QPainter *p, QSvgExtraStates &states);
   117     virtual Type type() const;
   112     virtual Type type() const;
   118     virtual QRectF bounds() const;
   113     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   119 private:
   114 private:
   120     QImage m_image;
   115     QImage m_image;
   121     QRect  m_bounds;
   116     QRect  m_bounds;
   122 };
   117 };
   123 
   118 
   125 {
   120 {
   126 public:
   121 public:
   127     QSvgLine(QSvgNode *parent, const QLineF &line);
   122     QSvgLine(QSvgNode *parent, const QLineF &line);
   128     virtual void draw(QPainter *p, QSvgExtraStates &states);
   123     virtual void draw(QPainter *p, QSvgExtraStates &states);
   129     virtual Type type() const;
   124     virtual Type type() const;
   130     virtual QRectF bounds() const;
   125     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   131 private:
   126 private:
   132     QLineF m_bounds;
   127     QLineF m_line;
   133 };
   128 };
   134 
   129 
   135 class QSvgPath : public QSvgNode
   130 class QSvgPath : public QSvgNode
   136 {
   131 {
   137 public:
   132 public:
   138     QSvgPath(QSvgNode *parent, const QPainterPath &qpath);
   133     QSvgPath(QSvgNode *parent, const QPainterPath &qpath);
   139     virtual void draw(QPainter *p, QSvgExtraStates &states);
   134     virtual void draw(QPainter *p, QSvgExtraStates &states);
   140     virtual Type type() const;
   135     virtual Type type() const;
   141     virtual QRectF bounds() const;
   136     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   142 
   137 
   143     QPainterPath *qpath() {
   138     QPainterPath *qpath() {
   144         return &m_path;
   139         return &m_path;
   145     }
   140     }
   146 private:
   141 private:
   147     QPainterPath m_path;
   142     QPainterPath m_path;
   148     mutable QRectF m_cachedBounds;
       
   149 };
   143 };
   150 
   144 
   151 class QSvgPolygon : public QSvgNode
   145 class QSvgPolygon : public QSvgNode
   152 {
   146 {
   153 public:
   147 public:
   154     QSvgPolygon(QSvgNode *parent, const QPolygonF &poly);
   148     QSvgPolygon(QSvgNode *parent, const QPolygonF &poly);
   155     virtual void draw(QPainter *p, QSvgExtraStates &states);
   149     virtual void draw(QPainter *p, QSvgExtraStates &states);
   156     virtual Type type() const;
   150     virtual Type type() const;
   157     virtual QRectF bounds() const;
   151     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   158 private:
   152 private:
   159     QPolygonF m_poly;
   153     QPolygonF m_poly;
   160 };
   154 };
   161 
   155 
   162 class QSvgPolyline : public QSvgNode
   156 class QSvgPolyline : public QSvgNode
   163 {
   157 {
   164 public:
   158 public:
   165     QSvgPolyline(QSvgNode *parent, const QPolygonF &poly);
   159     QSvgPolyline(QSvgNode *parent, const QPolygonF &poly);
   166     virtual void draw(QPainter *p, QSvgExtraStates &states);
   160     virtual void draw(QPainter *p, QSvgExtraStates &states);
   167     virtual Type type() const;
   161     virtual Type type() const;
   168     virtual QRectF bounds() const;
   162     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   169 private:
   163 private:
   170     QPolygonF m_poly;
   164     QPolygonF m_poly;
   171 };
   165 };
   172 
   166 
   173 class QSvgRect : public QSvgNode
   167 class QSvgRect : public QSvgNode
   174 {
   168 {
   175 public:
   169 public:
   176     QSvgRect(QSvgNode *paren, const QRectF &rect, int rx=0, int ry=0);
   170     QSvgRect(QSvgNode *paren, const QRectF &rect, int rx=0, int ry=0);
   177     virtual Type type() const;
   171     virtual Type type() const;
   178     virtual void draw(QPainter *p, QSvgExtraStates &states);
   172     virtual void draw(QPainter *p, QSvgExtraStates &states);
   179     virtual QRectF bounds() const;
   173     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   180 private:
   174 private:
   181     QRectF m_rect;
   175     QRectF m_rect;
   182     int m_rx, m_ry;
   176     int m_rx, m_ry;
   183 };
   177 };
   184 
   178 
   203     void addTspan(QSvgTspan *tspan) {m_tspans.append(tspan);}
   197     void addTspan(QSvgTspan *tspan) {m_tspans.append(tspan);}
   204     void addText(const QString &text);
   198     void addText(const QString &text);
   205     void addLineBreak() {m_tspans.append(LINEBREAK);}
   199     void addLineBreak() {m_tspans.append(LINEBREAK);}
   206     void setWhitespaceMode(WhitespaceMode mode) {m_mode = mode;}
   200     void setWhitespaceMode(WhitespaceMode mode) {m_mode = mode;}
   207 
   201 
   208     //virtual QRectF bounds() const;
   202     //virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   209 private:
   203 private:
   210     static QSvgTspan * const LINEBREAK;
   204     static QSvgTspan * const LINEBREAK;
   211 
   205 
   212     QPointF m_coord;
   206     QPointF m_coord;
   213 
   207 
   246 {
   240 {
   247 public:
   241 public:
   248     QSvgUse(const QPointF &start, QSvgNode *parent, QSvgNode *link);
   242     QSvgUse(const QPointF &start, QSvgNode *parent, QSvgNode *link);
   249     virtual void draw(QPainter *p, QSvgExtraStates &states);
   243     virtual void draw(QPainter *p, QSvgExtraStates &states);
   250     virtual Type type() const;
   244     virtual Type type() const;
   251     virtual QRectF bounds() const;
   245     virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
   252     virtual QRectF transformedBounds(const QTransform &transform) const;
       
   253 
   246 
   254 private:
   247 private:
   255     QSvgNode *m_link;
   248     QSvgNode *m_link;
   256     QPointF   m_start;
   249     QPointF   m_start;
   257     mutable QRectF    m_bounds;
       
   258 };
   250 };
   259 
   251 
   260 class QSvgVideo : public QSvgNode
   252 class QSvgVideo : public QSvgNode
   261 {
   253 {
   262 public:
   254 public: