MatrixSlice< T, I > Struct Template Reference

A simple generic template for matrices of fixed size, uses shallow copying and manual memory management. More...

#include <matrixUtil.h>

Inheritance diagram for MatrixSlice< T, I >:

Inheritance graph
[legend]

List of all members.

Public Types

typedef MatrixSlice< const T, I > Const
 the class is convertible to Const type

Public Member Functions

 MatrixSlice ()
 Initializes an empty slice.
 operator Const () const
 Converts to a matrix of constant objects (shallow copy).
T * operator[] (I column)
 Indexing operator - returns pointer to a column.
const T * operator[] (I column) const
 Const version of indexing operator - doesn't allow to change the elements.
void allocate (I width, I height, T *memory=0)
 Reallocates the matrix for a new size.
void free ()
 Releases the memory.
bool isValid () const
 Returns whether the matrix is allocated (and thus usable for indexing).
void fillSubMatrix (const Block &block, T value)
 Fills a submatrix of a valid matrix with a value.
MatrixSliceshiftMatrix (I x0, I y0)
 Shifts the indexing of this matrix - dangerous.
void getPosition (const T *elem, int &x, int &y) const
 Computes relative position of a pointer in the matrix (always 0 <= y < colSkip).

Static Public Member Functions

static MatrixSlice makeRaw (T *start, I colSkip)
 Creates an instance with pre-filled member fields.

Public Attributes

T * start
 pointer to the top-left pixel
colSkip
 how many pixels to skip to get in the next column


Detailed Description

template<class T, class I = PtrInt>
struct MatrixSlice< T, I >

A simple generic template for matrices of fixed size, uses shallow copying and manual memory management.

Definition at line 24 of file matrixUtil.h.


Member Function Documentation

template<class T, class I = PtrInt>
void MatrixSlice< T, I >::allocate ( width,
height,
T *  memory = 0 
) [inline]

Reallocates the matrix for a new size.

If memory parameter is given, it is used for storage (the user is responsible that the matrix fits in it, etc.)

Definition at line 61 of file matrixUtil.h.

template<class T, class I = PtrInt>
MatrixSlice& MatrixSlice< T, I >::shiftMatrix ( x0,
y0 
) [inline]

Shifts the indexing of this matrix - dangerous.

After calling this, only addressing or more shifts can be done (not checked). Also shifts out of the allocated matrix aren't detected

Definition at line 90 of file matrixUtil.h.


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

Generated on Thu Aug 6 22:33:14 2009 for Fractal Image Compressor by  doxygen 1.5.8