X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fpath.h;h=fa63cb4651e5a5be6e07d25e8637ab60f9361864;hp=ac6956c45806ae866d35787b53c2ea0f0590f3aa;hb=888817a67a9d840be66b52811b01eb77f10ff3e6;hpb=3172dd5af487e0f8a6e5cd5439dea594b9cbd7c9 diff --git a/src/path.h b/src/path.h index ac6956c..fa63cb4 100644 --- a/src/path.h +++ b/src/path.h @@ -11,9 +11,9 @@ 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,25 +22,31 @@ 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(const 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; + 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; unsigned m_start; // First bounding Bezier index unsigned m_end; // Last (inclusive) '' '' unsigned m_index; // index into Objects array - std::pair m_top; - std::pair m_bottom; - std::pair m_left; - std::pair m_right; + Vec2 m_top; + Vec2 m_bottom; + Vec2 m_left; + Vec2 m_right; + + std::vector m_fill_points; Colour m_fill; // colour to fill with + Colour m_stroke; // colour to outline with }; }