Boost.UI
User Interface Boost library
Classes | Public Types | Public Member Functions | Friends | List of all members
boost::ui::painter Class Reference

2D graphics rendering painter More...

Classes

class  state_saver
 Saves state in the constructor and restores it in the destructor. More...
 

Public Types

typedef double gcoord_type
 Graphics coordinates signed number type.
 
typedef void * native_handle_type
 Implementation-defined painter type.
 

Public Member Functions

painter & save ()
 Push state.
 
painter & restore ()
 Pop state.
 
painter & scale (gcoord_type x, gcoord_type y)
 Adds scaling transformation.
 
painter & rotate (gcoord_type angle)
 Adds rotation transformation.
 
painter & fill_color (const color &c)
 Sets the current color used for filling shapes.
 
painter & stroke_color (const color &c)
 Sets the current color used for filling shapes.
 
painter & begin_path ()
 Resets the current path.
 
painter & fill ()
 Fills the current path.
 
painter & stroke ()
 Strokes the current path.
 
painter & line_width (gcoord_type width)
 Sets line width (default is 1)
 
painter & line_cap (ui::line_cap lc)
 Sets type of line endings, default value is butt.
 
painter & line_join (ui::line_join lj)
 Sets type of line join, default value is miter.
 
painter & font (const ui::font &f)
 Sets font.
 
ui::font font () const
 Returns font.
 
painter & close_path ()
 Connects the last point to the first point in the subpath.
 
painter & translate (gcoord_type x, gcoord_type y)
 Adds translation transformation.
 
template<class T >
painter & translate (const basic_point< T > &p)
 Adds translation transformation.
 
painter & clear_rect (gcoord_type x, gcoord_type y, gcoord_type width, gcoord_type height)
 Clears all pixels on the painter in the given rectangle to transparent black.
 
template<class T >
painter & clear_rect (const basic_rect< T > &r)
 Clears all pixels on the painter in the given rectangle to transparent black.
 
template<class T >
painter & clear_rect (const basic_point< T > &point, const basic_size< T > &size)
 Clears all pixels on the painter in the given rectangle to transparent black.
 
template<class T >
painter & clear_rect (const basic_point< T > &point1, const basic_point< T > &point2)
 Clears all pixels on the painter in the given rectangle to transparent black.
 
painter & fill_rect (gcoord_type x, gcoord_type y, gcoord_type width, gcoord_type height)
 Paints the given rectangle onto the painter, using the current fill style.
 
template<class T >
painter & fill_rect (const basic_rect< T > &r)
 Paints the given rectangle onto the painter, using the current fill style.
 
template<class T >
painter & fill_rect (const basic_point< T > &point, const basic_size< T > &size)
 Paints the given rectangle onto the painter, using the current fill style.
 
template<class T >
painter & fill_rect (const basic_point< T > &point1, const basic_point< T > &point2)
 Paints the given rectangle onto the painter, using the current fill style.
 
painter & stroke_rect (gcoord_type x, gcoord_type y, gcoord_type width, gcoord_type height)
 Paints the box that outlines the given rectangle onto the painter, using the current stroke style.
 
template<class T >
painter & stroke_rect (const basic_rect< T > &r)
 Paints the box that outlines the given rectangle onto the painter, using the current stroke style.
 
template<class T >
painter & stroke_rect (const basic_point< T > &point, const basic_size< T > &size)
 Paints the box that outlines the given rectangle onto the painter, using the current stroke style.
 
template<class T >
painter & stroke_rect (const basic_point< T > &point1, const basic_point< T > &point2)
 Paints the box that outlines the given rectangle onto the painter, using the current stroke style.
 
painter & fill_text (const uistring &text, gcoord_type x, gcoord_type y)
 Fills the given text at the given position.
 
template<class T >
painter & fill_text (const uistring &text, const basic_point< T > &p)
 Fills the given text at the given position.
 
painter & draw_image (const image &img, gcoord_type dx, gcoord_type dy)
 Draws the given image onto the painter.
 
template<class T >
painter & draw_image (const image &img, const basic_point< T > &p)
 Draws the given image onto the painter.
 
template<class Iterator >
painter & line_dash (Iterator first, Iterator last)
 Sets line dashes.
 
template<class Range >
painter & line_dash (const Range &r)
 Sets line dashes.
 
template<class T >
painter & line_dash (std::initializer_list< T > list)
 Sets line dashes.
 
painter & line_dash (nullopt_t)
 Resets line dashes.
 
painter & reset_line_dash ()
 Resets line dashes.
 
painter & move_to (gcoord_type x, gcoord_type y)
 Creates a new subpath with the specified point as its first (and only) point.
 
template<class T >
painter & move_to (const basic_point< T > &p)
 Creates a new subpath with the specified point as its first (and only) point.
 
painter & line_to (gcoord_type x, gcoord_type y)
 Connects the last point in the subpath to the specified point using a straight line.
 
template<class T >
painter & line_to (const basic_point< T > &p)
 Connects the last point in the subpath to the specified point using a straight line.
 
painter & quadratic_curve_to (gcoord_type cpx, gcoord_type cpy, gcoord_type x, gcoord_type y)
 Creates quadratic Bezier curve with control point (cpx, cpy)
 
template<class T >
painter & quadratic_curve_to (const basic_point< T > &cp, const basic_point< T > &p)
 Creates quadratic Bezier curve with control point (cpx, cpy)
 
painter & bezier_curve_to (gcoord_type cp1x, gcoord_type cp1y, gcoord_type cp2x, gcoord_type cp2y, gcoord_type x, gcoord_type y)
 Creates cubic Bezier curve with control points (cp1x, cp1y) and (cp2x, cp2y)
 
template<class T >
painter & bezier_curve_to (const basic_point< T > &cp1, const basic_point< T > &cp2, const basic_point< T > &p)
 Creates cubic Bezier curve with control points (cp1x, cp1y) and (cp2x, cp2y)
 
painter & arc (gcoord_type x, gcoord_type y, gcoord_type radius, gcoord_type start_angle, gcoord_type end_angle, bool anticlockwise=false)
 Creates an arc.
 
template<class T >
painter & arc (const basic_point< T > &p, gcoord_type radius, gcoord_type start_angle, gcoord_type end_angle, bool anticlockwise=false)
 Creates an arc.
 
painter & rect (gcoord_type x, gcoord_type y, gcoord_type w, gcoord_type h)
 Creates rectangular closed subpath.
 
template<class T >
painter & rect (const basic_rect< T > &r)
 Creates rectangular closed subpath.
 
template<class T >
painter & rect (const basic_point< T > &point, const basic_size< T > &size)
 Creates rectangular closed subpath.
 
template<class T >
painter & rect (const basic_point< T > &point1, const basic_point< T > &point2)
 Creates rectangular closed subpath.
 
native_handle_type native_handle ()
 Returns the implementation-defined underlying painter handle.
 

Friends

class canvas
 

Detailed Description

2D graphics rendering painter

See also
2D computer graphics (Wikipedia)
HTML Canvas 2D Context, Level 1 (W3C)
HTML Canvas 2D Context, Level 2 (W3C)

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