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
-
COLORDEPTH | color depth of video mode |
OFFSET_RED | Bit position of red color mask in video mode |
OFFSET_GREEN | Bit position of green color mask in video mode |
OFFSET_BLUE | Bit position of blue color mask in video mode |
BITS_RED | Size of red color mask in video mode |
BITS_GREEN | Size of green color mask in video mode |
BITS_BLUE | Size of blue color mask in video mode |
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
-
colordepth | color depth of video mode |
offset_red | Bit position of red color mask in video mode |
offset_green | Bit position of green color mask in video mode |
offset_blue | Bit position of blue color mask in video mode |
bits_red | Size of red color mask in video mode |
bits_green | Size of green color mask in video mode |
bits_blue | Size of blue color mask in video mode |
- Returns
true
if a printer for the video mode is available
Implements AbstractGraphicsPrinter.
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
-
p | Coordinate of the sprites upper left corner |
image | Source sprite to display |
width | Width of the sprite detail |
height | Height of the sprite detail |
offset_x | Right offset of the source sprite |
offset_y | Top offset of the source sprite |
Implements AbstractGraphicsPrinter.
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
-
p | Coordinate of the sprites upper left corner |
image | Source sprite to display |
width | Width of the sprite detail |
height | Height of the sprite detail |
offset_x | Right offset of the source sprite |
offset_y | Top offset of the source sprite |
Implements AbstractGraphicsPrinter.
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
-
p | Coordinate of the images upper left corner |
image | Source image to display |
width | Width of the image detail (full image width of the source image if zero/default value) |
height | Height of the image detail (full image height of the source if zero/default value) |
offset_x | Right offset of the source image |
offset_y | Top offset of the source image |
Implements AbstractGraphicsPrinter.
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
-
p | Coordinate of the images upper left corner |
image | Source image to display |
width | Width of the image detail (full image width of the source image if zero/default value) |
height | Height of the image detail (full image height of the source if zero/default value) |
offset_x | Right offset of the source image |
offset_y | Top offset of the source image |
Implements AbstractGraphicsPrinter.
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
-
width | visible width of graphics screen |
height | visible height of graphics screen |
pitch | width of graphics screen (including invisible part, has to be at least width ) |
Implements AbstractGraphicsPrinter.
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
-
start | Coordinate of the rectangles upper left corner |
end | Coordinate of the rectangles lower right corner |
color | Color of the rectangle |
filled | If set, the rectangle will be filled with the same color. (otherwise only borders will be drawn) |
Implements AbstractGraphicsPrinter.
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
-
start | Coordinate of the rectangles upper left corner |
end | Coordinate of the rectangles lower right corner |
color | Color of the rectangle |
filled | If set, the rectangle will be filled with the same color. (otherwise only borders will be drawn) |
Implements AbstractGraphicsPrinter.
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
-
p | Upper left start position of the text |
string | Pointer to char array containing the text to be displayed |
len | Number of characters to be displayed |
color | Color for the text characters |
font | Explicit font – or nullptr to use default font (set by font method) |
Implements AbstractGraphicsPrinter.
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
-
p | Upper left start position of the text |
string | Pointer to char array containing the text to be displayed |
len | Number of characters to be displayed |
color | Color for the text characters |
font | Explicit font – or nullptr to use default font (set by font method) |
Implements AbstractGraphicsPrinter.