ContRap-Libraries
Public Member Functions | Protected Attributes

crp::RawImage Class Reference

Defines an interface for raw ContRap images. More...

#include <rawimage.h>

Inheritance diagram for crp::RawImage:
crp::Array< unsigned char > Object

Public Member Functions

 RawImage ()
 Empty constructor.
 RawImage (int width, int height, int element_size=0, int codec=CODEC_UNDEFINED)
 Constructs a new image.
 RawImage (const RawImage &image)
 Copy constructor.
virtual ~RawImage ()
 Destructor clears memory.
virtual Objectclone ()
 Returns a pointer to a semantical copy of the current object.
virtual std::string get_type_name () const
 Returns the type name of the object.
void resize (int width, int height, int element_size=1, int codec=CODEC_UNDEFINED)
 Resizes the image.
void set_data (unsigned char *data, int width=-1, int height=-1, int element_size=1, int codec=CODEC_UNDEFINED)
 Set data.
int get_element_size () const
 Returns the element size of the image data field.
unsigned char * operator() (int x, int y)
 Accesses an element of the image.
RawPixel get_pixel (int x, int y)
 Returns a raw pixel from the image.
void set_codec (int codec)
 Sets the codec for this image.
int get_codec () const
 Returns the codec for this image.
virtual std::string to_string () const
 Converts the object to a non-formatted string.

Protected Attributes

int element_size
 Element size of the data.
int codec
 Codec.

Detailed Description

Defines an interface for raw ContRap images.


Constructor & Destructor Documentation

crp::RawImage::RawImage ( ) [inline]

Empty constructor.

crp::RawImage::RawImage ( int  width,
int  height,
int  element_size = 0,
int  codec = CODEC_UNDEFINED 
) [inline]

Constructs a new image.

Parameters:
widthWidth of the image
heightHeight of the image
element_sizeSize of a single element
codecCodec of the image
crp::RawImage::RawImage ( const RawImage image) [inline]

Copy constructor.

virtual crp::RawImage::~RawImage ( ) [inline, virtual]

Destructor clears memory.


Member Function Documentation

virtual Object* crp::RawImage::clone ( ) [inline, virtual]

Returns a pointer to a semantical copy of the current object.

Returns:
Copy of the current object

Reimplemented from crp::Array< unsigned char >.

int crp::RawImage::get_codec ( ) const [inline]

Returns the codec for this image.

Returns:
Current codec
int crp::RawImage::get_element_size ( ) const [inline]

Returns the element size of the image data field.

Returns:
Element sâize of the data field
RawPixel crp::RawImage::get_pixel ( int  x,
int  y 
) [inline]

Returns a raw pixel from the image.

Parameters:
xX-Coordinate
yY-Coordinate
Returns:
RawPixel
virtual std::string crp::RawImage::get_type_name ( ) const [inline, virtual]

Returns the type name of the object.

Returns:
Type of the object
unsigned char* crp::RawImage::operator() ( int  x,
int  y 
) [inline]

Accesses an element of the image.

Parameters:
xX-Coordinate of the pixel
yY-Coordinate of the pixel
Returns:
Array cell values

Reimplemented from crp::Array< unsigned char >.

void crp::RawImage::resize ( int  width,
int  height,
int  element_size = 1,
int  codec = CODEC_UNDEFINED 
) [inline]

Resizes the image.

Parameters:
widthNew image width
heightNew image height
element_sizeSize of one element
codecCodec for the image
void crp::RawImage::set_codec ( int  codec) [inline]

Sets the codec for this image.

Parameters:
codecNew codec
void crp::RawImage::set_data ( unsigned char *  data,
int  width = -1,
int  height = -1,
int  element_size = 1,
int  codec = CODEC_UNDEFINED 
) [inline]

Set data.

Parameters:
dataNew data
widthNew width (should match data)
heightNew height (should match data)
element_sizeSize of an element
codecCodec for the image
virtual std::string crp::RawImage::to_string ( ) const [inline, virtual]

Converts the object to a non-formatted string.

This method is thought to be used for debugging purposes only.

Returns:
String representation of the object

Reimplemented from crp::Array< unsigned char >.


Field Documentation

int crp::RawImage::codec [protected]

Codec.

int crp::RawImage::element_size [protected]

Element size of the data.


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