SbImage Class Reference
[Base classes]

The SbImage class is an abstract datatype for 2D images. More...

#include <Inventor/SbImage.h>

List of all members.

Public Member Functions

 SbImage (void)
 SbImage (const unsigned char *bytes, const SbVec2s &size, const int bytesperpixel)
 ~SbImage (void)
void setValue (const SbVec2s &size, const int bytesperpixel, const unsigned char *bytes)
unsigned char * getValue (SbVec2s &size, int &bytesperpixel) const
SbBool readFile (const SbString &filename, const SbString *const *searchdirectories=NULL, const int numdirectories=0)
int operator== (const SbImage &image) const
int operator!= (const SbImage &image) const

Static Public Member Functions

static SbString searchForFile (const SbString &basename, const SbString *const *dirlist, const int numdirs)


Detailed Description

The SbImage class is an abstract datatype for 2D images.

This class is a Coin extension to the original Open Inventor API.


Constructor & Destructor Documentation

SbImage::SbImage ( void   ) 

Default constructor.

SbImage::SbImage ( const unsigned char *  bytes,
const SbVec2s size,
const int  bytesperpixel 
)

Constructor which sets the data using setValue().

See also:
setValue()

SbImage::~SbImage ( void   ) 

Destructor.


Member Function Documentation

void SbImage::setValue ( const SbVec2s size,
const int  bytesperpixel,
const unsigned char *  bytes 
)

Sets the image to size and bytesperpixel. If bytes != NULL, data is copied from bytes into this class' image data. If bytes == NULL, the image data is left uninitialized.

The image data will always be allocated in multiples of four. This means that if you set an image with size == (1,1) and bytesperpixel == 1, four bytes will be allocated to hold the data. This is mainly done to simplify the export code in SoSFImage and normally you'll not have to worry about this feature.

unsigned char * SbImage::getValue ( SbVec2s size,
int &  bytesperpixel 
) const

Returns the image data.

SbBool SbImage::readFile ( const SbString filename,
const SbString *const *  searchdirectories = NULL,
const int  numdirectories = 0 
)

Reads image data from filename. In Coin, simage is used to load image files, and several common file formats are supported. simage can be downloaded from our webpages. If loading fails for some reason this method returns FALSE, and the instance is set to an empty image. If the file is successfully loaded, the file image data is copied into this class.

If numdirectories > 0, this method will search for filename in all directories in searchdirectories.

int SbImage::operator== ( const SbImage image  )  const

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

int SbImage::operator!= ( const SbImage image  )  const [inline]

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

SbString SbImage::searchForFile ( const SbString basename,
const SbString *const *  dirlist,
const int  numdirs 
) [static]

Given a basename for a file and and array of directories to search (in dirlist, of length numdirs), returns the full name of the file found.

In addition to looking at the root of each directory in dirlist, we also look into the subdirectories texture/, textures/, images/, pics/ and pictures/ of each dirlist directory.

If no file matching basename could be found, returns an empty string.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:30:07 2007 for Coin by  doxygen 1.5.3-20071008