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

A Path represents a collection of PathContour objects. More...

#include <path.hpp>

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

Classes

class  arc
 Wraps the data to specify an arc. More...
 
class  contour_close
 Tag class to mark the close of a contour. More...
 
class  contour_close_arc
 Tag class to mark the close of an contour with an arc. More...
 
class  contour_end
 Tag class to mark the end of a contour without adding a closing edge of the contour and start a new contour. More...
 
class  contour_start
 Indicates to end the existing contour with adding a closing edge of the contour and start a new contour. More...
 
class  control_point
 Class that wraps a vec2 to mark a point as a control point for a Bezier curve. More...
 

Public Member Functions

 Path (void)
 
Pathadd_contour (const reference_counted_ptr< const PathContour > &contour)
 
Pathadd_contours (const Path &path)
 
bool approximate_bounding_box (Rect *out_bb) const
 
Patharc_to (float angle, const vec2 &pt, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
void clear (void)
 
Pathclose_contour (enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
Pathclose_contour_arc (float angle, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
Pathclose_contour_cubic (const vec2 &ct1, const vec2 &ct2, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
Pathclose_contour_quadratic (const vec2 &ct, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
reference_counted_ptr< const PathContourcontour (unsigned int i) const
 
Pathcubic_to (const vec2 &ct1, const vec2 &ct2, const vec2 &pt, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
PathContourcurrent_contour (void)
 
Pathend_contour (void)
 
bool is_flat (void) const
 
Pathline_to (const vec2 &pt, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
Pathmove (const vec2 &pt)
 
unsigned int number_contours (void) const
 
Pathoperator<< (const vec2 &pt)
 
Pathoperator<< (const control_point &pt)
 
Pathoperator<< (const arc &a)
 
Pathoperator<< (contour_close)
 
Pathoperator<< (contour_end)
 
Pathoperator<< (contour_close_arc a)
 
Pathoperator<< (const contour_start &st)
 
Pathoperator<< (enum PathEnums::edge_type_t etp)
 
Pathquadratic_to (const vec2 &ct, const vec2 &pt, enum PathEnums::edge_type_t etp=PathEnums::starts_new_edge)
 
const ShaderFilledPathshader_filled_path (void) const
 
void swap (Path &obj)
 
const TessellatedPathtessellation (float thresh) const
 
const TessellatedPathtessellation (void) const
 

Static Public Member Functions

static arc arc_degrees (float angle, const vec2 &pt)
 
static contour_close_arc contour_close_arc_degrees (float angle)
 

Detailed Description

A Path represents a collection of PathContour objects.

Definition at line 668 of file path.hpp.

Constructor & Destructor Documentation

◆ Path()

fastuidraw::Path::Path ( void  )
explicit

Ctor.

Member Function Documentation

◆ add_contour()

Path& fastuidraw::Path::add_contour ( const reference_counted_ptr< const PathContour > &  contour)

Adds a PathContour to this Path. The current contour remains as the current contour though.

Parameters
contourPathContour to add to the Path

◆ add_contours()

Path& fastuidraw::Path::add_contours ( const Path path)

Add all the PathContour objects of a Path into this Path.

Parameters
pathPath to add

◆ approximate_bounding_box()

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

Returns an approximation of the bounding box for this Path. Returns false if the Path is empty.

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

◆ arc_degrees()

static arc fastuidraw::Path::arc_degrees ( float  angle,
const vec2 pt 
)
inlinestatic

Create an arc but specify the angle in degrees.

Parameters
angleangle of arc in degrees
ptpoint to which to arc

Definition at line 829 of file path.hpp.

◆ arc_to()

Path& fastuidraw::Path::arc_to ( float  angle,
const vec2 pt,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Append an arc curve to the current contour.

Parameters
anglegives the angle of the arc in radians. For a coordinate system where y increases upwards and x increases to the right, a positive value indicates counter-clockwise and a negative value indicates clockwise
ptpoint to which the arc curve goes
etpthe edge type of the new arc made; if this is the first edge of the current contour, the value of etp is ignored and the value PathEnums::starts_new_edge is used.

◆ clear()

void fastuidraw::Path::clear ( void  )

Clear the path, i.e. remove all PathContour's from the path

◆ close_contour()

Path& fastuidraw::Path::close_contour ( enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge)

Close the current contour with a line segment.

Parameters
etpthe edge type of the closing edge made.

◆ close_contour_arc()

Path& fastuidraw::Path::close_contour_arc ( float  angle,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Close the current contour in an arc

Parameters
anglegives the angle of the arc in radians. For a coordinate system where y increases upwards and x increases to the right, a positive value indicates counter-clockwise and a negative value indicates clockwise
etpthe edge type of the closing edge made.

◆ close_contour_cubic()

Path& fastuidraw::Path::close_contour_cubic ( const vec2 ct1,
const vec2 ct2,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Close the current contour in a cubic Bezier curve

Parameters
ct1first control point of the cubic Bezier curve
ct2second control point of the cubic Bezier curve
etpthe edge type of the closing edge made.

◆ close_contour_quadratic()

Path& fastuidraw::Path::close_contour_quadratic ( const vec2 ct,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Close the current contour in a quadratic Bezier curve

Parameters
ctcontrol point of the quadratic Bezier curve
etpthe edge type of the closing edge made.

◆ contour()

reference_counted_ptr<const PathContour> fastuidraw::Path::contour ( unsigned int  i) const

Returns the named contour

Parameters
iindex of contour to fetch (0 <= i < number_contours())

◆ contour_close_arc_degrees()

static contour_close_arc fastuidraw::Path::contour_close_arc_degrees ( float  angle)
inlinestatic

Create an contour_close_arc but specify the angle in degrees.

Parameters
angleangle or arc in degrees

Definition at line 840 of file path.hpp.

◆ cubic_to()

Path& fastuidraw::Path::cubic_to ( const vec2 ct1,
const vec2 ct2,
const vec2 pt,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Append a cubic Bezier curve to the current contour.

Parameters
ct1first control point of the cubic Bezier curve
ct2second control point of the cubic Bezier curve
ptpoint to which the cubic Bezier curve goes
etpthe edge type of the new cubic made; if this is the first edge of the current contour, the value of etp is ignored and the value PathEnums::starts_new_edge is used.

◆ current_contour()

PathContour& fastuidraw::Path::current_contour ( void  )

The current contour of this Path. Use thie value when creating PathContour::interpolator_base objects.

◆ end_contour()

Path& fastuidraw::Path::end_contour ( void  )

End the current contour without adding a closing edge.

◆ is_flat()

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

Returns true if each PathContour of the Path is flat.

◆ line_to()

Path& fastuidraw::Path::line_to ( const vec2 pt,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Append a line to the current contour.

Parameters
ptpoint to which the line goes
etpthe edge type of the new line made; if this is the first edge of the current contour, the value of etp is ignored and the value PathEnums::starts_new_edge is used.

◆ move()

Path& fastuidraw::Path::move ( const vec2 pt)

Begin a new contour.

Parameters
ptpoint at which the contour begins

◆ number_contours()

unsigned int fastuidraw::Path::number_contours ( void  ) const

Returns the number of contours of the Path.

◆ operator<<() [1/8]

Path& fastuidraw::Path::operator<< ( const vec2 pt)

Operator overload to add a point of the current contour in the Path.

Parameters
ptpoint to add

◆ operator<<() [2/8]

Path& fastuidraw::Path::operator<< ( const control_point pt)

Operator overload to add a control point of the current contour in the Path.

Parameters
ptcontrol point to add

◆ operator<<() [3/8]

Path& fastuidraw::Path::operator<< ( const arc a)

Operator overload to add an arc to the current contour in the Path.

Parameters
aarc to add

◆ operator<<() [4/8]

Path& fastuidraw::Path::operator<< ( contour_close  )

Operator overload to close the current contour

◆ operator<<() [5/8]

Path& fastuidraw::Path::operator<< ( contour_end  )

Operator overload to end the current contour

◆ operator<<() [6/8]

Path& fastuidraw::Path::operator<< ( contour_close_arc  a)

Operator overload to close the current contour

Parameters
aspecifies the angle of the arc for closing the current contour

◆ operator<<() [7/8]

Path& fastuidraw::Path::operator<< ( const contour_start st)
inline

Operator overload to start a new contour without closing the current contour.

Parameters
stspecifies the starting point of the new contour

Definition at line 895 of file path.hpp.

◆ operator<<() [8/8]

Path& fastuidraw::Path::operator<< ( enum PathEnums::edge_type_t  etp)

Operator overload to control PathEnums::edge_type_t of the next edge made via operator overloads. If no edge is yet present on the current contour, then the value is ignored. The tag is reset back to PathEnums::starts_new_edge after an edge is added.

Parameters
etpedge type

◆ quadratic_to()

Path& fastuidraw::Path::quadratic_to ( const vec2 ct,
const vec2 pt,
enum PathEnums::edge_type_t  etp = PathEnums::starts_new_edge 
)

Append a quadratic Bezier curve to the current contour.

Parameters
ctcontrol point of the quadratic Bezier curve
ptpoint to which the quadratic Bezier curve goes
etpthe edge type of the new quadratic made; if this is the first edge of the current contour, the value of etp is ignored and the value PathEnums::starts_new_edge is used.

◆ shader_filled_path()

const ShaderFilledPath& fastuidraw::Path::shader_filled_path ( void  ) const

Returns the ShaderFilledPath coming from this Path. The returned reference will be null if the Path contains anything besides line segments, quadratic Bezier curves or cubic Bezier curves.

◆ swap()

void fastuidraw::Path::swap ( Path obj)

Swap contents of Path with another Path

Parameters
objPath with which to swap

◆ tessellation() [1/2]

const TessellatedPath& fastuidraw::Path::tessellation ( float  thresh) const

Return the tessellation of this Path at a specific level of detail. The TessellatedPath is constructed lazily. Additionally, if this Path changes its geometry, then a new TessellatedPath will be contructed on the next call to tessellation().

Parameters
threshthe returned tessellated path will be so that TessellatedPath::max_distance() is no more than thresh. A non-positive value will return the lowest level of detail tessellation.

◆ tessellation() [2/2]

const TessellatedPath& fastuidraw::Path::tessellation ( void  ) const

Provided as a conveniance, returns the starting point tessellation. Equivalent to


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