Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:26:10

0001 //========================================================================
0002 //
0003 // SplashXPath.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) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
0015 // Copyright (C) 2018, 2021 Albert Astals Cid <aacid@kde.org>
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 SPLASHXPATH_H
0023 #define SPLASHXPATH_H
0024 
0025 #include "SplashTypes.h"
0026 
0027 class SplashPath;
0028 struct SplashXPathAdjust;
0029 
0030 //------------------------------------------------------------------------
0031 
0032 #define splashMaxCurveSplits (1 << 10)
0033 
0034 //------------------------------------------------------------------------
0035 // SplashXPathSeg
0036 //------------------------------------------------------------------------
0037 
0038 struct SplashXPathSeg
0039 {
0040     SplashCoord x0, y0; // first endpoint
0041     SplashCoord x1, y1; // second endpoint
0042     SplashCoord dxdy; // slope: delta-x / delta-y
0043     SplashCoord dydx; // slope: delta-y / delta-x
0044     unsigned int flags;
0045 };
0046 
0047 #define splashXPathHoriz                                                                                                                                                                                                                       \
0048     0x01 // segment is vertical (y0 == y1)
0049          //   (dxdy is undef)
0050 #define splashXPathVert                                                                                                                                                                                                                        \
0051     0x02 // segment is horizontal (x0 == x1)
0052          //   (dydx is undef)
0053 #define splashXPathFlip 0x04 // y0 > y1
0054 
0055 //------------------------------------------------------------------------
0056 // SplashXPath
0057 //------------------------------------------------------------------------
0058 
0059 class SplashXPath
0060 {
0061 public:
0062     // Expands (converts to segments) and flattens (converts curves to
0063     // lines) <path>.  Transforms all points from user space to device
0064     // space, via <matrix>.  If <closeSubpaths> is true, closes all open
0065     // subpaths.
0066     SplashXPath(SplashPath *path, SplashCoord *matrix, SplashCoord flatness, bool closeSubpaths, bool adjustLines = false, int linePosI = 0);
0067 
0068     ~SplashXPath();
0069 
0070     SplashXPath(const SplashXPath &) = delete;
0071     SplashXPath &operator=(const SplashXPath &) = delete;
0072 
0073     // Multiply all coordinates by splashAASize, in preparation for
0074     // anti-aliased rendering.
0075     void aaScale();
0076 
0077     // Sort by upper coordinate (lower y), in y-major order.
0078     void sort();
0079 
0080 protected:
0081     void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, SplashCoord *xo, SplashCoord *yo);
0082     void strokeAdjust(SplashXPathAdjust *adjust, SplashCoord *xp, SplashCoord *yp);
0083     void grow(int nSegs);
0084     void addCurve(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1, SplashCoord x2, SplashCoord y2, SplashCoord x3, SplashCoord y3, SplashCoord flatness, bool first, bool last, bool end0, bool end1);
0085     void addSegment(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1);
0086 
0087     SplashXPathSeg *segs;
0088     int length, size; // length and size of segs array
0089 
0090     friend class SplashXPathScanner;
0091     friend class SplashClip;
0092     friend class Splash;
0093 };
0094 
0095 #endif