Implementation of primitive operations on a memory area used as framebuffer.
More...
#include <graphics/framebuffer.h>
|
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)
|
|
Pixel * | get (const unsigned x, const unsigned y) const |
| Get pixel at position. More...
|
|
Pixel * | get (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...
|
|
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
class Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >
Implementation of primitive operations on a memory area used as framebuffer.
The implementation as template class allows the compiler to heavily optimize the bit operations depending on the video mode.
- 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 |
◆ Framebuffer::Pixel.__unnamed__
struct Framebuffer::Pixel.__unnamed__ |
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
struct Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::Pixel.__unnamed__
Bits per pixel.
Class Members |
unsigned |
data: COLORDEPTH |
RGB value. |
◆ init()
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
void Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::init |
( |
const unsigned |
width, |
|
|
const unsigned |
height, |
|
|
const unsigned |
pitch |
|
) |
| |
|
inlineprotected |
Initialize 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 ) |
◆ buffer()
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
void Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::buffer |
( |
void * |
lfb | ) |
|
|
inlineprotected |
Set the video memory address.
- Parameters
-
lfb | pointer to the linear framebuffer (lfb) |
◆ get() [1/2]
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
Pixel* Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::get |
( |
const unsigned |
x, |
|
|
const unsigned |
y |
|
) |
| const |
|
inlineprotected |
Get pixel at position.
- Parameters
-
- Returns
- Pointer to pixel
◆ get() [2/2]
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
Pixel* Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::get |
( |
const Point & |
p | ) |
const |
|
inlineprotected |
Get pixel at position.
- Parameters
-
- Returns
- Pointer to pixel
◆ set() [1/2]
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::set |
( |
const unsigned |
x, |
|
|
const unsigned |
y, |
|
|
const SpritePixel< COLOR, ALPHA, BITS > & |
color |
|
) |
| |
|
inlineprotected |
Assign color to a pixel at a given position.
- Template Parameters
-
COLOR | color or greyscale? |
ALPHA | with transparency? |
BITS | Size of mask |
- Parameters
-
x | X position |
y | Y position |
color | color to assign |
◆ set() [2/2]
template<unsigned char COLORDEPTH, unsigned char OFFSET_RED, unsigned char OFFSET_GREEN, unsigned char OFFSET_BLUE, unsigned char BITS_RED, unsigned char BITS_GREEN, unsigned char BITS_BLUE>
template<enum SpriteColorMode COLOR, bool ALPHA, unsigned BITS>
void Framebuffer< COLORDEPTH, OFFSET_RED, OFFSET_GREEN, OFFSET_BLUE, BITS_RED, BITS_GREEN, BITS_BLUE >::set |
( |
const Point & |
p, |
|
|
const SpritePixel< COLOR, ALPHA, BITS > & |
color |
|
) |
| |
|
inlineprotected |
Assign color to a pixel at a given position.
- Template Parameters
-
COLOR | color or greyscale? |
ALPHA | with transparency? |
BITS | Size of mask |
- Parameters
-
p | Coordinate of position |
color | color to assign |
The documentation for this class was generated from the following file: