SbImage(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SbImage(3) β€” the Coin manual, but make it make sense πŸ’–

okay bestie, so this page is from Coin, and it's all about the SbImage class. buckle up, it's giving iconic data-type energy πŸŽ€


✨ NAME ✨

SbImage β€” the SbImage class is an abstract data type for 2D and 3D images. no cap, that's the whole job description πŸ¦‹


✨ SYNOPSIS ✨

#include <Inventor/SbImage.h>

🌸 Public Member Functions 🌸

SbImage (void)
SbImage (const unsigned char *bytes, const SbVec2s &size, const int bytesperpixel)
SbImage (const unsigned char *bytes, const SbVec3s &size, const int bytesperpixel)
SbImage (const SbImage &image)
~SbImage ()
void setValue (const SbVec2s &size, const int bytesperpixel, const unsigned char *bytes)
void setValue (const SbVec3s &size, const int bytesperpixel, const unsigned char *bytes)
void setValuePtr (const SbVec2s &size, const int bytesperpixel, const unsigned char *bytes)
void setValuePtr (const SbVec3s &size, const int bytesperpixel, const unsigned char *bytes)
unsigned char * getValue (SbVec2s &size, int &bytesperpixel) const
unsigned char * getValue (SbVec3s &size, int &bytesperpixel) const
SbVec3s getSize (void) 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
SbImage & operator= (const SbImage &image)
SbBool hasData (void) const
void readLock (void) const
void readUnlock (void) const
SbBool scheduleReadFile (SbImageScheduleReadCB *cb, void *closure, const SbString &filename, const SbString *const *searchdirectories=NULL, const int numdirectories=0)

🌈 Static Public Member Functions 🌈

static void addReadImageCB (SbImageReadImageCB *cb, void *closure)
static void removeReadImageCB (SbImageReadImageCB *cb, void *closure)
static SbString searchForFile (const SbString &basename, const SbString *const *dirlist, const int numdirs)

πŸ’… Detailed Description πŸ’…

The SbImage class is an abstract data type for 2D and 3D images. that's it, that's the vibe 🌸

⚠️ real talk though: this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. so if you go looking for it in the old-school API, she's simply not there πŸ’€

Since β€” Coin 1.0 ✨


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

SbImage::SbImage (void )

Default constructor. the blank canvas, the empty page, the pre-glow-up era πŸ¦‹


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

Constructor which sets 2D data using setValue(). she's a shortcut, your honor ✨

See also β€” setValue()


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

Constructor which sets 3D data using setValue(). three-dimensional glow-up πŸ”₯

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

See also β€” setValue()

Since β€” Coin 2.0


SbImage::SbImage (const SbImage & that)

Copy constructor. twin. twin where have you been πŸ‘―

Since β€” Coin 4.0


SbImage::~SbImage (void )

Destructor. she's leaving the group chat, goodbye gorgeous 🫢


πŸ‘‘ Member Function Documentation πŸ‘‘

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

Convenience 2D version of setValue. two-dimensional, one-hundred-percent that girl ✨


void SbImage::setValue (const SbVec3s & 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 β€” like, literally just vibes, nothing in there πŸ™ˆ

The image data will always be allocated in multiples of four. This means that if you set an image with size == (1,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. lowkey just a behind-the-scenes thing, don't stress bestie πŸ’…

If the depth of the image (size[2]) is zero, the image is considered a 2D image.

Since β€” Coin 2.0


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

Convenience 2D version of setValuePtr. the two-dimensional sibling πŸ¦‹

See also β€” setValue()

Since β€” Coin 2.0


void SbImage::setValuePtr (const SbVec3s & size, const int bytesperpixel, const unsigned char * bytes)

Sets the image data without copying the data. bytes will be used directly, and the data will not be freed when the image instance is destructed. it's giving "you're on your own for memory management, bestie" β€” so keep an eye on that pointer, fr fr πŸ‘€

If the depth of the image (size[2]) is zero, the image is considered a 2D image.

See also β€” setValue()

Since β€” Coin 2.0


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

Returns the 2D image data. hand it over 🫴


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

Returns the 3D image data. the extra dimension, the plot twist 🌈

Since β€” Coin 2.0


SbVec3s SbImage::getSize (void ) const

Returns the size of the image. If this is a 2D image, the z component is zero. If this is a 3D image, the z component is >= 1. so if z is 0, she's flat, and that's valid ✨

Since β€” Coin 2.0


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 web pages. 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. detective mode activated πŸ”


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

Compare image of image with the image in this class and return TRUE if they are equal. twinning fr fr πŸ‘―


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. the hater version of the above 😌


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

Assignment operator. become her. main character energy πŸ‘‘


void SbImage::addReadImageCB (SbImageReadImageCB * cb, void * closure) [static]

Add a callback which will be called whenever Coin wants to read an image file. The callback should return TRUE if it was able to successfully read and set the image data, and FALSE otherwise.

The callback(s) will be called before attempting to use simage to load images. so your callback gets first dibs, periodt πŸ’…

See also β€” removeReadImageCB()

Since β€” Coin 3.0


void SbImage::removeReadImageCB (SbImageReadImageCB * cb, void * closure) [static]

Remove a read image callback added with addReadImageCB(). okay bye, we're removing you from the roster πŸ™ˆ

See also β€” addReadImageCB()

Since β€” Coin 3.0


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. she's thorough, she checks every room in the house 🏠✨

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


SbBool SbImage::hasData (void ) const

Returns TRUE if the image is not empty. This can be useful, since getValue() will start loading the image if scheduleReadFile() has been used to set the image data. vibe check before you go poking at the data βœ…

Since β€” Coin 2.0


void SbImage::readLock (void ) const

Apply a read lock on this image. This will make it impossible for other threads to change the image while this lock is active. Other threads can do read-only operations on this image, of course. no writing while we're reading, bestie 🚫✍️

For the single thread version of Coin, this method does nothing. literally nothing, a no-op, a nap 😴

See also β€” readUnlock()

Since β€” Coin 2.0


void SbImage::readUnlock (void ) const

Release a read lock on this image. you're free, go, live your life πŸ¦‹

For the single thread version of Coin, this method does nothing. also just vibes.

See also β€” readLock()

Since β€” Coin 2.0


SbBool SbImage::scheduleReadFile (SbImageScheduleReadCB * cb, void * closure, const SbString & filename, const SbString *const * searchdirectories = NULL, const int numdirectories = 0)

Schedule a file for reading. cb will be called the first time getValue() is called for this image, and the callback should then start a thread to read the image.

🚨 IMPORTANT, GIRLIE: do not read the image in the callback, as this will lock up the application. do not do it. do not. it will freeze everything and it'll be so embarrassing πŸ’€

See also β€” readFile()

Since β€” Coin 2.0


🌸 Author 🌸

Generated automatically by Doxygen for Coin from the source code. the robots wrote this one, not me πŸŽ€


okay that's the whole page bestie, every last flag, signature and caveat, nothing skipped, we ate and left no crumbs πŸ’…βœ¨

and a lil sign-off: this is Version 4.0.10, dated Thu Jun 25 2026 00:00:00 β€” so when you see SbImage(3) down in the footer, that's just her signature, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from