|
|
|||
File indexing completed on 2025-12-11 10:26:10
0001 //======================================================================== 0002 // 0003 // SplashPath.h 0004 // 0005 //======================================================================== 0006 0007 //======================================================================== 0008 // 0009 // Modified under the Poppler project - http://poppler.freedesktop.org 0010 // 0011 // All changes made under the Poppler project to this file are licensed 0012 // under GPL version 2 or later 0013 // 0014 // Copyright (C) 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org> 0015 // Copyright (C) 2018 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de> 0016 // 0017 // To see a description of the changes please see the Changelog file that 0018 // came with your tarball or type make ChangeLog if you are building from git 0019 // 0020 //======================================================================== 0021 0022 #ifndef SPLASHPATH_H 0023 #define SPLASHPATH_H 0024 0025 #include "SplashTypes.h" 0026 #include "poppler_private_export.h" 0027 0028 //------------------------------------------------------------------------ 0029 // SplashPathPoint 0030 //------------------------------------------------------------------------ 0031 0032 struct SplashPathPoint 0033 { 0034 SplashCoord x, y; 0035 }; 0036 0037 //------------------------------------------------------------------------ 0038 // SplashPath.flags 0039 //------------------------------------------------------------------------ 0040 0041 // first point on each subpath sets this flag 0042 #define splashPathFirst 0x01 0043 0044 // last point on each subpath sets this flag 0045 #define splashPathLast 0x02 0046 0047 // if the subpath is closed, its first and last points must be 0048 // identical, and must set this flag 0049 #define splashPathClosed 0x04 0050 0051 // curve control points set this flag 0052 #define splashPathCurve 0x08 0053 0054 //------------------------------------------------------------------------ 0055 // SplashPathHint 0056 //------------------------------------------------------------------------ 0057 0058 struct SplashPathHint 0059 { 0060 int ctrl0, ctrl1; 0061 int firstPt, lastPt; 0062 }; 0063 0064 //------------------------------------------------------------------------ 0065 // SplashPath 0066 //------------------------------------------------------------------------ 0067 0068 class POPPLER_PRIVATE_EXPORT SplashPath 0069 { 0070 public: 0071 // Create an empty path. 0072 SplashPath(); 0073 ~SplashPath(); 0074 0075 SplashPath(const SplashPath &) = delete; 0076 SplashPath &operator=(const SplashPath &) = delete; 0077 SplashPath(SplashPath &&path) noexcept; 0078 0079 // Append <path> to <this>. 0080 void append(SplashPath *path); 0081 0082 // Start a new subpath. 0083 SplashError moveTo(SplashCoord x, SplashCoord y); 0084 0085 // Add a line segment to the last subpath. 0086 SplashError lineTo(SplashCoord x, SplashCoord y); 0087 0088 // Add a third-order (cubic) Bezier curve segment to the last 0089 // subpath. 0090 SplashError curveTo(SplashCoord x1, SplashCoord y1, SplashCoord x2, SplashCoord y2, SplashCoord x3, SplashCoord y3); 0091 0092 // Close the last subpath, adding a line segment if necessary. If 0093 // <force> is true, this adds a line segment even if the current 0094 // point is equal to the first point in the subpath. 0095 SplashError close(bool force = false); 0096 0097 // Add a stroke adjustment hint. The controlling segments are 0098 // <ctrl0> and <ctrl1> (where segments are identified by their first 0099 // point), and the points to be adjusted are <firstPt> .. <lastPt>. 0100 void addStrokeAdjustHint(int ctrl0, int ctrl1, int firstPt, int lastPt); 0101 0102 // Add (<dx>, <dy>) to every point on this path. 0103 void offset(SplashCoord dx, SplashCoord dy); 0104 0105 // Get the points on the path. 0106 int getLength() { return length; } 0107 void getPoint(int i, double *x, double *y, unsigned char *f) 0108 { 0109 *x = pts[i].x; 0110 *y = pts[i].y; 0111 *f = flags[i]; 0112 } 0113 0114 // Get the current point. 0115 bool getCurPt(SplashCoord *x, SplashCoord *y); 0116 0117 // Reserve space for at least n points 0118 void reserve(int n); 0119 0120 protected: 0121 void grow(int nPts); 0122 bool noCurrentPoint() { return curSubpath == length; } 0123 bool onePointSubpath() { return curSubpath == length - 1; } 0124 bool openSubpath() { return curSubpath < length - 1; } 0125 0126 SplashPathPoint *pts; // array of points 0127 unsigned char *flags; // array of flags 0128 int length, size; // length/size of the pts and flags arrays 0129 int curSubpath; // index of first point in last subpath 0130 0131 SplashPathHint *hints; // list of hints 0132 int hintsLength, hintsSize; 0133 0134 friend class SplashXPath; 0135 friend class Splash; 0136 }; 0137 0138 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|