|
| GraphicsPrinter () |
| Constructor.
|
|
void | init (unsigned width, unsigned height, unsigned pitch) |
| Initialize printer with actual screen dimensions.
|
|
void | buffer (void *lfb) |
| Set the video memory address.
|
|
void | clear () |
| Clear all pixel of the current back buffer (set full screen to black)
|
|
bool | valid (const Point &p) const |
| Check if a Point can be displayed at the current resolution.
|
|
unsigned | height () const |
| Number of vertical pixels in current resolution.
|
|
unsigned | width () const |
| Number of horizontal pixels in current resolution.
|
|
void | pixel (const Point &p, const Color &color) |
| Draw a pixel.
|
|
void | pixel (const Point &p, const ColorAlpha &color) |
| Draw a pixel.
|
|
void | line (const Point &start, const Point &end, const Color &color) |
| Draw a line.
|
|
void | line (const Point &start, const Point &end, const ColorAlpha &color) |
| Draw a line.
|
|
void | rectangle (const Point &start, const Point &end, const Color &color, bool filled) |
| Draw a rectangle on the current back buffer.
|
|
void | rectangle (const Point &start, const Point &end, const ColorAlpha &color, bool filled) |
| Draw a rectangle on the current back buffer.
|
|
void | font (const Font &new_font) |
| Change the current font for text output in video mode.
|
|
void | text (const Point &p, const char *string, unsigned len, const Color &color, const Font *font) |
| Print text (without automatic word wrap).
|
|
void | text (const Point &p, const char *string, unsigned len, const ColorAlpha &color, const Font *font) |
| Print text (without automatic word wrap).
|
|
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)
|
|
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)
|
|
void | image (const Point &p, const Color *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0) |
| Draw a sprite.
|
|
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).
|
|
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).
|
|
|
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.
|
|
void | init (const unsigned width, const unsigned height, const unsigned pitch) |
| Initialize screen dimensions.
|
|
void | buffer (void *lfb) |
| Set the video memory address.
|
|
void | clear () |
| Clear all pixel of the current back buffer (set full screen to black)
|
|
Pixel * | get (const unsigned x, const unsigned y) const |
| Get pixel at position.
|
|
Pixel * | get (const Point &p) const |
| Get pixel at position.
|
|
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.
|
|
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.
|
|
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.
|
|
|
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)
|
|
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS> |
void | pixel (const Point &p, const SpritePixel< COLOR, ALPHA, BITS > &color) |
| Draw a pixel.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
bool | valid (const int x, const int y) const |
| Check if a Point can be displayed at the current resolution.
|
|
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 |