IBuffer< BufferBaseClass > Class Template Reference

#include <IBuffer.h>

List of all members.

Public Member Functions

 IBuffer (void)
 IBuffer (unsigned int id, unsigned int nChannels=1)
 IBuffer (unsigned int id, unsigned int nChannels, unsigned int realWidth, unsigned int realHeight, unsigned int virtualWidth, unsigned int virtualHeight)
 ~IBuffer (void)
void init (unsigned int id=0, unsigned int nChannels=1, unsigned int realWidth=10, unsigned int realHeight=5, unsigned int virtualWidth=20, unsigned int virtualHeight=10)
void destroy (void)
void resize (unsigned int realWidth, unsigned int realHeight, unsigned int virtualWidth, unsigned int virtualHeight)
void resizeInterpolation (unsigned int realWidth, unsigned int realHeight, unsigned int virtualWidth, unsigned int virtualHeight)
void resizeCopy (unsigned int realWidth, unsigned int realHeight, unsigned int virtualWidth, unsigned int virtualHeight, BufferBaseClass *fillValue)
void resizeFill (unsigned int realWidth, unsigned int realHeight, unsigned int virtualWidth, unsigned int virtualHeight, BufferBaseClass *fillValue)
void clear (void)
void fill (BufferBaseClass value)
void fill (BufferBaseClass *values)
void fillQuad (unsigned int p0X, unsigned int p0Y, unsigned int p1X, unsigned int p1Y, unsigned int p2X, unsigned int p2Y, unsigned int p3X, unsigned int p3Y, BufferBaseClass value)
void fillQuad (unsigned int p0x, unsigned int p0y, unsigned int p1x, unsigned int p1y, unsigned int p2x, unsigned int p2y, unsigned int p3x, unsigned int p3y, BufferBaseClass *values, unsigned int n)
void fillQuad (unsigned int p0x, unsigned int p0y, BufferBaseClass v0, unsigned int p1x, unsigned int p1y, BufferBaseClass v1, unsigned int p2x, unsigned int p2y, BufferBaseClass v2, unsigned int p3x, unsigned int p3y, BufferBaseClass v3)
void fillQuad (unsigned int p0x, unsigned int p0y, BufferBaseClass *v0, unsigned int p1x, unsigned int p1y, BufferBaseClass *v1, unsigned int p2x, unsigned int p2y, BufferBaseClass *v2, unsigned int p3x, unsigned int p3y, BufferBaseClass *v3, unsigned int n)
void fillQuadWithLength (unsigned int p0x, unsigned int p0y, BufferBaseClass *v0, unsigned int p1x, unsigned int p1y, BufferBaseClass *v1, unsigned int p2x, unsigned int p2y, BufferBaseClass *v2, unsigned int p3x, unsigned int p3y, BufferBaseClass *v3, unsigned int n)
void fillVirtualQuad (unsigned int p0x, unsigned int p0y, unsigned int p1x, unsigned int p1y, unsigned int p2x, unsigned int p2y, unsigned int p3x, unsigned int p3y, BufferBaseClass value)
void fillVirtualQuad (unsigned int p0x, unsigned int p0y, unsigned int p1x, unsigned int p1y, unsigned int p2x, unsigned int p2y, unsigned int p3x, unsigned int p3y, BufferBaseClass *values, unsigned int n)
void fillVirtualQuad (unsigned int p0x, unsigned int p0y, BufferBaseClass v0, unsigned int p1x, unsigned int p1y, BufferBaseClass v1, unsigned int p2x, unsigned int p2y, BufferBaseClass v2, unsigned int p3x, unsigned int p3y, BufferBaseClass v3)
void fillVirtualQuad (unsigned int p0x, unsigned int p0y, BufferBaseClass *v0, unsigned int p1x, unsigned int p1y, BufferBaseClass *v1, unsigned int p2x, unsigned int p2y, BufferBaseClass *v2, unsigned int p3x, unsigned int p3y, BufferBaseClass *v3, unsigned int n)
void fillVirtualQuadWithLength (unsigned int p0x, unsigned int p0y, BufferBaseClass *v0, unsigned int p1x, unsigned int p1y, BufferBaseClass *v1, unsigned int p2x, unsigned int p2y, BufferBaseClass *v2, unsigned int p3x, unsigned int p3y, BufferBaseClass *v3, unsigned int n)
void fillPolygon (std::vector< std::pair< int, int > > points, BufferBaseClass value)
void fillPolygon (std::vector< std::pair< int, int > > points, BufferBaseClass *values)
void setVirtualValue (unsigned int x, unsigned int y, BufferBaseClass value)
void setVirtualValue (unsigned int x, unsigned int y, BufferBaseClass *values)
BufferBaseClass getVirtualValue (unsigned int x, unsigned int y)
void getVirtualValue (unsigned int x, unsigned int y, BufferBaseClass *values)
BufferBaseClass getVirtualValue (double x, double y)
void getVirtualValue (double x, double y, BufferBaseClass *values)
void setValue (unsigned int x, unsigned int y, BufferBaseClass value)
void setValue (unsigned int x, unsigned int y, BufferBaseClass *values)
void setValue (unsigned int x, unsigned int y, BufferBaseClass *values, const unsigned int n)
BufferBaseClass getValue (unsigned int x, unsigned int y)
void getValue (unsigned int x, unsigned int y, BufferBaseClass *values)
void getValue (unsigned int x, unsigned int y, BufferBaseClass *values, const unsigned int n)
bool isInsideVirtualBuffer (double x, double y)
bool isInsideActualBuffer (double x, double y)
void setId (unsigned int id)
unsigned int getId ()
unsigned int getNumberEntries (void)
unsigned int getWidth ()
unsigned int getHeight ()
unsigned int getActualWidth ()
unsigned int getActualHeight ()
unsigned int getNumberChannels ()
unsigned int getEntrySizeBytes (void)
unsigned long getAllocatedMemorySizeBytes (void)
unsigned long getAllocatedMemorySizeKBytes (void)
void print (void)
void createImage (const char *fileName, double factor=1.0, double offset=0.0)

Protected Member Functions

void setup (unsigned int realWidth, unsigned int realHeight, unsigned int virtualWidth, unsigned int virtualHeight)
void allocateMemory (void)
BufferBaseClass interpolateEntry (double x, double y)
void interpolateEntry (double x, double y, BufferBaseClass *values)
void calculateRealCoordinates (unsigned int x, unsigned int y, unsigned int &realX, unsigned int &realY)

Protected Attributes

BufferBaseClass * _buffer
BufferBaseClass ** _bufferLUT
unsigned int _realWidth
unsigned int _realHeight
unsigned int _virtualWidth
unsigned int _virtualHeight
unsigned int _nChannels
unsigned int _bytesPerChannel
unsigned int _nEntries
unsigned int _bytesPerEntry
unsigned int _nBytes
unsigned int _nChannelEntries
unsigned int _id


Detailed Description

template<class IBUFFERLAYER_API BufferBaseClass>
class IBuffer< BufferBaseClass >

This class is the template for an i-buffer. An i-buffer is a data structure that holds information regarding interaction aspects of an object. When several such buffers are combined and interactions are defined among them, complex behaviors can be achieved for components that make use of the buffers to determine their states. These buffers were originally created to speed up interaction in applications for large displays (such as the SmartTable and the SmartBoard) with a large number of components/widgets.

This class is refatored from the original version of the i-buffer written by T. Isenberg, A. Miede, and T. Zuk in the University of Calgary.

Author:
Fabricio Anastacio - fabriciocfa@yahoo.com
Since:
May 22, 2007


Constructor & Destructor Documentation

template<class BufferBaseClass>
IBuffer< BufferBaseClass >::IBuffer ( void   )  [inline]

Default constructor for the i-buffer.

template<class BufferBaseClass>
IBuffer< BufferBaseClass >::IBuffer ( unsigned int  id,
unsigned int  nChannels = 1 
) [inline]

Constructor for the i-buffer that takes the buffer id and, optionally, the number of channels as arguments.

Parameters:
id the id of the i-buffer being created.
nChannels the number of channels in each entry of the i-buffer.

template<class BufferBaseClass>
IBuffer< BufferBaseClass >::IBuffer ( unsigned int  id,
unsigned int  nChannels,
unsigned int  realWidth,
unsigned int  realHeight,
unsigned int  virtualWidth,
unsigned int  virtualHeight 
) [inline]

Constructor for the i-buffer that takes the buffer id, the number of channels, and the real and virtual dimensions as arguments.

Parameters:
id the id of the i-buffer being created
nChannels number of channels in each buffer entry
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer

template<class BufferBaseClass>
IBuffer< BufferBaseClass >::~IBuffer ( void   )  [inline]

Destructor for the i-buffer.


Member Function Documentation

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::init ( unsigned int  id = 0,
unsigned int  nChannels = 1,
unsigned int  realWidth = 10,
unsigned int  realHeight = 5,
unsigned int  virtualWidth = 20,
unsigned int  virtualHeight = 10 
) [inline]

Initializes the buffer with default values.

Parameters:
id the id of the i-buffer being created
nChannels number of channels in each buffer entry
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::destroy ( void   )  [inline]

Destroys this buffer.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::resize ( unsigned int  realWidth,
unsigned int  realHeight,
unsigned int  virtualWidth,
unsigned int  virtualHeight 
) [inline]

Sets the real and virtual dimensions of this buffer, (re-)allocating memory for it. When resizing, the values previously in the buffer are discarded and the new buffer entries have undefined values (garbage). The user should fill the buffer again in order to use it. The real dimensions are the dimensions of the actual buffers data structure and the virtual dimensions are the dimensions that the user "believes" the buffer is.

Parameters:
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer
Exceptions:
std::out_of_range when the interpolating indices fall out of the buffer bounds.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::resizeInterpolation ( unsigned int  realWidth,
unsigned int  realHeight,
unsigned int  virtualWidth,
unsigned int  virtualHeight 
) [inline]

Sets the real and virtual dimensions of this buffer, (re-)allocating memory for it. When resizing, the values previously in the buffer are interpolated to better fit in the new dimensions. The real dimensions are the dimensions of the actual buffers data structure and the virtual dimensions are the dimensions that the user "believes" the buffer is.

Parameters:
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer
Exceptions:
std::out_of_range when the interpolating indices fall out of the buffer bounds.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::resizeCopy ( unsigned int  realWidth,
unsigned int  realHeight,
unsigned int  virtualWidth,
unsigned int  virtualHeight,
BufferBaseClass *  fillValue 
) [inline]

Sets the real and virtual dimensions of this buffer, (re-)allocating memory for it. When resizing, the values previously in the buffer are kept and, if the new dimensions are bigger than the previous, the given filling value is used for the new area. The real dimensions are the dimensions of the actual buffers data structure and the virtual dimensions are the dimensions that the user "believes" the buffer is.

Parameters:
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer
fillValue the value to used to fill the new area, if the buffer is made bigger.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::resizeFill ( unsigned int  realWidth,
unsigned int  realHeight,
unsigned int  virtualWidth,
unsigned int  virtualHeight,
BufferBaseClass *  fillValue 
) [inline]

Sets the real and virtual dimensions of this buffer, (re-)allocating memory for it. When resizing, the values previously in the buffer are replaced by given filling value. The real dimensions are the dimensions of the actual buffers data structure and the virtual dimensions are the dimensions that the user "believes" the buffer is.

Parameters:
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer
fillValue the value to used to fill the new buffer.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::clear ( void   )  [inline]

Clears the buffer by setting all its entries to a default value.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fill ( BufferBaseClass  value  )  [inline]

Fills the buffer with the given value.

Parameters:
value the value to set to the whole buffer.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fill ( BufferBaseClass *  values  )  [inline]

Fills the buffer with the given values for each channel.

Parameters:
values the array of values to set to the whole multi-channel buffer.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillQuad ( unsigned int  p0X,
unsigned int  p0Y,
unsigned int  p1X,
unsigned int  p1Y,
unsigned int  p2X,
unsigned int  p2Y,
unsigned int  p3X,
unsigned int  p3Y,
BufferBaseClass  value 
) [inline]

Fills a quad region inside the buffer with the given value. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4).

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
value the value to be set inside the quad in the buffer.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillQuad ( unsigned int  p0x,
unsigned int  p0y,
unsigned int  p1x,
unsigned int  p1y,
unsigned int  p2x,
unsigned int  p2y,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass *  values,
unsigned int  n 
) [inline]

Fills a quad region inside the buffer with the given value. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4). This methods takes the number of channels as parameter to avoid accessing a class variable to speed up processing.

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
values the array of channel values to be set inside the quad in the buffer.
n the number of channels in the buffer (to speed things up)

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillQuad ( unsigned int  p0x,
unsigned int  p0y,
BufferBaseClass  v0,
unsigned int  p1x,
unsigned int  p1y,
BufferBaseClass  v1,
unsigned int  p2x,
unsigned int  p2y,
BufferBaseClass  v2,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass  v3 
) [inline]

Fills a quad region inside the buffer by interploating the given values. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4).

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
v0 the value of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
v1 the value of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
v2 the value of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
v3 the value of the fourth point in the quad.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillQuad ( unsigned int  p0x,
unsigned int  p0y,
BufferBaseClass *  v0,
unsigned int  p1x,
unsigned int  p1y,
BufferBaseClass *  v1,
unsigned int  p2x,
unsigned int  p2y,
BufferBaseClass *  v2,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass *  v3,
unsigned int  n 
) [inline]

Fills a quad region inside the buffer by interploating the given values. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4). This methods takes the number of channels as parameter to avoid accessing a class variable to speed up processing.

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
v0 the value of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
v1 the value of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
v2 the value of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
v3 the value of the fourth point in the quad.
n the number of channels in the buffer (to speed things up)

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillQuadWithLength ( unsigned int  p0x,
unsigned int  p0y,
BufferBaseClass *  v0,
unsigned int  p1x,
unsigned int  p1y,
BufferBaseClass *  v1,
unsigned int  p2x,
unsigned int  p2y,
BufferBaseClass *  v2,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass *  v3,
unsigned int  n 
) [inline]

Fills a quad region inside the buffer by interploating the given values considering their length (interpreted as vectors). It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4).

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
v0 the value of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
v1 the value of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
v2 the value of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
v3 the value of the fourth point in the quad.
n the number of channels in the buffer (to speed things up).

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillVirtualQuad ( unsigned int  p0x,
unsigned int  p0y,
unsigned int  p1x,
unsigned int  p1y,
unsigned int  p2x,
unsigned int  p2y,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass  value 
) [inline]

Fills a quad region inside the virtual buffer with the given value. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4).

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
value the value to be set inside the quad in the virtual buffer.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillVirtualQuad ( unsigned int  p0x,
unsigned int  p0y,
unsigned int  p1x,
unsigned int  p1y,
unsigned int  p2x,
unsigned int  p2y,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass *  values,
unsigned int  n 
) [inline]

Fills a quad region inside the virtual buffer with the given value. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4). This methods takes the number of channels as parameter to avoid accessing a class variable to speed up processing.

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
values the array of channel values to be set inside the quad in the virtual buffer.
n the number of channels in the buffer (to speed things up)

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillVirtualQuad ( unsigned int  p0x,
unsigned int  p0y,
BufferBaseClass  v0,
unsigned int  p1x,
unsigned int  p1y,
BufferBaseClass  v1,
unsigned int  p2x,
unsigned int  p2y,
BufferBaseClass  v2,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass  v3 
) [inline]

Fills a quad region inside the virtual buffer by interploating the given values. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4).

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
v0 the value of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
v1 the value of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
v2 the value of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
v3 the value of the fourth point in the quad.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillVirtualQuad ( unsigned int  p0x,
unsigned int  p0y,
BufferBaseClass *  v0,
unsigned int  p1x,
unsigned int  p1y,
BufferBaseClass *  v1,
unsigned int  p2x,
unsigned int  p2y,
BufferBaseClass *  v2,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass *  v3,
unsigned int  n 
) [inline]

Fills a quad region inside the virtual buffer by interploating the given values. It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4). This methods takes the number of channels as parameter to avoid accessing a class variable to speed up processing.

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
v0 the value of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
v1 the value of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
v2 the value of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
v3 the value of the fourth point in the quad.
n the number of channels in the virtual buffer (to speed things up)

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillVirtualQuadWithLength ( unsigned int  p0x,
unsigned int  p0y,
BufferBaseClass *  v0,
unsigned int  p1x,
unsigned int  p1y,
BufferBaseClass *  v1,
unsigned int  p2x,
unsigned int  p2y,
BufferBaseClass *  v2,
unsigned int  p3x,
unsigned int  p3y,
BufferBaseClass *  v3,
unsigned int  n 
) [inline]

Fills a quad region inside the virtual buffer by interploating the given values considering their length (interpreted as vectors). It uses a slightly modified Active Edge Table (AET) fill algorithm, since the number of edges is constant (4).

Parameters:
p0x the x-coordinate index of the first point in the quad.
p0y the y-coordinate index of the first point in the quad.
v0 the value of the first point in the quad.
p1x the x-coordinate index of the second point in the quad.
p1y the y-coordinate index of the second point in the quad.
v1 the value of the second point in the quad.
p2x the x-coordinate index of the third point in the quad.
p2y the y-coordinate index of the third point in the quad.
v2 the value of the third point in the quad.
p3x the x-coordinate index of the fourth point in the quad.
p3y the y-coordinate index of the fourth point in the quad.
v3 the value of the fourth point in the quad.
n the number of channels in the virtual buffer (to speed things up).

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillPolygon ( std::vector< std::pair< int, int > >  points,
BufferBaseClass  value 
) [inline]

Fills a polygon with an arbitrary shape defined the given collection of vertices with the given value. This method is adapted from the original code written by Jens Grubert for the previous version of the framework and based on the Active Edge Table polygon filling algorithm describe in http://www.cs.rit.edu/~icss571/filling/how_to.html.

Parameters:
points the collection of vertices of the polygon.
value the value to be used to fill the buffer entries.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::fillPolygon ( std::vector< std::pair< int, int > >  points,
BufferBaseClass *  values 
) [inline]

Fills a polygon with an arbitrary shape defined the given collection of vertices with the given multi-channel value. This method is adapted from the original code written by Jens Grubert for the previous version of the framework and based on the Active Edge Table polygon filling algorithm describe in http://www.cs.rit.edu/~icss571/filling/how_to.html.

Parameters:
points the collection of vertices of the polygon.
values the multi-channel value to be used to fill the buffer entries.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::setVirtualValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass  value 
) [inline]

Sets the given value to the given position in the i-buffer considering a virtual buffer.

Parameters:
x the horizontal index of the entry to be set in the buffer.
y the vertical index of the entry to be set in the buffer.
value the value to be set in the given buffer position.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::setVirtualValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass *  values 
) [inline]

Sets the given values to the given position in the multi-channel i-buffer considering a virtual buffer.

Parameters:
x the horizontal index of the entry to be set in the buffer.
y the vertical index of the entry to be set in the buffer.
values the array of values to be set in each channel of the given buffer position.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class BufferBaseClass>
BufferBaseClass IBuffer< BufferBaseClass >::getVirtualValue ( unsigned int  x,
unsigned int  y 
) [inline]

Returns the value of the i-buffer at the given position considering a virtual buffer.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
Returns:
the value of the i-buffer at the given position.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::getVirtualValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass *  values 
) [inline]

Provides the value of the multi-channel i-buffer at the given position considering a virtual buffer.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
values the array of values of the multi-channel entry.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class BufferBaseClass>
BufferBaseClass IBuffer< BufferBaseClass >::getVirtualValue ( double  x,
double  y 
) [inline]

Returns the interpolated value of the i-buffer at the given position considering a virtual buffer.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
Returns:
the value of the i-buffer at the given position.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::getVirtualValue ( double  x,
double  y,
BufferBaseClass *  values 
) [inline]

Provides the interpolated value of the i-buffer at the given position considering a virtual buffer.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
values the array of values of the multi-channel entry.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class IBUFFERLAYER_API BufferBaseClass>
void IBuffer< BufferBaseClass >::setValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass  value 
) [inline]

Sets the given value to the given position in the real (not virtual) i-buffer. It doesn't check the range of the input values due to performance reasons. When calling this function, the indices must be inside the current buffer bounds.

Parameters:
x the horizontal index of the entry to be set in the buffer.
y the vertical index of the entry to be set in the buffer.
value the value to be set in the given buffer position.

if (!(x < _realWidth && y < _realHeight))

template<class IBUFFERLAYER_API BufferBaseClass>
void IBuffer< BufferBaseClass >::setValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass *  values 
) [inline]

Sets the given values to the given position in the multi-channel real i-buffer.

Parameters:
x the horizontal index of the entry to be set in the buffer.
y the vertical index of the entry to be set in the buffer.
values the array of values to be set in each channel of the given buffer position.
Exceptions:
std::out_of_range when the indices are out of the buffer bounds.

template<class IBUFFERLAYER_API BufferBaseClass>
void IBuffer< BufferBaseClass >::setValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass *  values,
const unsigned int  n 
) [inline]

Sets the given values to the given position in the n-channel real i-buffer. It doesn't check the range of the input values due to performance reasons. When calling this function, the indices must be inside the current buffer bounds.

Parameters:
x the horizontal index of the entry to be set in the buffer.
y the vertical index of the entry to be set in the buffer.
values the array of values to be set in each channel of the given buffer position.
n the number of channels in the given value.

template<class IBUFFERLAYER_API BufferBaseClass>
BufferBaseClass IBuffer< BufferBaseClass >::getValue ( unsigned int  x,
unsigned int  y 
) [inline]

Returns the value of the real (not virtual) i-buffer at the given position. It doesn't check the range of the input values due to performance reasons. When calling this function, the indices must be inside the current buffer bounds.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
Returns:
the value of the real i-buffer at the given position.

template<class IBUFFERLAYER_API BufferBaseClass>
void IBuffer< BufferBaseClass >::getValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass *  values 
) [inline]

Provides the value of the multi-channel real i-buffer at the given position. It doesn't check the range of the input values due to performance reasons. When calling this function, the indices must be inside the current buffer bounds.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
values the array of values of the multi-channel entry.

template<class IBUFFERLAYER_API BufferBaseClass>
void IBuffer< BufferBaseClass >::getValue ( unsigned int  x,
unsigned int  y,
BufferBaseClass *  values,
const unsigned int  n 
) [inline]

Provides the value of the n-channel real i-buffer at the given position. It doesn't check the range of the input values due to performance reasons. When calling this function, the indices must be inside the current buffer bounds.

Parameters:
x the horizontal index of the entry to be obtained from the buffer.
y the vertical index of the entry to be obtained from the buffer.
values the array of values of the multi-channel entry.
n the number of channels in the given value.

template<class IBUFFERLAYER_API BufferBaseClass>
bool IBuffer< BufferBaseClass >::isInsideVirtualBuffer ( double  x,
double  y 
) [inline]

Returns true if the given coordinates are inside the buffer current virtual dimensions.

Parameters:
x the horizontal coordinate of the buffer entry.
y the vertical coordinate of the buffer entry.
Returns:
true if the given coordinates are inside the buffer virtual dimensions, false otherwise.

template<class IBUFFERLAYER_API BufferBaseClass>
bool IBuffer< BufferBaseClass >::isInsideActualBuffer ( double  x,
double  y 
) [inline]

Returns true if the given coordinates are inside the buffer current real dimensions.

Parameters:
x the horizontal coordinate of the buffer entry.
y the vertical coordinate of the buffer entry.
Returns:
true if the given coordinates are inside the buffer real dimensions, false otherwise.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::setId ( unsigned int  id  )  [inline]

Sets the id of this i-buffer.

Parameters:
id the new id.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getId (  )  [inline]

Returns the identifier of this i-buffer.

Returns:
the id of this i-buffer.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getNumberEntries ( void   )  [inline]

Returns the current buffer size.

Returns:
the buffer size.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getWidth (  )  [inline]

Returns the (virtual) width of the buffer.

Returns:
the width of this buffer.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getHeight (  )  [inline]

Returns the (virtual) height of the buffer.

Returns:
the height of this buffer.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getActualWidth (  )  [inline]

Returns the (real) width of the buffer data structure.

Returns:
the width of this buffer data structure.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getActualHeight (  )  [inline]

Returns the (real) height of the buffer data structure.

Returns:
the height of this buffer data structure.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getNumberChannels (  )  [inline]

Returns the number of channels per buffer entry.

Returns:
the number of channels per buffer entry.

template<class BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::getEntrySizeBytes ( void   )  [inline]

Returns the number of bytes in a buffer entry.

Returns:
number of bytes in a buffer entry.

template<class BufferBaseClass>
unsigned long IBuffer< BufferBaseClass >::getAllocatedMemorySizeBytes ( void   )  [inline]

Returns the amount of memory allocated for this i-buffer in bytes.

Returns:
the total memory allocated for this i-buffer in bytes.

template<class BufferBaseClass>
unsigned long IBuffer< BufferBaseClass >::getAllocatedMemorySizeKBytes ( void   )  [inline]

Returns the amount of memory allocated for this i-buffer in Kylobytes.

Returns:
the total memory allocated for this i-buffer in Kylobytes.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::print ( void   )  [inline]

Prints the current contents of the i-buffer to the console.

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::createImage ( const char *  fileName,
double  factor = 1.0,
double  offset = 0.0 
) [inline]

Creates an image with the buffer byte contents in the given ppm file. The buffer data is converted to unsigned bytes when added to the image. If the buffer data is not in the byte range (0 to 255), a scale factor and an offset can be defined so that the data is properly converted. If the buffer has more than 3 channels, more images are created with the additional information. The output file names are appended with integer numbers starting at zero.

Parameters:
fileName the name of the ppm file to be loaded with the buffer data
factor the scale factor to be applied to the buffer entry values
offset the offset to be added to the buffer entry values
Exceptions:
std::logic_error if the buffer doesn't have any channels

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::setup ( unsigned int  realWidth,
unsigned int  realHeight,
unsigned int  virtualWidth,
unsigned int  virtualHeight 
) [inline, protected]

Sets up the buffer parameters.

Parameters:
realWidth the width of the buffer data structure
realHeight the height of the buffer data structure
virtualWidth the visible width of the buffer
virtualHeight the visible height of the buffer

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::allocateMemory ( void   )  [inline, protected]

Allocates memory for the i-buffer and its look-up table. It uses the current properties to define the dimensions of the data structures.

template<class BufferBaseClass>
BufferBaseClass IBuffer< BufferBaseClass >::interpolateEntry ( double  x,
double  y 
) [inline, protected]

Calculates the value of the bilinear interpolation of the current buffer values for the given entry position. It uses the surrounding four entries to obtain the final interpolated value.

Parameters:
x the horizontal coordinate of the buffer entry.
y the vertical coordinate of the buffer entry.
Exceptions:
std::out_of_range if the indices are out of the buffer bounds.
Returns:
the interpolated value at the given coordinates.
See also:
http://en.wikipedia.org/wiki/Bilinear_interpolation

template<class BufferBaseClass>
void IBuffer< BufferBaseClass >::interpolateEntry ( double  x,
double  y,
BufferBaseClass *  values 
) [inline, protected]

Calculates the value of the bilinear interpolation of the current multi-channel buffer values for the given entry position. It uses the surrounding four entries to obtain the final interpolated values.

Parameters:
x the horizontal coordinate of the buffer entry.
y the vertical coordinate of the buffer entry.
values the array of interpolated values of the multi-channel entry.
Exceptions:
std::out_of_range if the indices are out of the buffer bounds.
See also:
http://en.wikipedia.org/wiki/Bilinear_interpolation

template<class IBUFFERLAYER_API BufferBaseClass>
void IBuffer< BufferBaseClass >::calculateRealCoordinates ( unsigned int  x,
unsigned int  y,
unsigned int &  realX,
unsigned int &  realY 
) [inline, protected]

Returns the real coordinates based on the given virtual coordinates.

Parameters:
x the virtual x-coordinate value
y the virtual y-coordinate value
realX the real x-coordinate value
realY the real y-coordinate value


Member Data Documentation

template<class IBUFFERLAYER_API BufferBaseClass>
BufferBaseClass* IBuffer< BufferBaseClass >::_buffer [protected]

The i-buffer data

template<class IBUFFERLAYER_API BufferBaseClass>
BufferBaseClass** IBuffer< BufferBaseClass >::_bufferLUT [protected]

A look-up table (LUT) for easier 2D access to the buffer

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_realWidth [protected]

Horizontal dimension of the buffer data array

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_realHeight [protected]

Vertical dimension of the buffer data array

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_virtualWidth [protected]

Horizontal dimension of the buffer as is seen by the user

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_virtualHeight [protected]

Vertical dimension of the buffer as is seen by the user

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_nChannels [protected]

Number of channels in a buffer entry

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_bytesPerChannel [protected]

Number of bytes per channel of an entry

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_nEntries [protected]

The number of entries in the buffer

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_bytesPerEntry [protected]

The number of bytes in a buffer entry (number of channels * bytes per channel)

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_nBytes [protected]

The number of bytes in the buffer (number of entries * bytes per entry) (AKA byte depth)

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_nChannelEntries [protected]

Sum of the number individual channels in all entries (number of entries * number of channels

template<class IBUFFERLAYER_API BufferBaseClass>
unsigned int IBuffer< BufferBaseClass >::_id [protected]

The idenfier of this buffer


The documentation for this class was generated from the following files:
Generated on Fri Dec 21 17:42:27 2007 for IBuffer by  doxygen 1.5.2