Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

fpointarray.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           fpointarray.h  -  description
00009                              -------------------
00010     begin                : Mit Jul 24 2002
00011     copyright            : (C) 2002 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #ifndef FPOINTARRAY_H
00025 #define FPOINTARRAY_H
00026 
00027 #include <QMatrix>
00028 #include <QPainterPath>
00029 #include <QPoint>
00030 #include <QPointF>
00031 #include <QVector>
00032 
00033 #include "fpoint.h"
00034 #include "scribusapi.h"
00035 
00040 struct SVGState;
00041 
00042 class SCRIBUS_API FPointArray : private QVector<FPoint>
00043 {
00044 public: 
00045     FPointArray() : count(0), capacity(0), svgState(NULL) {};
00046     FPointArray(int size) : QVector<FPoint>(size), count(size), capacity(size), svgState(NULL) {};
00047     FPointArray(const FPointArray &a) : QVector<FPoint>(a), count(a.count), capacity(a.capacity), svgState(NULL) {};
00048     uint size() const { return count; };
00049     bool resize(uint newCount);
00050     void setPoint(uint i, double x, double y) { Iterator p = begin(); p+=i; p->xp = x; p->yp = y; };
00051     void setPoint(uint i, FPoint p) {   setPoint(i, p.xp, p.yp); };
00052     bool setPoints( int nPoints, double firstx, double firsty, ... );
00053     bool putPoints( int index, int nPoints, double firstx, double firsty,  ... );
00054     bool putPoints( int index, int nPoints, const FPointArray & from, int fromIndex = 0 );
00055     void point(uint i, double *x, double *y) const;
00056     const FPoint & point(uint i)  const{ ConstIterator p = begin(); p+=i; return *p; };
00057     QPoint pointQ(uint i) const;
00058     QPointF pointQF(uint i) const;
00059     void translate( double dx, double dy );
00060     void scale( double sx, double sy );
00061     FPoint WidthHeight() const;
00062     void map(QMatrix m);
00063     FPointArray &operator=( const FPointArray &a );
00064     FPointArray copy() const;
00065     void setMarker();
00066     void addPoint(double x, double y);
00067     void addPoint(FPoint p);
00068     bool hasLastQuadPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) const;
00069     void addQuadPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4);
00070     void addQuadPoint(FPoint p1, FPoint p2, FPoint p3, FPoint p4);
00071     double lenPathSeg(int seg) const;
00072     double lenPathDist(int seg, double t1, double t2) const;
00073     void pointTangentNormalAt( int seg, double t, FPoint* p, FPoint* tn, FPoint* n ) const;
00074     void pointDerivativesAt( int seg, double t, FPoint* p, FPoint* d1, FPoint* d2 ) const;
00075     bool operator==(const FPointArray &rhs) const;
00076     bool operator!=(const FPointArray &rhs) const;
00077     ~FPointArray();
00078     void svgInit();
00079     void svgMoveTo(double x, double y);
00080     void svgLineTo(double x, double y);
00081     //void svgCurveTo(double x1, double y1, double x2, double y2);
00082     void svgCurveToCubic(double x1, double y1, double x2, double y2, double x3, double y3);
00083     void svgArcTo(double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, double x1, double y1);
00084     void svgClosePath();
00085     void calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag);
00086     bool parseSVG(const QString& svgPath);
00087     QString svgPath() const;
00088     QPainterPath toQPainterPath(bool closed);
00089     void fromQPainterPath(QPainterPath &path);
00090 private:
00091     uint count;
00092     uint capacity;
00093     SVGState * svgState;
00094 };
00095 
00096 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.