22 #ifndef CRNSTROKE_HEADER
23 #define CRNSTROKE_HEADER
123 inline size_t Size(
const Stroke &s) noexcept {
return s.GetNbPoints(); }
const_iterator begin() const
Returns a new const_iterator on the first point of the stroke.
#define CRN_SERIALIZATION_CONSTRUCTOR(classname)
Defines a default constructor from xml element.
#define CRN_ADD_RANGED_FOR_TO_CONST_POINTERS(TYPE)
Enables ranged for for smart pointers on a type.
Rect GetBBox() const
Returns the bounding box using integer values.
Stroke & operator=(const Stroke &other)
Stroke MakeIntersection(const Rect &rect) const
Creates a new stroke that is the intersection of the stroke with a rectangle.
void AddPoint(const Point2DInt &p)
Adds a point to the stroke.
Stroke()
Default constructor.
#define CRN_ADD_RANGED_FOR_TO_POINTERS(TYPE)
Enables ranged for for smart pointers on a type.
Stroke MakeFirstIntersection(const Rect &rect) const
Creates a new stroke that is the first intersection of the stroke with a rectangle.
void MergeAtEnd(const Stroke &str)
Adds a batch of points directly at the end of the stroke.
void MergeWithXInterpolation(const Stroke &str, unsigned int step=1)
Adds a batch of points at their original position and adds points to interpolate. ...
std::vector< Point2DInt > datatype
size_t GetNbPoints() const noexcept
Returns the number of points in the stroke.
const_iterator end() const
Returns a new const_iterator after the last point of the stroke.
size_t Size(const Vector &v) noexcept
Size of a vector.
Point2DInt & GetPoint(size_t index)
Returns a reference to a point.
const Point2DInt & operator[](size_t index) const
Returns a reference to a point (fast and unsafe).
const_iterator cbegin() const
Returns a new const_iterator on the first point of the stroke.
Point2DInt & operator[](size_t index)
Returns a reference to a point (fast and unsafe).
iterator begin()
Returns a new iterator on the first point of the stroke.
void Deserialize(xml::Element &el)
Initializes the object from an XML element.
double GetFirstYAtX(double x) const
Returns the ordinate of the first point with abscissa = x.
virtual ~Stroke() override
Destructor.
const_iterator cend() const
Returns a new const_iterator after the last point of the stroke.
#define CRN_DECLARE_CLASS_CONSTRUCTOR(classname)
Declares a class constructor.
CRN_ALIAS_SMART_PTR(ImageBW)
iterator end()
Returns a new iterator after the last point of the stroke.
xml::Element Serialize(xml::Element &parent) const
Dumps the object to an XML element.