StuBS
|
Abstraction of basic graphics printing functions. More...
#include <printer.h>
Public Member Functions | |
virtual void | init (unsigned width, unsigned height, unsigned pitch)=0 |
Initialize printer with actual screen dimensions. | |
virtual void | buffer (void *lfb)=0 |
Set the video memory address. | |
virtual void | clear ()=0 |
Clear all pixel of the current back buffer (set full screen to black) | |
virtual bool | valid (const Point &p) const =0 |
Check if a Point can be displayed at the current resolution. | |
virtual unsigned | height () const =0 |
Number of vertical pixels in current resolution. | |
virtual unsigned | width () const =0 |
Number of horizontal pixels in current resolution. | |
virtual void | pixel (const Point &p, const Color &color)=0 |
Draw a pixel. | |
virtual void | pixel (const Point &p, const ColorAlpha &color)=0 |
Draw a pixel. | |
virtual void | line (const Point &start, const Point &end, const Color &color)=0 |
Draw a line. | |
virtual void | line (const Point &start, const Point &end, const ColorAlpha &color)=0 |
Draw a line. | |
virtual void | rectangle (const Point &start, const Point &end, const Color &color, bool filled=true)=0 |
Draw a rectangle on the current back buffer. | |
virtual void | rectangle (const Point &start, const Point &end, const ColorAlpha &color, bool filled=true)=0 |
Draw a rectangle on the current back buffer. | |
virtual void | font (const Font &new_font)=0 |
Change the current font for text output in video mode. | |
virtual void | text (const Point &p, const char *string, unsigned len, const Color &color, const Font *font=nullptr)=0 |
Print text (without automatic word wrap). | |
virtual void | text (const Point &p, const char *string, unsigned len, const ColorAlpha &color, const Font *font=nullptr)=0 |
Print text (without automatic word wrap). | |
virtual void | image (const Point &p, PNG &image, unsigned width=0, unsigned height=0, unsigned offset_x=0, unsigned offset_y=0)=0 |
Draw a PNG image (or detail) | |
virtual void | image (const Point &p, const GIMP &image, unsigned width=0, unsigned height=0, unsigned offset_x=0, unsigned offset_y=0)=0 |
Draw a GIMP image (or detail) | |
virtual void | image (const Point &p, const Color *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0)=0 |
Draw a sprite. | |
virtual void | image (const Point &p, const ColorAlpha *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0)=0 |
Draw a sprite with alpha blending (transparency). | |
Protected Member Functions | |
virtual bool | checkMode (uint8_t 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)=0 |
Check if a printer is available for a video mode. | |
Abstraction of basic graphics printing functions.
The actual implementation is placed in the inherited template class GraphicsPrinter for performance reasons.
|
pure virtual |
Set the video memory address.
lfb | pointer to the linear framebuffer (lfb) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
protectedpure virtual |
Check if a printer is available for a video mode.
This is required since printers are defined during compile time for performance reasons.
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 |
true
if a printer for the video mode is available Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Change the current font for text output in video mode.
new_font | Font to be used on subsequent calls to AbstractGraphicsPrinter::text() (without explicit font parameter) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Number of vertical pixels in current resolution.
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a sprite.
Each element in the source array will be displayed as a single pixel.
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 |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a sprite with alpha blending (transparency).
Each element in the source array will be displayed as a single pixel.
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 |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
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.
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 |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a PNG image (or detail)
The image can has to be in a supported PNG format. Alpha blending (transparency) is supported.
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 |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Initialize printer with actual screen dimensions.
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 ) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a line.
start | Coordinates of the begin of the line |
end | Coordinates of the end of the line |
color | Color of the line |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a line.
start | Coordinates of the begin of the line |
end | Coordinates of the end of the line |
color | Color of the line |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a pixel.
p | Coordinates of the pixel |
color | Color of the pixel |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a pixel.
p | Coordinates of the pixel |
color | Color of the pixel |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a rectangle on the current back buffer.
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) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Draw a rectangle on the current back buffer.
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) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Print text (without automatic word wrap).
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) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Print text (without automatic word wrap).
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) |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Check if a Point can be displayed at the current resolution.
p | Coordinates to check |
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.
|
pure virtual |
Number of horizontal pixels in current resolution.
Implemented in GraphicsPrinter< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >.