Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/splash/SplashPath.h
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2004-05-17 18:12:38 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2004-05-17 18:12:38 (GMT)
commitbace4ea18c03bfcaadab55300bc15290f87540c7 (patch)
tree48c9c670e4dde608d50fe68e00e783f18af8697b /pdf/splash/SplashPath.h
parentad63666daeeda50acc7630132d61fe044634fddd (diff)
Initial revision
Diffstat (limited to 'pdf/splash/SplashPath.h')
-rw-r--r--pdf/splash/SplashPath.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/pdf/splash/SplashPath.h b/pdf/splash/SplashPath.h
new file mode 100644
index 0000000..8aa1a8b
--- /dev/null
+++ b/pdf/splash/SplashPath.h
@@ -0,0 +1,107 @@
+//========================================================================
+//
+// SplashPath.h
+//
+//========================================================================
+
+#ifndef SPLASHPATH_H
+#define SPLASHPATH_H
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "SplashTypes.h"
+
+//------------------------------------------------------------------------
+// SplashPathPoint
+//------------------------------------------------------------------------
+
+struct SplashPathPoint {
+ SplashCoord x, y;
+};
+
+//------------------------------------------------------------------------
+// SplashPath.flags
+//------------------------------------------------------------------------
+
+// first point on each subpath sets this flag
+#define splashPathFirst 0x01
+
+// last point on each subpath sets this flag
+#define splashPathLast 0x02
+
+// if the subpath is closed, its first and last points must be
+// identical, and must set this flag
+#define splashPathClosed 0x04
+
+// curve control points set this flag
+#define splashPathCurve 0x08
+
+// clockwise arc center points set this flag
+#define splashPathArcCW 0x10
+
+//------------------------------------------------------------------------
+// SplashPath
+//------------------------------------------------------------------------
+
+class SplashPath {
+public:
+
+ // Create an empty path.
+ SplashPath();
+
+ // Copy a path.
+ SplashPath *copy() { return new SplashPath(this); }
+
+ ~SplashPath();
+
+ // Append <path> to <this>.
+ void append(SplashPath *path);
+
+ // Start a new subpath.
+ SplashError moveTo(SplashCoord x, SplashCoord y);
+
+ // Add a line segment to the last subpath.
+ SplashError lineTo(SplashCoord x, SplashCoord y);
+
+ // Add a third-order (cubic) Bezier curve segment to the last
+ // subpath.
+ SplashError curveTo(SplashCoord x1, SplashCoord y1,
+ SplashCoord x2, SplashCoord y2,
+ SplashCoord x3, SplashCoord y3);
+
+ // Add a clockwise circular arc with center (xc, yc) and endpoint
+ // (x1, y1).
+ SplashError arcCWTo(SplashCoord x1, SplashCoord y1,
+ SplashCoord xc, SplashCoord yc);
+
+ // Close the last subpath, adding a line segment if necessary.
+ SplashError close();
+
+ // Add (<dx>, <dy>) to every point on this path.
+ void offset(SplashCoord dx, SplashCoord dy);
+
+ // Get the current point.
+ GBool getCurPt(SplashCoord *x, SplashCoord *y);
+
+private:
+
+ SplashPath(SplashPath *path);
+ void grow(int nPts);
+ GBool noCurrentPoint() { return curSubpath == length; }
+ GBool onePointSubpath() { return curSubpath == length - 1; }
+ GBool openSubpath() { return curSubpath < length - 1; }
+
+ SplashPathPoint *pts; // array of points
+ Guchar *flags; // array of flags
+ int length, size; // length/size of the pts and flags arrays
+ int curSubpath; // index of first point in last subpath
+
+ friend class SplashXPath;
+ friend class Splash;
+};
+
+#endif