Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rpihw::designer< T, C, N > Class Template Referenceabstract

The graphic designer. More...

#include <designer.hpp>

Public Types

enum  TextFlags {
  ALIGN_LEFT = 0x01, ALIGN_CENTER = 0x02, ALIGN_RIGHT = 0x04, WORD_WRAP = 0x08,
  WORD_BREAK = 0x10
}
 Parameters of text.
 

Public Member Functions

 designer (T width, T height)
 Constructor method. More...
 
virtual ~designer ()
 Destructor method.
 
void setPenColor (const std::vector< C > &color)
 Sets the pen color. More...
 
const std::vector< C > & getPenColor () const
 Gets the current pen color. More...
 
virtual void setPenPosition (T x, T y)
 Sets the pen position. More...
 
void setFont (font::base &font)
 Sets the text font. More...
 
font::basegetFont () const
 Returns the current text font. More...
 
void drawPoint (T x, T y)
 Draws a point. More...
 
void drawLine (T x0, T y0, T x1, T y1)
 Draws a line. More...
 
void drawRect (T x0, T y0, T x1, T y1)
 Draws a rectangle. More...
 
void drawCircle (T cx, T cy, T radius)
 Draws a circle. More...
 
void drawEllipse (T cx, T cy, T a, T b)
 Draws an ellipse. More...
 
void fillRect (T x0, T y0, T x1, T y1)
 Draws a filled rectangle. More...
 
void fillCircle (T cx, T cy, T radius)
 Draws a filled circle. More...
 
void fillEllipse (T cx, T cy, T a, T b)
 Draws a filled ellipse. More...
 
void drawImage (const image::base< C > &img)
 Draws an image. More...
 
void drawImage (T x, T y, const image::base< C > &img)
 Moves the pen position and draws an image. More...
 
void drawText (char32_t charcode)
 Draws a character. More...
 
void drawText (T x, T y, char32_t charcode)
 Moves the pen position and draws a character. More...
 
template<typename iterator >
void drawText (iterator it, iterator end)
 Draws a string. More...
 
template<typename iterator >
void drawText (iterator it, iterator end, T width, T height, uint8_t flags)
 Draws a multiline string. More...
 
template<typename iterator >
void drawText (T x, T y, iterator it, iterator end)
 Moves the pen position and draws a string. More...
 
template<typename iterator >
void drawText (T x, T y, iterator it, iterator end, T width, T height, uint8_t flags)
 Moves the pen position and draws a multiline string. More...
 
void drawText (const std::string &text)
 Draws a string. More...
 
void drawText (const std::string &text, T width, T height, uint8_t flags=ALIGN_LEFT)
 Draws a multiline string. More...
 
void drawText (T x, T y, const std::string &text)
 Moves the pen position and draws a string. More...
 
void drawText (T x, T y, const std::string &text, T width, T height, uint8_t flags=ALIGN_LEFT)
 Moves the pen position and draws a multiline string. More...
 
void drawText (const std::u32string &text)
 Draws a unicode string. More...
 
void drawText (const std::u32string &text, T width, T height, uint8_t flags=ALIGN_LEFT)
 Draws a multiline unicode string. More...
 
void drawText (T x, T y, const std::u32string &text)
 Moves the pen position and draws a unicode string. More...
 
void drawText (T x, T y, const std::u32string &text, T width, T height, uint8_t flags=ALIGN_LEFT)
 Moves the pen position and draws a multiline unicode string. More...
 

Protected Member Functions

virtual void drawPixel (T x, T y, color_iterator< C > color)=0
 Draws a pixel. More...
 
void drawChar (char32_t charcode)
 Draws a character. More...
 
void drawCirclePoints (T cx, T cy, T x, T y)
 Draws the symmetric points of the circle.
 
void drawCircleAreas (T cx, T cy, T x, T y)
 Draws the symmetric areas of the circle.
 
void drawEllipsePoints (T cx, T cy, T x, T y)
 Draws the symmetric points of the ellipse.
 
void drawEllipseAreas (T cx, T cy, T x, T y)
 Draws the symmetric areas of the ellipse.
 

Protected Attributes

std::vector< C > m_color
 Foreground color.
 
font::basem_font
 Text font.
 
m_area_w
 Size of the drawing area.
 
m_area_h
 
m_pos_x
 Pen position.
 
m_pos_y
 

Detailed Description

template<typename T, typename C, uint8_t N = 3>
class rpihw::designer< T, C, N >

The graphic designer.

Definition at line 44 of file designer.hpp.

Constructor & Destructor Documentation

template<typename T, typename C , uint8_t N>
rpihw::designer< T, C, N >::designer ( width,
height 
)

Constructor method.

Parameters
[in]widthThe width of the drawing area.
[in]heightThe height of the drawing area.

Definition at line 28 of file designer-inl.hpp.

Member Function Documentation

template<typename T , typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawChar ( char32_t  charcode)
protected

Draws a character.

Parameters
[in]charcodeThe character code.

Monochromatic font

Definition at line 422 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawCircle ( cx,
cy,
radius 
)

Draws a circle.

Parameters
[in]cxThe horizontal position of the center of the circle.
[in]cyThe vertical position of the center of the circle.
[in]radiusThe radius of the circle.

=== Midpoint circle algorithm ===

Definition at line 176 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawEllipse ( cx,
cy,
a,
b 
)

Draws an ellipse.

Parameters
[in]cxThe horizontal position of the center of the ellipse.
[in]cyThe vertical position of the center of the ellipse.
[in]aThe parameters a of the ellipse.
[in]bThe parameters b of the ellipse.

=== Midpoint ellipse algorithm ===

Definition at line 200 of file designer-inl.hpp.

template<typename T , typename C, uint8_t N>
void rpihw::designer< T, C, N >::drawImage ( const image::base< C > &  img)
inline

Draws an image.

Parameters
[in]imgThe image object.

Definition at line 393 of file designer-inl.hpp.

template<typename T, typename C, uint8_t N>
void rpihw::designer< T, C, N >::drawImage ( x,
y,
const image::base< C > &  img 
)

Moves the pen position and draws an image.

Parameters
[in]xThe horizontal position of the left-top vertex.
[in]yThe vertical position of the left-top vertex.
[in]imgThe image object.

Definition at line 401 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawLine ( x0,
y0,
x1,
y1 
)

Draws a line.

Parameters
[in]x0The horizontal position of the first point of the line.
[in]y0The vertical position of the first point of the line.
[in]x1The horizontal position of the second point of the line.
[in]y1The vertical position of the second point of the line.

=== Bresenham's line algorithm ===

Definition at line 95 of file designer-inl.hpp.

template<typename T, typename C, uint8_t N = 3>
virtual void rpihw::designer< T, C, N >::drawPixel ( x,
y,
color_iterator< C >  color 
)
protectedpure virtual

Draws a pixel.

Parameters
[in]xThe horizontal position of the pixel.
[in]yThe vertical position of the pixel.
[in]colorAn iterator to the color data.

Implemented in rpihw::display::pcd8544.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawPoint ( x,
y 
)
inline

Draws a point.

Parameters
[in]xThe horizontal position of the point.
[in]yThe vertical position of the point.

Definition at line 87 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawRect ( x0,
y0,
x1,
y1 
)

Draws a rectangle.

Parameters
[in]x0The horizontal position of the left-top vertex of the rectangle.
[in]y0The vertical position of the left-top vertex of the rectangle.
[in]x1The horizontal position of the right-bottom vertex of the rectangle.
[in]y1The vertical position of the right-bottom vertex of the rectangle.

Definition at line 155 of file designer-inl.hpp.

template<typename T , typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( char32_t  charcode)
inline

Draws a character.

Parameters
[in]charcodeThe character code.

Definition at line 473 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( x,
y,
char32_t  charcode 
)
inline

Moves the pen position and draws a character.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]charcodeThe character code.

Definition at line 485 of file designer-inl.hpp.

template<typename T , typename C , uint8_t N>
template<typename iterator >
void rpihw::designer< T, C, N >::drawText ( iterator  it,
iterator  end 
)

Draws a string.

Parameters
[in]itThe start of the string.
[in]endThe end of the string.

Definition at line 500 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
template<typename iterator >
void rpihw::designer< T, C, N >::drawText ( iterator  it,
iterator  end,
width,
height,
uint8_t  flags 
)

Draws a multiline string.

Parameters
[in]itThe start of the string.
[in]endThe end of the string.
[in]widthThe width of the text area.
[in]heightThe height of the text area.
[in]flagsThe parameters of the text.

Definition at line 527 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
template<typename iterator >
void rpihw::designer< T, C, N >::drawText ( x,
y,
iterator  it,
iterator  end 
)
inline

Moves the pen position and draws a string.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]itThe start of the string.
[in]endThe end of the string.

Definition at line 708 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
template<typename iterator >
void rpihw::designer< T, C, N >::drawText ( x,
y,
iterator  it,
iterator  end,
width,
height,
uint8_t  flags 
)
inline

Moves the pen position and draws a multiline string.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]itThe start of the string.
[in]endThe end of the string.
[in]widthThe width of the text area.
[in]heightThe height of the text area.
[in]flagsThe parameters of the text.

Definition at line 720 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( const std::string &  text)
inline

Draws a string.

Parameters
[in]textThe string to be written.

Definition at line 734 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( const std::string &  text,
width,
height,
uint8_t  flags = ALIGN_LEFT 
)
inline

Draws a multiline string.

Parameters
[in]textThe string to be written.
[in]widthThe width of the text area.
[in]heightThe height of the text area.
[in]flagsThe parameters of the text.

Definition at line 742 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( x,
y,
const std::string &  text 
)
inline

Moves the pen position and draws a string.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]textThe string to be written.

Definition at line 750 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( x,
y,
const std::string &  text,
width,
height,
uint8_t  flags = ALIGN_LEFT 
)
inline

Moves the pen position and draws a multiline string.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]textThe string to be written.
[in]widthThe width of the text area.
[in]heightThe height of the text area.
[in]flagsThe parameters of the text.

Definition at line 758 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( const std::u32string &  text)
inline

Draws a unicode string.

Parameters
[in]textThe string to be written.

Definition at line 769 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( const std::u32string &  text,
width,
height,
uint8_t  flags = ALIGN_LEFT 
)
inline

Draws a multiline unicode string.

Parameters
[in]textThe string to be written.
[in]widthThe width of the text area.
[in]heightThe height of the text area.
[in]flagsThe parameters of the text.

Definition at line 777 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( x,
y,
const std::u32string &  text 
)
inline

Moves the pen position and draws a unicode string.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]textThe string to be written.

Definition at line 785 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::drawText ( x,
y,
const std::u32string &  text,
width,
height,
uint8_t  flags = ALIGN_LEFT 
)
inline

Moves the pen position and draws a multiline unicode string.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.
[in]textThe string to be written.
[in]widthThe width of the text area.
[in]heightThe height of the text area.
[in]flagsThe parameters of the text.

Definition at line 796 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::fillCircle ( cx,
cy,
radius 
)

Draws a filled circle.

Parameters
[in]cxThe horizontal position of the center of the circle.
[in]cyThe vertical position of the center of the circle.
[in]radiusThe radius of the circle.

=== Midpoint circle algorithm ===

Definition at line 266 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::fillEllipse ( cx,
cy,
a,
b 
)

Draws a filled ellipse.

Parameters
[in]cxThe horizontal position of the center of the ellipse.
[in]cyThe vertical position of the center of the ellipse.
[in]aThe parameters a of the ellipse.
[in]bThe parameters b of the ellipse.

=== Midpoint ellipse algorithm ===

Definition at line 290 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::fillRect ( x0,
y0,
x1,
y1 
)

Draws a filled rectangle.

Parameters
[in]x0The horizontal position of the left-top vertex.
[in]y0The vertical position of the left-top vertex.
[in]x1The horizontal position of the right-bottom vertex.
[in]y1The vertical position of the right-bottom vertex.

Definition at line 242 of file designer-inl.hpp.

template<typename T , typename C , uint8_t N>
font::base & rpihw::designer< T, C, N >::getFont ( ) const
inline

Returns the current text font.

Returns
The text font.

Definition at line 79 of file designer-inl.hpp.

template<typename T , typename C , uint8_t N>
const std::vector< C > & rpihw::designer< T, C, N >::getPenColor ( ) const
inline

Gets the current pen color.

Returns
The pointer to the color data.

Definition at line 54 of file designer-inl.hpp.

template<typename T , typename C , uint8_t N>
void rpihw::designer< T, C, N >::setFont ( font::base font)
inline

Sets the text font.

Parameters
[in]fontThe new text font.

Definition at line 71 of file designer-inl.hpp.

template<typename T , typename C, uint8_t N>
void rpihw::designer< T, C, N >::setPenColor ( const std::vector< C > &  color)
inline

Sets the pen color.

Parameters
[in]colorA pointer to the color data.

Definition at line 46 of file designer-inl.hpp.

template<typename T, typename C , uint8_t N>
void rpihw::designer< T, C, N >::setPenPosition ( x,
y 
)
virtual

Sets the pen position.

Parameters
[in]xThe new horizontal pen position.
[in]yThe new vertical pen position.

Definition at line 62 of file designer-inl.hpp.


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