X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fpath.h;h=eb2b7b7f33d953a64cfca28f7eca015212910bff;hp=b08c146e4daaed160524ddc65b6310993149cb51;hb=58a6719da2337b3e6e20b581885f170bbe5fc480;hpb=35f1190c8c8036ed11180656769cf0c1cbf7c2b3 diff --git a/src/path.h b/src/path.h index b08c146..eb2b7b7 100644 --- a/src/path.h +++ b/src/path.h @@ -6,14 +6,23 @@ #include "rect.h" #include "real.h" +#ifdef QUADTREE_DISABLED + +#define TRANSFORM_BEZIERS_TO_PATH +#ifdef TRANSFORM_BEZIERS_TO_PATH +#include "gmprat.h" +#endif + +#endif + namespace IPDF { struct Colour { - float r; float g; float b; float a; + uint8_t r; uint8_t g; uint8_t b; uint8_t a; Colour() = default; - Colour(float _r, float _g, float _b, float _a) : r(_r), g(_g), b(_b), a(_a) {} + Colour(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {} bool operator==(const Colour & c) const { return (r == c.r && g == c.g && b == c.b && a == c.a); @@ -22,12 +31,15 @@ namespace IPDF }; class Objects; + class View; struct Path { - Path(const Objects & objects, unsigned _start, unsigned _end, const Colour & _fill = Colour(0.8,0.8,0.8,1)); + Path(Objects & objects, unsigned _start, unsigned _end, const Colour & _fill = Colour(128,128,128,255), const Colour & _stroke = Colour(0,0,0,0)); - Rect SolveBounds(const Objects & objects) const; + Rect SolveBounds(const Objects & objects); + Rect & GetBounds(Objects & objects); + std::vector & FillPoints(const Objects & objects, const View & view); // Is point inside shape? bool PointInside(const Objects & objects, const Vec2 & pt, bool debug=false) const; @@ -43,7 +55,15 @@ namespace IPDF std::vector m_fill_points; + #ifdef TRANSFORM_BEZIERS_TO_PATH + Gmprat x; + Gmprat y; + Gmprat w; + Gmprat h; + #endif + Colour m_fill; // colour to fill with + Colour m_stroke; // colour to outline with }; }