SbImage(3)

๐Ÿ“ฆ version 2.5.0, in fedora 43, fedora 44

๐ŸŒธ NAME ๐ŸŒธ

SbImage โ€” bestie, this is the SbImage class, and it's an abstract datatype for 2D and 3D images. Yes, both. We contain multitudes. ๐Ÿ’…

(Also hi, this is the SbImage(3) page from the Library Functions Manual, just so you know where you are. ๐Ÿซถ)


โœจ 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 ()
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 SbString searchForFile (const SbString &basename, const SbString *const *dirlist, const int numdirs)

๐Ÿ’– Detailed Description ๐Ÿ’–

The SbImage class is an abstract datatype for 2D and 3D images. That's the whole vibe, honestly.

Heads up bestie: this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. So if you're out here expecting it in old-school Inventor, it's giving โœจnot thereโœจ.

Since: Coin 1.0 ๐ŸŒฑ


๐ŸŽ€ Constructor & Destructor Documentation ๐ŸŽ€

SbImage::SbImage (void )

Default constructor. No thoughts, head empty, just vibes. ๐Ÿฆ‹

Referenced by getValue(), operator!=(), operator=(), and operator==().

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

Constructor which sets 2D data using setValue(). Two-dimensional era. ๐Ÿ–ผ๏ธ

See also: setValue()

References setValue().

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

Constructor which sets 3D data using setValue(). We're going deep now (literally, there's a z-axis). ๐Ÿ”ฅ

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

References setValue().

SbImage::~SbImage (void )

Destructor. It's the end of an era, we're logging off, goodbye forever ๐Ÿ’€ (but like, respectfully).


๐Ÿงš Member Function Documentation ๐Ÿงš

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

Convenience 2D version of setValue. Same energy, flatter shape. โœจ

References setValue().

Referenced by operator=(), readFile(), SbImage(), SbImage(), scheduleReadFile(), and setValue().

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

Sets the image to size and bytesperpixel. Okay so here's the tea:

  • If bytes != NULL, data is copied from bytes into this class' image data. Cozy, it made a copy, it's committed. ๐Ÿซถ
  • If bytes == NULL, the image data is left uninitialized. Not me leaving things undefined... ๐Ÿ™ˆ

The image data will always be allocated in multiples of four. So 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. It's an inside-baseball thing, iykyk. โšพ

If the depth of the image (size[2]) is zero, the image is considered a 2D image. Depth check said nope, we're flat. ๐Ÿ’…

Since: Coin 2.0

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

Convenience 2D version of setValuePtr. The two-dee twin. ๐ŸŽ€

See also: setValue()

Since: Coin 2.0

References setValuePtr().

Referenced by operator=(), readFile(), and setValuePtr().

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. So like... you're handing over the keys but keeping the car. Not a copy, not a babysitter. Just pointing at it. ๐Ÿ‘€

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. Handing you the flat goods. ๐Ÿ–ผ๏ธ

References getValue(), and SbVec2s::setValue().

Referenced by getValue().

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

Returns the 3D image data. Now with bonus depth, the third dimension said hello. ๐Ÿ”ฅ

Since: Coin 2.0

References SbImage().

SbVec3s SbImage::getSize (void ) const

Returns the size of the image. Okay so:

  • If this is a 2D image, the z component is zero.
  • If this is a 3D image, the z component is >= 1.

Either way, the z is telling you exactly what kind of situation you're in. ๐Ÿ‘‘

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 webpages. ๐Ÿ“ฅ

  • If loading fails for some reason this method returns FALSE, and the instance is set to an empty image. Rude, but honest. ๐Ÿ˜ญ
  • If the file is successfully loaded, the file image data is copied into this class. Slay. โœจ

If numdirectories > 0, this method will search for filename in all directories in searchdirectories. Detective mode: activated. ๐Ÿ•ต๏ธ

References SbString::getLength(), SbString::getString(), SoDebugError::post(), SoDebugError::postWarning(), searchForFile(), setValue(), and setValuePtr().

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

Compare image of image with the image in this class and return TRUE if they are equal. Twin check! ๐Ÿ‘ฏ

References readLock(), readUnlock(), and SbImage().

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 of operator==, in a cute way. ๐Ÿ’…

References SbImage().

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

Assignment operator. Copy the vibe, become the vibe. ๐ŸŒˆ

References SbImage(), setValue(), and setValuePtr().

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

Given a basename for a file and an array of directories to search (in dirlist, of length numdirs), returns the full name of the file found. Glow-up from short name to full name. ๐Ÿ’–

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 checks every room in the house, no cap. ๐Ÿ 

If no file matching basename could be found, returns an empty string. Ghosted. ๐Ÿ‘ป

References SbPList::getLength(), and SoInput::searchForFile().

Referenced by readFile(), and scheduleReadFile().

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. Basically the "are you actually there or just pretending" check. ๐Ÿซฃ

Since: Coin 2.0

References readLock(), and readUnlock().

Referenced by SoVRMLImageTexture::doAction().

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 โ€” everybody can look, nobody can touch. ๐Ÿšซโœ‹

For the single thread version of Coin, this method does nothing. (Nothing to guard when you're the only one there, bestie.)

See also: readUnlock()

Since: Coin 2.0

Referenced by hasData(), and operator==().

void SbImage::readUnlock (void ) const

Release a read lock on this image. Unclench, we're done here. ๐Ÿ˜ฎโ€๐Ÿ’จ

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

See also: readLock()

Since: Coin 2.0

Referenced by hasData(), and operator==().

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.

Do not read the image in the callback, as this will lock up the application. Fr fr. Do not do it. That's a whole frozen app situation and nobody wants that. ๐Ÿ’€

See also: readFile()

Since: Coin 2.0

References searchForFile(), and setValue().


๐Ÿฆ‹ Author ๐Ÿฆ‹

Generated automatically by Doxygen for Coin from the source code. So it's not like a human wrote it, it's a robot doing its little thing and honestly, respect the hustle. ๐Ÿค–โœจ


And that's the whole page, bestie! This manual came to you courtesy of Coin, Version 2.5.0, and it's the SbImage(3) page โ€” go forth and image responsibly. Periodt. ๐Ÿ’œ๐ŸŽ€๐ŸŒˆ

๐Ÿ“ฆ where this page comes from