Main Page | Class Hierarchy | Class List | File List | Class Members

SimpleRGBImage Class Reference

The SimpleRGBImage class is a very basic image class for storing and manipulating RGB images. More...

#include <SimpleRGBImage.hh>

List of all members.

Public Member Functions

 SimpleRGBImage ()
 SimpleRGBImage (const SimpleRGBImage &image)
 SimpleRGBImage (unsigned int width, unsigned int height)
 SimpleRGBImage (std::istream &is)
 ~SimpleRGBImage ()
void resize (unsigned int width, unsigned int height)
void read (std::istream &is)
void write (std::ostream &os)
RGBColoroperator() (unsigned int x, unsigned int y)
const RGBColoroperator() (unsigned int x, unsigned int y) const
unsigned int width () const
unsigned int height () const
size_t size () const
RGBColorbegin ()
const RGBColorbegin () const
RGBColorend ()
const RGBColorend () const
RGBColoroperator[] (size_t n)
const RGBColoroperator[] (size_t n) const
SimpleRGBImageoperator= (const SimpleRGBImage &image)

Classes

class  ReadError
class  WriteError


Detailed Description

The SimpleRGBImage class is a very basic image class for storing and manipulating RGB images.

It contains methods for loading and saving PPM images and for direct access to the pixels


Constructor & Destructor Documentation

SimpleRGBImage::SimpleRGBImage  ) 
 

Default Constructor. Creates an empty image

SimpleRGBImage::SimpleRGBImage const SimpleRGBImage image  ) 
 

Copy Constructor.

SimpleRGBImage::SimpleRGBImage unsigned int  width,
unsigned int  height
 

Size Constructor. Creates an image of arbitrary dimensions

Parameters:
width width of image
height height of image

SimpleRGBImage::SimpleRGBImage std::istream &  is  ) 
 

Load Constructor. Loads an image from an input stream. See read-function for details.

Parameters:
is istream to load image from

SimpleRGBImage::~SimpleRGBImage  ) 
 

Destructor


Member Function Documentation

RGBColor* SimpleRGBImage::begin  ) 
 

begin of image

Returns:
pointer to first RGBColor of image

RGBColor* SimpleRGBImage::end  ) 
 

end of image

Returns:
pointer to the first RGBColor BEHIND the last RGBColor of the image

unsigned int SimpleRGBImage::height  )  const
 

height of the image

Returns:
image height

RGBColor& SimpleRGBImage::operator() unsigned int  x,
unsigned int  y
 

unchecked access to a pixel (two-dimensional position)

Parameters:
x horizontal pixel coordinate
y vertical pixel coordinate
Returns:
reference to the pixel at position row,col

SimpleRGBImage & SimpleRGBImage::operator= const SimpleRGBImage image  ) 
 

operator=

Parameters:
image image to copy
Returns:
reference to modified image

RGBColor& SimpleRGBImage::operator[] size_t  n  ) 
 

operator[]

Parameters:
n pixel number
Returns:
reference to RGBColor number n of image

void SimpleRGBImage::read std::istream &  is  ) 
 

read an image from the given stream in ASCII PPM format (image Header "P3")

Parameters:
is input stream. Must be already opened for reading, with the read postition pointing to the begin of the image header
Exceptions:
ReadError an error occured during reading. ReadError::msg() contains the plain text error message.

void SimpleRGBImage::resize unsigned int  width,
unsigned int  height
 

resize image to width*height. If it has already this size, nothing is done

Parameters:
width width of image
height height of image

size_t SimpleRGBImage::size  )  const
 

size of the image (number of pixels)

Returns:
number of pixels

unsigned int SimpleRGBImage::width  )  const
 

width of the image

Returns:
image width

void SimpleRGBImage::write std::ostream &  os  ) 
 

write the image to the given stream in ASCII PPM format (image Header "P3")

Parameters:
os output stream. Must be already opened for writing
Exceptions:
WriteError an error occured during writing. WriteError::msg() contains the plain text error message.


The documentation for this class was generated from the following files:
Generated on Wed May 4 16:19:59 2005 by  doxygen 1.4.2