#include <IBuffer.h>
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 |
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.
Default constructor for the i-buffer.
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.
id | the id of the i-buffer being created. | |
nChannels | the number of channels in each entry of the i-buffer. |
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.
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 |
Destructor for the i-buffer.
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.
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 |
void IBuffer< BufferBaseClass >::destroy | ( | void | ) | [inline] |
Destroys this buffer.
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.
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 |
std::out_of_range | when the interpolating indices fall out of the buffer bounds. |
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.
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 |
std::out_of_range | when the interpolating indices fall out of the buffer bounds. |
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.
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. |
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.
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. |
void IBuffer< BufferBaseClass >::clear | ( | void | ) | [inline] |
Clears the buffer by setting all its entries to a default value.
void IBuffer< BufferBaseClass >::fill | ( | BufferBaseClass | value | ) | [inline] |
Fills the buffer with the given value.
value | the value to set to the whole buffer. |
void IBuffer< BufferBaseClass >::fill | ( | BufferBaseClass * | values | ) | [inline] |
Fills the buffer with the given values for each channel.
values | the array of values to set to the whole multi-channel buffer. |
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).
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. |
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.
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) |
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).
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. |
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.
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) |
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).
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). |
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).
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. |
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.
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) |
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).
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. |
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.
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) |
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).
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). |
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.
points | the collection of vertices of the polygon. | |
value | the value to be used to fill the buffer entries. |
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.
points | the collection of vertices of the polygon. | |
values | the multi-channel value to be used to fill the buffer entries. |
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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))
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.
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. |
std::out_of_range | when the indices are out of the buffer bounds. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
bool IBuffer< BufferBaseClass >::isInsideVirtualBuffer | ( | double | x, | |
double | y | |||
) | [inline] |
Returns true if the given coordinates are inside the buffer current virtual dimensions.
x | the horizontal coordinate of the buffer entry. | |
y | the vertical coordinate of the buffer entry. |
bool IBuffer< BufferBaseClass >::isInsideActualBuffer | ( | double | x, | |
double | y | |||
) | [inline] |
Returns true if the given coordinates are inside the buffer current real dimensions.
x | the horizontal coordinate of the buffer entry. | |
y | the vertical coordinate of the buffer entry. |
void IBuffer< BufferBaseClass >::setId | ( | unsigned int | id | ) | [inline] |
Sets the id of this i-buffer.
id | the new id. |
unsigned int IBuffer< BufferBaseClass >::getId | ( | ) | [inline] |
Returns the identifier of this i-buffer.
unsigned int IBuffer< BufferBaseClass >::getNumberEntries | ( | void | ) | [inline] |
Returns the current buffer size.
unsigned int IBuffer< BufferBaseClass >::getWidth | ( | ) | [inline] |
Returns the (virtual) width of the buffer.
unsigned int IBuffer< BufferBaseClass >::getHeight | ( | ) | [inline] |
Returns the (virtual) height of the buffer.
unsigned int IBuffer< BufferBaseClass >::getActualWidth | ( | ) | [inline] |
Returns the (real) width of the buffer data structure.
unsigned int IBuffer< BufferBaseClass >::getActualHeight | ( | ) | [inline] |
Returns the (real) height of the buffer data structure.
unsigned int IBuffer< BufferBaseClass >::getNumberChannels | ( | ) | [inline] |
Returns the number of channels per buffer entry.
unsigned int IBuffer< BufferBaseClass >::getEntrySizeBytes | ( | void | ) | [inline] |
Returns the number of bytes in a buffer entry.
unsigned long IBuffer< BufferBaseClass >::getAllocatedMemorySizeBytes | ( | void | ) | [inline] |
Returns the amount of memory allocated for this i-buffer in bytes.
unsigned long IBuffer< BufferBaseClass >::getAllocatedMemorySizeKBytes | ( | void | ) | [inline] |
Returns the amount of memory allocated for this i-buffer in Kylobytes.
void IBuffer< BufferBaseClass >::print | ( | void | ) | [inline] |
Prints the current contents of the i-buffer to the console.
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.
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 |
std::logic_error | if the buffer doesn't have any channels |
void IBuffer< BufferBaseClass >::setup | ( | unsigned int | realWidth, | |
unsigned int | realHeight, | |||
unsigned int | virtualWidth, | |||
unsigned int | virtualHeight | |||
) | [inline, protected] |
Sets up the buffer 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 |
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.
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.
x | the horizontal coordinate of the buffer entry. | |
y | the vertical coordinate of the buffer entry. |
std::out_of_range | if the indices are out of the buffer bounds. |
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.
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. |
std::out_of_range | if the indices are out of the buffer bounds. |
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.
x | the virtual x-coordinate value | |
y | the virtual y-coordinate value | |
realX | the real x-coordinate value | |
realY | the real y-coordinate value |
BufferBaseClass* IBuffer< BufferBaseClass >::_buffer [protected] |
The i-buffer data
BufferBaseClass** IBuffer< BufferBaseClass >::_bufferLUT [protected] |
A look-up table (LUT) for easier 2D access to the buffer
unsigned int IBuffer< BufferBaseClass >::_realWidth [protected] |
Horizontal dimension of the buffer data array
unsigned int IBuffer< BufferBaseClass >::_realHeight [protected] |
Vertical dimension of the buffer data array
unsigned int IBuffer< BufferBaseClass >::_virtualWidth [protected] |
Horizontal dimension of the buffer as is seen by the user
unsigned int IBuffer< BufferBaseClass >::_virtualHeight [protected] |
Vertical dimension of the buffer as is seen by the user
unsigned int IBuffer< BufferBaseClass >::_nChannels [protected] |
Number of channels in a buffer entry
unsigned int IBuffer< BufferBaseClass >::_bytesPerChannel [protected] |
Number of bytes per channel of an entry
unsigned int IBuffer< BufferBaseClass >::_nEntries [protected] |
The number of entries in the buffer
unsigned int IBuffer< BufferBaseClass >::_bytesPerEntry [protected] |
The number of bytes in a buffer entry (number of channels * bytes per channel)
unsigned int IBuffer< BufferBaseClass >::_nBytes [protected] |
The number of bytes in the buffer (number of entries * bytes per entry) (AKA byte depth)
unsigned int IBuffer< BufferBaseClass >::_nChannelEntries [protected] |
Sum of the number individual channels in all entries (number of entries * number of channels
unsigned int IBuffer< BufferBaseClass >::_id [protected] |
The idenfier of this buffer