v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Static Public Attributes | List of all members
Sifteo::Colormap Struct Reference

An accessor for the colormap, with up to 16 colors. More...

#include <sifteo/video/color.h>

Public Member Functions

CubeID cube () const
 Return the CubeID associated with this drawable.
 
void erase ()
 Clear the palette to black.
 
void fill (RGB565 color)
 Splat the given color across all colormap slots.
 
ColormapSlot operator[] (unsigned index)
 Return a ColormapSlot which references a single colormap entry on a single VideoBuffer. More...
 
void set (const RGB565 *colors)
 Set the entire palette, given an array of exactly 16 RGB565 values.
 
void setEGA ()
 Set the entire palette to the traditional EGA 16-color palette. More...
 
void setMono (RGB565 color0, RGB565 color1)
 Set a monochrome palette, in entries [0] and [1]. More...
 
void setMono (uint32_t color0, uint32_t color1)
 Set a monochrome palette, in entries [0] and [1]. More...
 
void setRange (const RGB565 *colors, unsigned firstColor, unsigned numColors)
 Set a range of colormap values, given an array of RGB565 values.
 
_SYSVideoBuffer & videoBuffer ()
 Return the VideoBuffer associated with this drawable.
 

Static Public Attributes

static const unsigned NUM_COLORS = 16
 Maximum number of colors in the colormap.
 

Detailed Description

An accessor for the colormap, with up to 16 colors.

This colormap is used by the SOLID_MODE, FB32, FB64, and FB128 modes.

Colors are stored in 16-bit RGB565 format.

Note that, due to details of the radio compression protocol, even-numbered colormap indices will compress better in the FB32 mode. This means it can give better performance if you allocate the most common color values to even-numbered slots.

Member Function Documentation

ColormapSlot Sifteo::Colormap::operator[] ( unsigned  index)
inline

Return a ColormapSlot which references a single colormap entry on a single VideoBuffer.

You don't need to store this reference typically; for example:

vbuf.colormap[16].set(1.f, 0.f, 0.f);
void Sifteo::Colormap::setEGA ( )
inline

Set the entire palette to the traditional EGA 16-color palette.

http://en.wikipedia.org/wiki/Enhanced_Graphics_Adapter#Color_palette

void Sifteo::Colormap::setMono ( RGB565  color0,
RGB565  color1 
)
inline

Set a monochrome palette, in entries [0] and [1].

This is common in the two-color modes, FB64 and FB128.

void Sifteo::Colormap::setMono ( uint32_t  color0,
uint32_t  color1 
)
inline

Set a monochrome palette, in entries [0] and [1].

This is common in the two-color modes, FB64 and FB128.

Colors are specified as packed RGB values, in the format 0xRRGGBB.


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