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

PixelRGB Class Reference

A Single pixel consisting of red, green and blue fields. More...

#include <PixelRGB.h>

List of all members.

Public Methods

 PixelRGB ()
 The default constructor. More...

 PixelRGB (int red, int green, int blue)
 Create a pixel with the specified values. More...

PixelRGB& operator= (PixelRGB &p)
 Overloaded assignment operator. More...

int& operator[] (int i)
 Overloaded array operator. More...

 operator int * ()
 Overloaded Cast operator. More...

bool operator== (PixelRGB &p)
 Overloaded equality operator. More...

bool operator!= (PixelRGB &p)
 Overloaded test for none equality. More...

PixelRGB& operator+= (PixelRGB &p)
 Overloaded addition operator. More...

PixelRGB& operator-= (PixelRGB &p)
 Overloaded subtraction(difference) operator. More...

PixelRGB& operator *= (double k)
 Overloaded multiplication operator. More...


Protected Attributes

int pixel [3]
 The pixels data as an array of ints.


Detailed Description

A Single pixel consisting of red, green and blue fields.

The pixel is stored as an array of three ints which can be access as seperate colour fields using the FieldSelector enum in the ImageRGB class.

Definition at line 29 of file PixelRGB.h.


Constructor & Destructor Documentation

PixelRGB::PixelRGB ( ) [inline]
 

The default constructor.

This zero's the values of the red, green and blue colour fields.

Definition at line 66 of file PixelRGB.h.

PixelRGB::PixelRGB ( int red,
int green,
int blue ) [inline]
 

Create a pixel with the specified values.

This constructor creates a new pixel with the red, green and blue values specified as arguments.

Definition at line 76 of file PixelRGB.h.


Member Function Documentation

PixelRGB & PixelRGB::operator *= ( double k ) [inline]
 

Overloaded multiplication operator.

Multiply the fields of this pixel by a scalar value.

Parameters:
k   The scalar to multiply by.

Returns:
A reference to this object.

Definition at line 219 of file PixelRGB.h.

PixelRGB::operator int * ( ) [inline]
 

Overloaded Cast operator.

This operator allows the pixel to be easily cast to an int pointer. Since the pixel data is just an array of ints, this operator allows the pixel to be treated as such.

Definition at line 127 of file PixelRGB.h.

bool PixelRGB::operator!= ( PixelRGB & p ) [inline]
 

Overloaded test for none equality.

This tests whether the pixel and the one specified are not equal i.e. they have at least one field in which their values differ.

Parameters:
p   The pixel to test none-equality with.

Returns:
true - if pixels are different false - if all fields are the same.

Definition at line 164 of file PixelRGB.h.

PixelRGB & PixelRGB::operator+= ( PixelRGB & p ) [inline]
 

Overloaded addition operator.

Add the values of the pixel specified to the fields of this pixel. Note NO checking that values are within range 0-255 is done.

Parameters:
p   The pixel to add the values from.

Returns:
A reference to this object.

Definition at line 182 of file PixelRGB.h.

PixelRGB & PixelRGB::operator-= ( PixelRGB & p ) [inline]
 

Overloaded subtraction(difference) operator.

Assign the difference of the values of the pixel specified and this pixel to the fields of this pixel.

Parameters:
p   The pixel to difference the values with.

Returns:
A reference to this object.

Definition at line 201 of file PixelRGB.h.

PixelRGB & PixelRGB::operator= ( PixelRGB & p ) [inline]
 

Overloaded assignment operator.

Assign the values of the pixel specified to the fields of this pixel.

Parameters:
p   The pixel to assign the values from.

Returns:
A reference to this object.

Definition at line 94 of file PixelRGB.h.

bool PixelRGB::operator== ( PixelRGB & p ) [inline]
 

Overloaded equality operator.

This tests whether this pixel and the one specified are equal i.e. have the same values for all fields.

Parameters:
p   The pixel to test equality with.

Returns:
true - if pixels are equal. false - if pixels differ in any fields.

Definition at line 144 of file PixelRGB.h.

int & PixelRGB::operator[] ( int i ) [inline]
 

Overloaded array operator.

This operator allows easy access to the data of the pixel as if you were refering to the data directly.

Parameters:
i   The index of the field to return.

Returns:
The value of the field.

Definition at line 114 of file PixelRGB.h.


Friends And Related Function Documentation

ostream & operator<< ( ostream & os,
PixelRGB & p ) [friend]
 

Outputs a pixel to the output stream.

This overlaoded operator inserts a representation of the pixel into the output stream (os) in the form '(r,g,b)' where r, g, b are the red, green and blue fields respectively.

Parameters:
os   The output stream.
p   The pixel to output.

Returns:
A reference to the output stream for chained calls.

Definition at line 50 of file PixelRGB.h.


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