StuBS
GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE > Class Template Reference

Actual implementation of basic graphics printing functions. More...

#include <printer.h>

Inheritance diagram for GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >:
Collaboration diagram for GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >:

Public Member Functions

 GraphicsPrinter ()
 Constructor.
 
void init (unsigned width, unsigned height, unsigned pitch)
 Initialize printer with actual screen dimensions. More...
 
void buffer (void *lfb)
 Set the video memory address. More...
 
void clear ()
 Clear all pixel of the current back buffer (set full screen to black) More...
 
bool valid (const Point &p) const
 Check if a Point can be displayed at the current resolution. More...
 
unsigned height () const
 Number of vertical pixels in current resolution. More...
 
unsigned width () const
 Number of horizontal pixels in current resolution. More...
 
void pixel (const Point &p, const Color &color)
 Draw a pixel. More...
 
void pixel (const Point &p, const ColorAlpha &color)
 Draw a pixel. More...
 
void line (const Point &start, const Point &end, const Color &color)
 Draw a line. More...
 
void line (const Point &start, const Point &end, const ColorAlpha &color)
 Draw a line. More...
 
void rectangle (const Point &start, const Point &end, const Color &color, bool filled)
 Draw a rectangle on the current back buffer. More...
 
void rectangle (const Point &start, const Point &end, const ColorAlpha &color, bool filled)
 Draw a rectangle on the current back buffer. More...
 
void font (const Font &new_font)
 Change the current font for text output in video mode. More...
 
void text (const Point &p, const char *string, unsigned len, const Color &color, const Font *font)
 Print text (without automatic word wrap). More...
 
void text (const Point &p, const char *string, unsigned len, const ColorAlpha &color, const Font *font)
 Print text (without automatic word wrap). More...
 
void image (const Point &p, PNG &image, unsigned width=0, unsigned height=0, unsigned offset_x=0, unsigned offset_y=0)
 Draw a PNG image (or detail) More...
 
void image (const Point &p, const GIMP &image, unsigned width=0, unsigned height=0, unsigned offset_x=0, unsigned offset_y=0)
 Draw a GIMP image (or detail) More...
 
void image (const Point &p, const Color *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0)
 Draw a sprite. More...
 
void image (const Point &p, const ColorAlpha *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0)
 Draw a sprite with alpha blending (transparency). More...
 

Protected Member Functions

bool checkMode (uint8_t required_COLORDEPTH, uint8_t required_red_offset, uint8_t required_green_offset, uint8_t required_blue_offset, uint8_t required_red_size, uint8_t required_green_size, uint8_t required_blue_size)
 Check if a printer is available for a video mode. More...
 
- Protected Member Functions inherited from Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >
void init (const unsigned width, const unsigned height, const unsigned pitch)
 Initialize screen dimensions. More...
 
void buffer (void *lfb)
 Set the video memory address. More...
 
void clear ()
 Clear all pixel of the current back buffer (set full screen to black)
 
Pixelget (const unsigned x, const unsigned y) const
 Get pixel at position. More...
 
Pixelget (const Point &p) const
 Get pixel at position. More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void set (const unsigned x, const unsigned y, const SpritePixel< COLOR, ALPHA, BITS > &color)
 Assign color to a pixel at a given position. More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void set (const Point &p, const SpritePixel< COLOR, ALPHA, BITS > &color)
 Assign color to a pixel at a given position. More...
 

Private Member Functions

template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITDEPTH>
void sprite (Point p, const struct SpritePixel< COLOR, ALPHA, BITDEPTH > *image, unsigned width, unsigned height, unsigned image_width, unsigned offset_x=0, unsigned offset_y=0)
 Generic helper function to draw a sprite image (or detail) More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void pixel (const Point &p, const SpritePixel< COLOR, ALPHA, BITS > &color)
 Draw a pixel. More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void line (const Point &start, const Point &end, const SpritePixel< COLOR, ALPHA, BITS > &color)
 Draw a line. More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void rectangle (const Point &start, const Point &end, const SpritePixel< COLOR, ALPHA, BITS > &color, bool filled)
 Draw a rectangle on the current back buffer. More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void bitmap (const Point &p, const void *bitmap, const unsigned width, const unsigned height, const SpritePixel< COLOR, ALPHA, BITS > &color)
 Helper function to draw a font pixel image detail. More...
 
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void text (const Point &p, const char *string, unsigned len, const SpritePixel< COLOR, ALPHA, BITS > &color, const Font *font)
 Helper function to print text. More...
 
bool valid (const int x, const int y) const
 Check if a Point can be displayed at the current resolution. More...
 

Private Attributes

Font const * active_font
 currently active font
 

Additional Inherited Members

- Protected Attributes inherited from Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >
unsigned screen_width
 Visible width of the screen.
 
unsigned screen_height
 Visible height of the screen.
 

Detailed Description

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
class GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >

Actual implementation of basic graphics printing functions.

The implementation as template class requires the definition of the desired video mode during compile time (which is required anyways since the video mode is set in the Multiboot headers). Hence, the compiler is able to optimize the (intensively used) code for the actual color bit masks, which results in high performance gain.

Template Parameters
COLORDEPTHcolor depth of video mode
OFFSET_REDBit position of red color mask in video mode
OFFSET_GREENBit position of green color mask in video mode
OFFSET_BLUEBit position of blue color mask in video mode
BITS_REDSize of red color mask in video mode
BITS_GREENSize of green color mask in video mode
BITS_BLUESize of blue color mask in video mode

Member Function Documentation

◆ bitmap()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::bitmap ( const Point p,
const void *  bitmap,
const unsigned  width,
const unsigned  height,
const SpritePixel< COLOR, ALPHA, BITS > &  color 
)
inlineprivate

Helper function to draw a font pixel image detail.

See also
text
Parameters
pCoordinate of the images upper left corner
bitmapFont character bitmap source to display
widthWidth of the font
heightHeight of the font
colorColor for the character

◆ buffer()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::buffer ( void *  lfb)
inlinevirtual

Set the video memory address.

Parameters
lfbpointer to the linear framebuffer (lfb)

Implements AbstractGraphicsPrinter.

◆ checkMode()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
bool GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::checkMode ( uint8_t  required_COLORDEPTH,
uint8_t  required_red_offset,
uint8_t  required_green_offset,
uint8_t  required_blue_offset,
uint8_t  required_red_size,
uint8_t  required_green_size,
uint8_t  required_blue_size 
)
inlineprotectedvirtual

Check if a printer is available for a video mode.

This is required since printers are defined during compile time for performance reasons.

Template Parameters
colordepthcolor depth of video mode
offset_redBit position of red color mask in video mode
offset_greenBit position of green color mask in video mode
offset_blueBit position of blue color mask in video mode
bits_redSize of red color mask in video mode
bits_greenSize of green color mask in video mode
bits_blueSize of blue color mask in video mode
Returns
true if a printer for the video mode is available

Implements AbstractGraphicsPrinter.

◆ clear()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::clear ( )
inlinevirtual

Clear all pixel of the current back buffer (set full screen to black)

Implements AbstractGraphicsPrinter.

◆ font()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::font ( const Font new_font)
inlinevirtual

Change the current font for text output in video mode.

Parameters
new_fontFont to be used on subsequent calls to AbstractGraphicsPrinter::text() (without explicit font parameter)

Implements AbstractGraphicsPrinter.

◆ height()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
unsigned GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::height ( ) const
inlinevirtual

Number of vertical pixels in current resolution.

Returns
Height of the screen in current video mode

Implements AbstractGraphicsPrinter.

◆ image() [1/4]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::image ( const Point p,
const Color *  image,
unsigned  width,
unsigned  height,
unsigned  offset_x = 0,
unsigned  offset_y = 0 
)
inlinevirtual

Draw a sprite.

Each element in the source array will be displayed as a single pixel.

Parameters
pCoordinate of the sprites upper left corner
imageSource sprite to display
widthWidth of the sprite detail
heightHeight of the sprite detail
offset_xRight offset of the source sprite
offset_yTop offset of the source sprite

Implements AbstractGraphicsPrinter.

◆ image() [2/4]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::image ( const Point p,
const ColorAlpha *  image,
unsigned  width,
unsigned  height,
unsigned  offset_x = 0,
unsigned  offset_y = 0 
)
inlinevirtual

Draw a sprite with alpha blending (transparency).

Each element in the source array will be displayed as a single pixel.

Parameters
pCoordinate of the sprites upper left corner
imageSource sprite to display
widthWidth of the sprite detail
heightHeight of the sprite detail
offset_xRight offset of the source sprite
offset_yTop offset of the source sprite

Implements AbstractGraphicsPrinter.

◆ image() [3/4]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::image ( const Point p,
const GIMP image,
unsigned  width = 0,
unsigned  height = 0,
unsigned  offset_x = 0,
unsigned  offset_y = 0 
)
inlinevirtual

Draw a GIMP image (or detail)

The image has to be exported as C-source (without Glib types!) in GIMP, alpha blending (transparency) is supported.

Parameters
pCoordinate of the images upper left corner
imageSource image to display
widthWidth of the image detail (full image width of the source image if zero/default value)
heightHeight of the image detail (full image height of the source if zero/default value)
offset_xRight offset of the source image
offset_yTop offset of the source image

Implements AbstractGraphicsPrinter.

◆ image() [4/4]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::image ( const Point p,
PNG image,
unsigned  width = 0,
unsigned  height = 0,
unsigned  offset_x = 0,
unsigned  offset_y = 0 
)
inlinevirtual

Draw a PNG image (or detail)

The image can has to be in a supported PNG format. Alpha blending (transparency) is supported.

Parameters
pCoordinate of the images upper left corner
imageSource image to display
widthWidth of the image detail (full image width of the source image if zero/default value)
heightHeight of the image detail (full image height of the source if zero/default value)
offset_xRight offset of the source image
offset_yTop offset of the source image

Implements AbstractGraphicsPrinter.

◆ init()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::init ( unsigned  width,
unsigned  height,
unsigned  pitch 
)
inlinevirtual

Initialize printer with actual screen dimensions.

Parameters
widthvisible width of graphics screen
heightvisible height of graphics screen
pitchwidth of graphics screen (including invisible part, has to be at least width)

Implements AbstractGraphicsPrinter.

◆ line() [1/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::line ( const Point start,
const Point end,
const Color &  color 
)
inlinevirtual

Draw a line.

Parameters
startCoordinates of the begin of the line
endCoordinates of the end of the line
colorColor of the line

Implements AbstractGraphicsPrinter.

◆ line() [2/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::line ( const Point start,
const Point end,
const ColorAlpha &  color 
)
inlinevirtual

Draw a line.

Parameters
startCoordinates of the begin of the line
endCoordinates of the end of the line
colorColor of the line

Implements AbstractGraphicsPrinter.

◆ line() [3/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::line ( const Point start,
const Point end,
const SpritePixel< COLOR, ALPHA, BITS > &  color 
)
inlineprivate

Draw a line.

Parameters
startCoordinates of the begin of the line
endCoordinates of the end of the line
colorColor of the line

◆ pixel() [1/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::pixel ( const Point p,
const Color &  color 
)
inlinevirtual

Draw a pixel.

Parameters
pCoordinates of the pixel
colorColor of the pixel

Implements AbstractGraphicsPrinter.

◆ pixel() [2/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::pixel ( const Point p,
const ColorAlpha &  color 
)
inlinevirtual

Draw a pixel.

Parameters
pCoordinates of the pixel
colorColor of the pixel

Implements AbstractGraphicsPrinter.

◆ pixel() [3/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::pixel ( const Point p,
const SpritePixel< COLOR, ALPHA, BITS > &  color 
)
inlineprivate

Draw a pixel.

Parameters
pCoordinates of the pixel
colorColor of the pixel

◆ rectangle() [1/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::rectangle ( const Point start,
const Point end,
const Color &  color,
bool  filled 
)
inlinevirtual

Draw a rectangle on the current back buffer.

Parameters
startCoordinate of the rectangles upper left corner
endCoordinate of the rectangles lower right corner
colorColor of the rectangle
filledIf set, the rectangle will be filled with the same color. (otherwise only borders will be drawn)

Implements AbstractGraphicsPrinter.

◆ rectangle() [2/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::rectangle ( const Point start,
const Point end,
const ColorAlpha &  color,
bool  filled 
)
inlinevirtual

Draw a rectangle on the current back buffer.

Parameters
startCoordinate of the rectangles upper left corner
endCoordinate of the rectangles lower right corner
colorColor of the rectangle
filledIf set, the rectangle will be filled with the same color. (otherwise only borders will be drawn)

Implements AbstractGraphicsPrinter.

◆ rectangle() [3/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::rectangle ( const Point start,
const Point end,
const SpritePixel< COLOR, ALPHA, BITS > &  color,
bool  filled 
)
inlineprivate

Draw a rectangle on the current back buffer.

Parameters
startCoordinate of the rectangles upper left corner
endCoordinate of the rectangles lower right corner
colorColor of the rectangle
filledIf set, the rectangle will be filled with the same color. (otherwise only borders will be drawn)

◆ sprite()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITDEPTH>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::sprite ( Point  p,
const struct SpritePixel< COLOR, ALPHA, BITDEPTH > *  image,
unsigned  width,
unsigned  height,
unsigned  image_width,
unsigned  offset_x = 0,
unsigned  offset_y = 0 
)
inlineprivate

Generic helper function to draw a sprite image (or detail)

Parameters
pCoordinate of the images upper left corner
imageSource image to display
widthWidth of the image detail
heightHeight of the image detail image_width
offset_xRight offset of the source image
offset_yTop offset of the source image

◆ text() [1/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::text ( const Point p,
const char *  string,
unsigned  len,
const Color &  color,
const Font font 
)
inlinevirtual

Print text (without automatic word wrap).

Parameters
pUpper left start position of the text
stringPointer to char array containing the text to be displayed
lenNumber of characters to be displayed
colorColor for the text characters
fontExplicit font – or nullptr to use default font (set by font method)

Implements AbstractGraphicsPrinter.

◆ text() [2/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::text ( const Point p,
const char *  string,
unsigned  len,
const ColorAlpha &  color,
const Font font 
)
inlinevirtual

Print text (without automatic word wrap).

Parameters
pUpper left start position of the text
stringPointer to char array containing the text to be displayed
lenNumber of characters to be displayed
colorColor for the text characters
fontExplicit font – or nullptr to use default font (set by font method)

Implements AbstractGraphicsPrinter.

◆ text() [3/3]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::text ( const Point p,
const char *  string,
unsigned  len,
const SpritePixel< COLOR, ALPHA, BITS > &  color,
const Font font 
)
inlineprivate

Helper function to print text.

Parameters
pUpper left start position of the text
stringPointer to char array containing the text to be displayed
lenNumber of characters to be displayed
colorColor for the text characters
fontExplicit font – or nullptr to use default font (set by font method)

◆ valid() [1/2]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
bool GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::valid ( const int  x,
const int  y 
) const
inlineprivate

Check if a Point can be displayed at the current resolution.

Parameters
xX position to check
yY position to check
Returns
'true' if can be displayed

◆ valid() [2/2]

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
bool GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::valid ( const Point p) const
inlinevirtual

Check if a Point can be displayed at the current resolution.

Parameters
pCoordinates to check
Returns
'true' if can be displayed

Implements AbstractGraphicsPrinter.

◆ width()

template<unsigned COLORDEPTH, uint8_t OFFSET_RED, uint8_t OFFSET_GREEN, uint8_t OFFSET_BLUE, uint8_t BITS_RED, uint8_t BITS_GREEN, uint8_t BITS_BLUE>
unsigned GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::width ( ) const
inlinevirtual

Number of horizontal pixels in current resolution.

Returns
Width of the screen in current video mode

Implements AbstractGraphicsPrinter.


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