Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

SoSFImage Class Reference

The SoSFImage class is used to store pixel images. More...

#include <Inventor/fields/SoSFImage.h>

Inheritance diagram for SoSFImage::

SoSField SoField List of all members.

Public Methods

const unsigned char * getValue (SbVec2s &size, int &nc) const
void setValue (const SbVec2s &size, const int nc, const unsigned char *bytes)
int operator== (const SoSFImage &field) const
int operator!= (const SoSFImage &field) const
unsigned char * startEditing (SbVec2s &size, int &nc)
void finishEditing (void)

Static Public Methods

void initClass (void)

Detailed Description

The SoSFImage class is used to store pixel images.

The SoSFImage class provides storage for inline 2D image maps. Images in Coin are mainly used for texture mapping support.

SoSFImage instances can be exported and imported as any other field class in Coin.

The components of an SoSFImage is: its image dimensions (width and height), the number of bytes used for describing each pixel and an associated pixel buffer. The size of the pixel buffer will be width * height * bytesperpixel.

For texture maps, the bytes per pixel setting translates to: 1 byte means a grayscale imagemap, 2 bytes is grayscale + opacity (i.e. alpha value), 3 bytes is 8-bit red + 8-bit green + 8-bit blue (aka RGB) and 4 bytes per pixel means 3 bytes for RGB + 1 byte opacity value (aka RGBA).

See also:
SoTexture2


Member Function Documentation

void SoSFImage::initClass void    [static]
 

Internal method called upon initialization of the library (from SoDB::init()) to set up the type system.

Reimplemented from SoSField.

const unsigned char * SoSFImage::getValue SbVec2s   size,
int &    nc
const
 

Return pixel buffer, set size to contain the image dimensions and nc to the number of components in the image.

void SoSFImage::setValue const SbVec2s   size,
const int    nc,
const unsigned char *    bytes
 

Initialize this field to size and nc.

If bytes is not NULL, the image data is copied from bytes into this field. If bytes is NULL, the image data is cleared by setting all bytes to 0 (note that the behavior on passing a NULL pointer is specific for Coin, Open Inventor will crash if you try it).

The image dimensions is given by the size argument, and the nc argument specifies the number of bytes-pr-pixel. A 24-bit RGB image would for instance have an nc equal to 3.

int SoSFImage::operator== const SoSFImage &    field const
 

Compare image of field with the image in this field and return TRUE if they are equal.

int SoSFImage::operator!= const SoSFImage &    field const [inline]
 

Compare image of field with the image in this field and return FALSE if they are equal.

unsigned char * SoSFImage::startEditing SbVec2s   size,
int &    nc
 

Return pixel buffer, set size to contain the image dimensions and nc to the number of components in the image.

The field's container will not be notified about the changes until you call finishEditing().

void SoSFImage::finishEditing void   
 

Notify the field's auditors that the image data has been modified.


The documentation for this class was generated from the following files:
Generated on Sat Jan 12 11:41:16 2002 for Coin by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001