FastUIDraw
Classes | Public Member Functions | List of all members
fastuidraw::PathContour Class Reference

An PathContour represents a single contour within a Path. More...

#include <path.hpp>

Inheritance diagram for fastuidraw::PathContour:
Inheritance graph
[legend]

Classes

class  arc
 An arc is for connecting one point to the next via an arc of a circle. More...
 
class  bezier
 Derived class of interpolator_base to indicate a Bezier curve. Supports Bezier curves of any degree. More...
 
class  flat
 A flat interpolator represents a flat edge. More...
 
class  interpolator_base
 Base class to describe how to interpolate from one point of a PathContour to the next, i.e. describes the shape of an edge. More...
 
class  interpolator_generic
 Interpolator generic implements tessellation by recursion and relying on analytic derivative provided by derived class. More...
 
class  tessellation_state
 Provides an interface to resume from a previous tessellation of a interpolator_base derived object. More...
 

Public Member Functions

 PathContour (void)
 
void add_control_point (const vec2 &pt)
 
bool approximate_bounding_box (Rect *out_bb) const
 
void clear_control_points (void)
 
void close (enum PathEnums::edge_type_t etp)
 
void close_arc (float angle, enum PathEnums::edge_type_t etp)
 
void close_generic (void)
 
bool closed (void) const
 
reference_counted_ptr< PathContourdeep_copy (void) const
 
void end (void)
 
bool ended (void) const
 
const reference_counted_ptr< const interpolator_base > & interpolator (unsigned int I) const
 
bool is_flat (void) const
 
unsigned int number_interpolators (void) const
 
unsigned int number_points (void) const
 
const vec2point (unsigned int I) const
 
const reference_counted_ptr< const interpolator_base > & prev_interpolator (void)
 
void start (const vec2 &pt)
 
void to_arc (float angle, const vec2 &pt, enum PathEnums::edge_type_t etp)
 
void to_point (const vec2 &pt, enum PathEnums::edge_type_t etp)
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
static void add_reference (const reference_counted_base< T, Counter > *p)
 
static void remove_reference (const reference_counted_base< T, Counter > *p)
 

Detailed Description

An PathContour represents a single contour within a Path.

Closeing a contour (see close(), close_generic() and close_arc()) means to specify the edge from the last point of the PathContour to the first point.

Definition at line 49 of file path.hpp.

Constructor & Destructor Documentation

◆ PathContour()

fastuidraw::PathContour::PathContour ( void  )
explicit

Ctor.

Member Function Documentation

◆ add_control_point()

void fastuidraw::PathContour::add_control_point ( const vec2 pt)

Add a control point. Will fail if close() was called

Parameters
ptlocation of new control point

◆ approximate_bounding_box()

bool fastuidraw::PathContour::approximate_bounding_box ( Rect out_bb) const

Returns an approximation of the bounding box for this PathContour WITHOUT relying on tessellating the interpolator_base objects of this PathContour. Returns false if the box is empty.

Parameters
out_bb(output) location to which to write the bounding box value

◆ clear_control_points()

void fastuidraw::PathContour::clear_control_points ( void  )

Clear any current control points.

◆ close()

void fastuidraw::PathContour::close ( enum PathEnums::edge_type_t  etp)

Closes with the Bezier curve defined by the current control points added by add_control_point().

Parameters
etpthe edge type of the new edge made.

◆ close_arc()

void fastuidraw::PathContour::close_arc ( float  angle,
enum PathEnums::edge_type_t  etp 
)

Closes with an arc.

Parameters
angleangle of arc in radians
etpthe edge type of the new edge made.

◆ close_generic()

void fastuidraw::PathContour::close_generic ( void  )

Closes the PathContour using the last interpolator_base derived object on the PathContour. That interpolator must interpolate to the start point of the PathContour

◆ closed()

bool fastuidraw::PathContour::closed ( void  ) const

Returns true if the PathContour is closed.

◆ deep_copy()

reference_counted_ptr<PathContour> fastuidraw::PathContour::deep_copy ( void  ) const

Create a deep copy of this PathContour.

◆ end()

void fastuidraw::PathContour::end ( void  )

End the PathContour without adding a closing edge.

◆ ended()

bool fastuidraw::PathContour::ended ( void  ) const

Returns true if the PathContour is ended, and thus no additional interpolator may be added.

◆ interpolator()

const reference_counted_ptr<const interpolator_base>& fastuidraw::PathContour::interpolator ( unsigned int  I) const

Returns the interpolator of this PathContour that interpolates from the I'th point to the (I + 1)'th point. When the closed() is true, if I is number_points() - 1, then returns the interpolator from the last point to the first point. When closed() is false, if I has value number_points() - 1, then returns a null reference.

◆ is_flat()

bool fastuidraw::PathContour::is_flat ( void  ) const

Returns true if each interpolator of the PathContour is flat.

◆ number_interpolators()

unsigned int fastuidraw::PathContour::number_interpolators ( void  ) const

Returns the number of interpolators of this PathContour. This is equal to number_points() if closed() is true; otherwise it is equal to number_points() - 1.

◆ number_points()

unsigned int fastuidraw::PathContour::number_points ( void  ) const

Returns the number of points of this PathContour.

◆ point()

const vec2& fastuidraw::PathContour::point ( unsigned int  I) const

Return the I'th point of this PathContour. For I = 0, returns the value passed to start().

Parameters
Iindex of point.

◆ prev_interpolator()

const reference_counted_ptr<const interpolator_base>& fastuidraw::PathContour::prev_interpolator ( void  )

Returns the last interpolator added to this PathContour. If no contours have been added, returns a null reference.

◆ start()

void fastuidraw::PathContour::start ( const vec2 pt)

Start the PathContour, may only be called once in the lifetime of a PathContour() and must be called before adding points (to_point()), adding control points (add_control_point()), adding arcs (to_arc()), creating any interpolator_base objects using this PathContour or closing the contour.

◆ to_arc()

void fastuidraw::PathContour::to_arc ( float  angle,
const vec2 pt,
enum PathEnums::edge_type_t  etp 
)

Will fail if close() was called of if add_control_point() has been called more recently than to_point().

Parameters
angleangle of arc in radians
ptpoint where arc ends (and next edge starts)
etpthe edge type of the new edge made; if this is the first edge of the contour, the value of etp is ignored and the value PathEnums::starts_new_edge is used.

◆ to_point()

void fastuidraw::PathContour::to_point ( const vec2 pt,
enum PathEnums::edge_type_t  etp 
)

Close the current edge.

Parameters
ptpoint location of end of edge (and thus start of new edge)
etpthe edge type of the new edge made; if this is the first edge of the contour, the value of etp is ignored and the value PathEnums::starts_new_edge is used.

The documentation for this class was generated from the following file: