Public Member Functions

PixelBufT< T > Class Template Reference

Search for all occurrences

Detailed Description

template<class T>
class PixelBufT< T >

Description:
These templated classes allow you to set up a buffer for pixels that will automatically deallocate the buffer when they goes out of scope. All methods of this class are implemented by the system.

Note the following typedefs set up for the standard pixel storage formats.

typedef PixelBufT<UBYTE> PixelBuf8;

typedef PixelBufT<USHORT> PixelBuf16;

typedef PixelBufT<BMM_Color_24> PixelBuf24;

typedef PixelBufT<BMM_Color_32> PixelBuf32;

typedef PixelBufT<BMM_Color_48> PixelBuf48;

typedef PixelBufT<BMM_Color_64> PixelBuf64;

#include <pixelbuf.h>

Inheritance diagram for PixelBufT< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  PixelBufT (int width)
  ~PixelBufT ()
T *  Ptr ()
T &  operator[] (int i)
int  Fill (int start, int count, T color)

Constructor & Destructor Documentation

PixelBufT ( int  width ) [inline]
Remarks:
Constructor. This allocates the pixel buffer using the specified width.
Parameters:
int width

The number of pixels to allocate for the buffer.
{ buf = (T *)MAX_calloc(width,sizeof(T)); this->width=width; };
~PixelBufT ( ) [inline]
Remarks:
Destructor. The pixel buffer is deallocated.
{ if(buf) MAX_free(buf); };

Member Function Documentation

T* Ptr ( ) [inline]
Remarks:
Returns the address of the pixel buffer.
{ return buf; };
T& operator[] ( int  i ) [inline]
Remarks:
Array operator. This allows access to the pixel buffer using the [ ] operator.
Parameters:
int i

The index to access.
{ return buf[i]; }
int Fill ( int  start,
int  count,
color 
) [inline]
Remarks:
Fills the specified portion of the pixel buffer with the specified color.
Parameters:
int start

The start location for the fill.

int count

The number of pixels to fill.

T color

The color to use as the fill.
Returns:
Nonzero if filled; otherwise 0.
Operators:
                                                              {
                          int ix,jx=start+count;
                          if(jx > width) // MAB - 07/15/03 - changed from >=
                             return 0;
                          for(ix=start; ix<jx; buf[ix++]=color);
                          return 1;
                          };