Home Hierarchy Members Alphabetical Related Pages

SFImage Class Reference
[Field Types]

#include <sfimage.h>

List of all members.

Public Member Functions

 SFImage ()
 SFImage (const unsigned int w, const unsigned int h, const unsigned int n)
 SFImage (const SFImage &i)
SFImageoperator= (const SFImage &)
 ~SFImage ()
void setDimensions (const unsigned int w, const unsigned int h, const unsigned int n)
unsigned int width () const
unsigned int height () const
unsigned int numComponents () const
const unsigned char * pixels () const
unsigned char * pixels ()
bool operator== (const SFImage &i) const

Static Public Member Functions

const char * typeName ()
FieldTypeId typeId ()

Public Attributes

unsigned int width_
unsigned int height_
unsigned int numComponents_
unsigned char * pixels_

Friends

std::ostream & operator<< (std::ostream &s, const SFImage &f)


Detailed Description

Represents an image. Below is included the documentation for this field type from the ISO standard.

+ 5.5 SFImage

The SFImage field or event specifies a single uncompressed 2-dimensional pixel image. SFImage fields and events are written to the VRML file as three integers representing the width, height and number of components in the image, followed by width*height hexadecimal or integer values representing the pixels in the image, separated by whitespace:

    fooImage <width> <height> <num components> <pixels values>

Pixel values are limited to 256 levels of intensity (i.e., 0-255 decimal or 0x00-0xFF hexadecimal). A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image. For example, 0xFF is full intensity in hexadecimal (255 in decimal), 0x00 is no intensity (0 in decimal). A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte. Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components (e.g., 0xFF0000 is red, 0x00FF00 is green, 0x0000FF is blue). Four-component images specify the alpha opacity byte after red/green/blue (e.g., 0x0000FF80 is semi-transparent blue). A value of 0x00 is completely transparent, 0xFF is completely opaque. Note that alpha equals (1.0 - transparency), if alpha and transparency range from 0.0 to 1.0.

Each pixel is read as a single unsigned number. For example, a 3-component pixel with value 0x0000FF may also be written as 0xFF (hexadecimal) or 255 (decimal). Pixels are specified from left to right, bottom to top. The first hexadecimal value is the lower left pixel and the last value is the upper right pixel.

For example,

    fooImage 1 2 1 0xFF 0x00

is a 1 pixel wide by 2 pixel high one-component (i.e., greyscale) image, with the bottom pixel white and the top pixel black. As another example,

    fooImage 2 4 3 0xFF0000 0xFF00 0 0 0 0 0xFFFFFF 0xFFFF00
                   # red    green  black.. white    yellow

is a 2 pixel wide by 4 pixel high RGB image, with the bottom left pixel red, the bottom right pixel green, the two middle rows of pixels black, the top left pixel white, and the top right pixel yellow.

The initial value of an SFImage eventOut is (0 0 0).

--- VRML separator bar ---


Constructor & Destructor Documentation

SFImage  )  [inline]
 

SFImage const unsigned int  w,
const unsigned int  h,
const unsigned int  n
[inline]
 

SFImage const SFImage i  )  [inline]
 

~SFImage  )  [inline]
 


Member Function Documentation

unsigned int height  )  const [inline]
 

unsigned int numComponents  )  const [inline]
 

SFImage & operator= const SFImage  )  [inline]
 

bool operator== const SFImage i  )  const [inline]
 

unsigned char * pixels  )  [inline]
 

const unsigned char * pixels  )  const [inline]
 

void setDimensions const unsigned int  w,
const unsigned int  h,
const unsigned int  n
[inline]
 

FieldTypeId typeId  )  [inline, static]
 

const char * typeName  )  [inline, static]
 

unsigned int width  )  const [inline]
 


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  s,
const SFImage f
[friend]
 


Member Data Documentation

unsigned int height_
 

unsigned int numComponents_
 

unsigned char* pixels_
 

unsigned int width_
 


Generated on 24 Feb 2005 with doxygen version 1.3.9.1. Valid HTML 4.0! Valid CSS!