SbImage(3)
๐ธ 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 frombytesinto 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
- fedora 43: Coin2-devel 2.5.0-52.fc43 ยท GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 ยท GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 ยท GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms