cairomm 1.19.0
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
Cairo::Path::Element Class Reference

A single element of a path. More...

#include <cairomm/path.h>

Classes

struct  Point
 A simple structure for holding an X and Y coordinate pair. More...
 

Public Types

using cobject = cairo_path_data_t
 The base C cairo type.
 

Public Member Functions

 Element (cobject *pData)
 
cobjectcobj ()
 Get a pointer to the base cairo type.
 
const cobjectcobj () const
 Get a const pointer to the base cairo type.
 
Point operator[] (unsigned int idx) const
 You can access the datapoints that make up a path Element by using array notation.
 
unsigned int size () const
 Get the number of points in this path element.
 
ElementType type () const
 Gets the type of element for this path element.
 

Protected Attributes

cobjectm_cobject
 

Detailed Description

A single element of a path.

Each element has a 'type', which determines how many Points are contained in this element. Use the subscript operator[] to access the sub-points.

Most people will rarely need access to the underlying path data, so this will not be needed very often.

Since cairomm 1.20:
Examples
path-iter.cc.

Member Typedef Documentation

◆ cobject

The base C cairo type.

Constructor & Destructor Documentation

◆ Element()

Cairo::Path::Element::Element ( cobject pData)

Member Function Documentation

◆ cobj() [1/2]

cobject * Cairo::Path::Element::cobj ( )
inline

Get a pointer to the base cairo type.

◆ cobj() [2/2]

const cobject * Cairo::Path::Element::cobj ( ) const
inline

Get a const pointer to the base cairo type.

◆ operator[]()

Point Cairo::Path::Element::operator[] ( unsigned int  idx) const

You can access the datapoints that make up a path Element by using array notation.

The index is zero-based, so element[0] gives you the first point.

Exceptions
std::out_of_rangeon invalid idx

◆ size()

unsigned int Cairo::Path::Element::size ( ) const

Get the number of points in this path element.

This is tightly coupled with the type of Path Element that it is. MOVE_TO and LINE_TO both have a single data point, CURVE_TO has three data points, and CLOSE_PATH has none.

Examples
path-iter.cc.

◆ type()

ElementType Cairo::Path::Element::type ( ) const
inline

Gets the type of element for this path element.

Examples
path-iter.cc.

Member Data Documentation

◆ m_cobject

cobject* Cairo::Path::Element::m_cobject
protected

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