v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel > Struct Template Reference

A templatized VRAM accessor for drawing pixel graphics, in one of the cube's supported framebuffer drawing modes. More...

#include <sifteo/video/framebuffer.h>

Public Member Functions

void bitmap (UInt2 topLeft, UInt2 size, const uint8_t *data, unsigned stride)
 Draw a packed-pixel bitmap, of the same color depth as this framebuffer mode. More...
 
void bitmapSpan (UInt2 pos, unsigned width, const uint8_t *data)
 Draw a span of pixels from a packed-pixel bitmap, of the same color depth as this framebuffer mode. More...
 
CubeID cube () const
 Return the CubeID associated with this drawable.
 
void fill (UInt2 topLeft, UInt2 size, unsigned colorIndex)
 Fill a rectangle of pixels, specified as a top-left corner location and a size. More...
 
void fill (unsigned colorIndex)
 Fill the entire framebuffer with a specific color index.
 
void plot (UInt2 pos, unsigned colorIndex)
 Plot a single pixel, at the specified location. More...
 
void set (const uint16_t *data)
 Draw a pre-formatted bitmap to this framebuffer. More...
 
void span (UInt2 pos, unsigned width, unsigned colorIndex)
 Plot a horizontal span of pixels, given the position of the leftmost pixel, and the number of pixels to plot. More...
 
_SYSVideoBuffer & videoBuffer ()
 Return the VideoBuffer associated with this drawable.
 

Static Public Member Functions

static unsigned bitsPerPixel ()
 Returns the number of bits per pixel this framebuffer mode uses to store color indices.
 
static uint16_t expand16 (unsigned colorIndex)
 Given a single color index, return an expanded version where the single color has been replicated to fill a 16-bit word. More...
 
static unsigned height ()
 Return the height, in pixels, of this mode.
 
static unsigned numColors ()
 Return the total number of colors this mode supports. This is equal to the number of colormap entries used by the mode.
 
static UInt2 size ()
 Return the size of this mode as a vector, in pixels.
 
static unsigned sizeInBytes ()
 Returns the size of this framebuffer's data, in bytes.
 
static unsigned sizeInWords ()
 Returns the size of this framebuffer's data, in 16-bit words.
 
static unsigned width ()
 Return the width, in pixels, of this mode.
 

Detailed Description

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
struct Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >

A templatized VRAM accessor for drawing pixel graphics, in one of the cube's supported framebuffer drawing modes.

FBDrawable is a template which is parameterized for each of the supported video modes. Normally, you'll access these specific FBDrawable instances via a VideoBuffer's fb32, fb64, and fb128 members.

Member Function Documentation

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
void Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::bitmap ( UInt2  topLeft,
UInt2  size,
const uint8_t *  data,
unsigned  stride 
)
inline

Draw a packed-pixel bitmap, of the same color depth as this framebuffer mode.

The destination rectangle is specified as a top-left corner and size, both in pixels.

The bitmap does not need any special alignment. The source bitmap stride is specified in bytes.

All coordinates must be in range. This function performs no clipping.

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
void Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::bitmapSpan ( UInt2  pos,
unsigned  width,
const uint8_t *  data 
)
inline

Draw a span of pixels from a packed-pixel bitmap, of the same color depth as this framebuffer mode.

All coordinates must be in range. This function performs no clipping.

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
static uint16_t Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::expand16 ( unsigned  colorIndex)
inlinestatic

Given a single color index, return an expanded version where the single color has been replicated to fill a 16-bit word.

This can be used to implement fills, since VideoBuffers operate in units of 16 bits at a time.

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
void Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::fill ( UInt2  topLeft,
UInt2  size,
unsigned  colorIndex 
)
inline

Fill a rectangle of pixels, specified as a top-left corner location and a size.

All coordinates must be in range. This function performs no clipping.

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
void Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::plot ( UInt2  pos,
unsigned  colorIndex 
)
inline

Plot a single pixel, at the specified location.

Locations are specified in pixels, with (0,0) at the top-left corner, +X to the right, and +Y down.

The pixel coordinates must be in range. This call does not perform any clipping.

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
void Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::set ( const uint16_t *  data)
inline

Draw a pre-formatted bitmap to this framebuffer.

The bitmap must already be in the proper format, and it must be 16-bit-aligned.

template<unsigned tWidth, unsigned tHeight, unsigned tBitsPerPixel>
void Sifteo::FBDrawable< tWidth, tHeight, tBitsPerPixel >::span ( UInt2  pos,
unsigned  width,
unsigned  colorIndex 
)
inline

Plot a horizontal span of pixels, given the position of the leftmost pixel, and the number of pixels to plot.

All coordinates must be in range. This function performs no clipping.


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