Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Image Class Reference

A class made up of both an RGB image and a Greyscale image. More...

#include <Image.h>

Inheritance diagram for Image::

ImageRGB ImageGrey ImageBase ImageBase List of all members.

Public Types

enum  Type { COLOUR, GREYSCALE }
 Possible Image palettes. More...


Public Methods

 Image (Image &)
 Copy Constructor. More...

 Image (unsigned int width, unsigned int height)
 Create an image with the given dimensions. More...

 ~Image ()
 Destructor for Image class. More...

void set_rgb (unsigned int x, unsigned int y, PixelRGB &p)
 Set the rgb values of a pixel specified by (x,y). More...

void set_brightness (unsigned int x, unsigned int y, PixelGrey &level)
 Set the brightness value of a pixel specified by (x,y). More...

void get_rgb (unsigned int x, unsigned int y, PixelRGB &p)
 Return the red, green and blue values of the pixel specified by (x,y) in the RGB Pixel p. More...

void get_brightness (unsigned int x, unsigned int y, PixelGrey &p)
 Return the greylevel value of a pixel specified by (x,y). More...

Image& clear_rgb (int=0)
 Set to value (clear) all of the pixels in the RGB image data. More...

Image& clear_rgb (PixelRGB &)
 Set to value (clear) all of the pixels in the RGB image data. More...

Image& clear_brightness (int=0)
 Set to value (clear) all of the pixels in the brightness data. More...

Image& copy (Image &img)
 Copy all RGB and brightness data from this to img. More...

Image& operator= (Image &img)
 Method to overload equals (=) operator for two images. More...

void update_brightness ()
 Update brightness field for all pixels, from the RGB data.

bool draw_line (int x_start, int y_start, int x_end, int y_end, PixelGrey intensity)
 Method draws a straight line from point (x_start,y_start) to (x_end,y_end) of intensity described by brightness in PixelGrey intensity. More...

bool draw_line (int x_start, int y_start, int x_end, int y_end, PixelRGB pix)
 Method draws a straight line from point (x_start,y_start) to (x_end,y_end) of colour described by PixelRGB pix. More...

bool draw_filled_circle (unsigned int centre_x, unsigned int centre_y, unsigned int radius, PixelGrey intensity)
 Method draws a filled circle with centre at point (centre_x,centre_y) of radius radius and brightness described by PixelGrey intensity. More...

bool draw_filled_circle (unsigned int centre_x, unsigned int centre_y, unsigned int radius, PixelRGB pix)
 Method draws a filled circle with centre at point (centre_x,centre_y) of radius radius and colour described by PixelRGB pix. More...


Detailed Description

A class made up of both an RGB image and a Greyscale image.

The Image class inherits RGB properties from the ImageRGB class and greyscale properties from the ImageGrey class. So this class can be used as either a greyscale or colour image.

Definition at line 33 of file Image.h.


Member Enumeration Documentation

enum Image::Type
 

Possible Image palettes.

Enumeration values:
COLOUR   Specifies a palette consisting of red, green, and blue components each occupying 32 bits.
GREYSCALE   Specifies a palette consisting of a single luminance component occupying 32 bits.

Definition at line 44 of file Image.h.


Constructor & Destructor Documentation

Image::Image ( Image & img )
 

Copy Constructor.

Parameters:
img   The image to copy

Definition at line 27 of file Image.cpp.

Image::Image ( unsigned int width,
unsigned int height )
 

Create an image with the given dimensions.

Parameters:
w   The width of the image.
h   The height of the image.

Definition at line 37 of file Image.cpp.

Image::~Image ( )
 

Destructor for Image class.

Frees memory allocated to array:

Definition at line 49 of file Image.cpp.


Member Function Documentation

Image & Image::clear_brightness ( int k = 0 )
 

Set to value (clear) all of the pixels in the brightness data.

Parameters:
k   Value to clear the field to.

Definition at line 132 of file Image.cpp.

Image & Image::clear_rgb ( PixelRGB & p )
 

Set to value (clear) all of the pixels in the RGB image data.

Parameters:
k   Value to clear the field to.

Definition at line 120 of file Image.cpp.

Image & Image::clear_rgb ( int k = 0 )
 

Set to value (clear) all of the pixels in the RGB image data.

Parameters:
k   Value to clear the field to.

Definition at line 108 of file Image.cpp.

Image & Image::copy ( Image & img )
 

Copy all RGB and brightness data from this to img.

Throws an exception if images are of different size.

Parameters:
img   The image to copy the data from.

Definition at line 144 of file Image.cpp.

bool Image::draw_filled_circle ( unsigned int centre_x,
unsigned int centre_y,
unsigned int radius,
PixelRGB pix )
 

Method draws a filled circle with centre at point (centre_x,centre_y) of radius radius and colour described by PixelRGB pix.

The method returns false if any point is outside the image.

Reimplemented from ImageRGB.

Definition at line 216 of file Image-draw.cpp.

bool Image::draw_filled_circle ( unsigned int centre_x,
unsigned int centre_y,
unsigned int radius,
PixelGrey intensity )
 

Method draws a filled circle with centre at point (centre_x,centre_y) of radius radius and brightness described by PixelGrey intensity.

The method returns false if any point is outside the image.

Reimplemented from ImageGrey.

Definition at line 203 of file Image-draw.cpp.

bool Image::draw_line ( int x_start,
int y_start,
int x_end,
int y_end,
PixelRGB pix )
 

Method draws a straight line from point (x_start,y_start) to (x_end,y_end) of colour described by PixelRGB pix.

The method returns false if either point is outside the image.

Reimplemented from ImageRGB.

Definition at line 38 of file Image-draw.cpp.

bool Image::draw_line ( int x_start,
int y_start,
int x_end,
int y_end,
PixelGrey intensity )
 

Method draws a straight line from point (x_start,y_start) to (x_end,y_end) of intensity described by brightness in PixelGrey intensity.

The method returns false if either point is outside the imagei.

Reimplemented from ImageGrey.

Definition at line 24 of file Image-draw.cpp.

void Image::get_brightness ( unsigned int x,
unsigned int y,
PixelGrey & p )
 

Return the greylevel value of a pixel specified by (x,y).

Note:
No check is made that x and y are in range.
Parameters:
x,y   The coordinates of the pixel.
p   A Reference to the Pixel to store the level of brightness in.

Definition at line 95 of file Image.cpp.

void Image::get_rgb ( unsigned int x,
unsigned int y,
PixelRGB & p )
 

Return the red, green and blue values of the pixel specified by (x,y) in the RGB Pixel p.

Note:
No check is made that x and y are in range.
Parameters:
x,y   The coordinates of the pixel.
p   A Reference to the pixel to store the values in.

Definition at line 82 of file Image.cpp.

Image & Image::operator= ( Image & img )
 

Method to overload equals (=) operator for two images.

Calls the copy method on img passing this as its argument.

Parameters:
img   The image to copy the data from

Definition at line 158 of file Image.cpp.

void Image::set_brightness ( unsigned int x,
unsigned int y,
PixelGrey & level )
 

Set the brightness value of a pixel specified by (x,y).

Throws an exception if coordinates are not valid.

Parameters:
x,y   The coordinates of the pixel.
level   The value to set the field to.

Definition at line 69 of file Image.cpp.

void Image::set_rgb ( unsigned int x,
unsigned int y,
PixelRGB & p )
 

Set the rgb values of a pixel specified by (x,y).

Parameters:
x,y   The coordinates of the pixel.
p   The rgb values to set the pixel to.

Definition at line 57 of file Image.cpp.


The documentation for this class was generated from the following files:
Generated at Fri Aug 13 17:29:21 2004 for libRTImage by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001