SoSFImage(3)

๐Ÿ“ฆ
version 4.0.10 ยท 4 versions
, in fedora 43, fedora 44

โœจ SoSFImage(3) โœจ

okay so this is the Coin manual page for SoSFImage(3) โ€” and bestie, it's a whole vibe. ๐Ÿ’–


๐ŸŒธ NAME ๐ŸŒธ

SoSFImage โ€” the class that stores pixel images, periodt. ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

#include <Inventor/fields/SoSFImage.h>

Inherits SoSField, no cap. ๐Ÿซถ

๐Ÿ’– Public Types ๐Ÿ’–

  • enum CopyPolicy { COPY, NO_COPY, NO_COPY_AND_DELETE, NO_COPY_AND_FREE }

๐ŸŒˆ Public Types inherited from SoField ๐ŸŒˆ

  • enum FieldType { NORMAL_FIELD = 0, EVENTIN_FIELD, EVENTOUT_FIELD, EXPOSED_FIELD }

๐Ÿ’… Public Member Functions ๐Ÿ’…

  • virtual SoType getTypeId (void) const
  • virtual void copyFrom (const SoField &field)
  • const SoSFImage & operator= (const SoSFImage &field)
  • virtual SbBool isSame (const SoField &field) const
  • const unsigned char * getValue (SbVec2s &size, int &nc) const
  • const SbImage & getValue () const
  • void setValue (const SbVec2s &size, const int nc, const unsigned char *pixels, CopyPolicy copypolicy=COPY)
  • int operator== (const SoSFImage &field) const
  • int operator!= (const SoSFImage &field) const
  • unsigned char * startEditing (SbVec2s &size, int &nc)
  • void finishEditing (void)
  • void setSubValue (const SbVec2s &dims, const SbVec2s &offset, unsigned char *pixels)
  • void setSubValues (const SbVec2s *dims, const SbVec2s *offsets, int num, unsigned char **pixelblocks)
  • unsigned char * getSubTexture (int idx, SbVec2s &dims, SbVec2s &offset) const
  • SbBool hasSubTextures (int &numsubtextures)
  • void setNeverWrite (SbBool flag)
  • SbBool isNeverWrite (void) const
  • SbBool hasTransparency (void) const

โœจ Public Member Functions inherited from SoSField โœจ

  • virtual ~SoSField ()

๐Ÿฆ‹ Public Member Functions inherited from SoField ๐Ÿฆ‹

  • virtual ~SoField ()
  • void setIgnored (SbBool ignore)
  • SbBool isIgnored (void) const
  • void setDefault (SbBool defaultVal)
  • SbBool isDefault (void) const
  • SbBool isOfType (const SoType type) const
  • void enableConnection (SbBool flag)
  • SbBool isConnectionEnabled (void) const
  • SbBool connectFrom (SoEngineOutput *master, SbBool notnotify=FALSE, SbBool append=FALSE)
  • SbBool appendConnection (SoEngineOutput *master, SbBool notnotify=FALSE)
  • void disconnect (SoEngineOutput *engineoutput)
  • SbBool isConnectedFromEngine (void) const
  • SbBool getConnectedEngine (SoEngineOutput *&master) const
  • SbBool connectFrom (SoField *master, SbBool notnotify=FALSE, SbBool append=FALSE)
  • SbBool appendConnection (SoField *master, SbBool notnotify=FALSE)
  • void disconnect (SoField *field)
  • SbBool isConnectedFromField (void) const
  • SbBool getConnectedField (SoField *&master) const
  • int getNumConnections (void) const
  • int getForwardConnections (SoFieldList &slavelist) const
  • int getConnections (SoFieldList &masterlist) const
  • void disconnect (void)
  • SbBool isConnected (void) const
  • void setContainer (SoFieldContainer *cont)
  • SoFieldContainer * getContainer (void) const
  • SbBool set (const char *valuestring)
  • void get (SbString &valuestring)
  • SbBool shouldWrite (void) const
  • virtual void touch (void)
  • virtual void startNotify (void)
  • virtual void notify (SoNotList *nlist)
  • SbBool enableNotify (SbBool on)
  • SbBool isNotifyEnabled (void) const
  • void addAuditor (void *f, SoNotRec::Type type)
  • void removeAuditor (void *f, SoNotRec::Type type)
  • int operator== (const SoField &f) const
  • int operator!= (const SoField &f) const
  • virtual void connectionStatusChanged (int numconnections)
  • SbBool isReadOnly (void) const
  • virtual void fixCopy (SbBool copyconnections)
  • virtual SbBool referencesCopy (void) const
  • void copyConnection (const SoField *fromfield)
  • virtual SbBool read (SoInput *input, const SbName &name)
  • virtual void write (SoOutput *out, const SbName &name) const
  • virtual void countWriteRefs (SoOutput *out) const
  • void setFieldType (int type)
  • int getFieldType (void) const
  • SbBool getDirty (void) const
  • void setDirty (SbBool dirty)
  • void evaluate (void) const

โญ Static Public Member Functions โญ

  • static void * createInstance (void)
  • static SoType getClassTypeId (void)
  • static void initClass (void)

๐ŸŒธ Static Public Member Functions inherited from SoSField ๐ŸŒธ

  • static void initClass (void)
  • static SoType getClassTypeId (void)
  • static void atexit_cleanup (void)

๐Ÿ’œ Static Public Member Functions inherited from SoField ๐Ÿ’œ

  • static void initClass (void)
  • static void initClasses (void)
  • static void cleanupClass (void)
  • static SoType getClassTypeId (void)

๐Ÿ‘‘ Additional Inherited Members ๐Ÿ‘‘

๐Ÿ“ Protected Member Functions inherited from SoSField ๐Ÿ“

  • SoSField (void)

๐Ÿงš Protected Member Functions inherited from SoField ๐Ÿงš

  • SoField (void)
  • void valueChanged (SbBool resetdefault=TRUE)
  • virtual void evaluateConnection (void) const
  • virtual SbBool readConnection (SoInput *in)
  • virtual void writeConnection (SoOutput *out) const
  • SbBool isDestructing (void) const
  • virtual SoNotRec createNotRec (SoBase *cont)

๐Ÿ’– Detailed Description ๐Ÿ’–

SoSFImage is the class that holds pixel images. That's literally its whole job, and it ate. ๐Ÿ”ฅ

It gives you storage for inline 2D image maps, and in Coin, images are mostly used to support texture mapping. You can export and import SoSFImage instances just like any other field class in Coin. ๐Ÿ’ซ

The components of an SoSFImage are: its image dimensions (width and height), the number of bytes used to describe each pixel (the number of components), and an associated pixel buffer. The size of that pixel buffer is width*height*components. ๐Ÿงฎ

For texture maps, the components / bytes-per-pixel setting translates like this: use 1 for a grayscale imagemap, 2 for grayscale + opacity (i.e. alpha value), 3 for RGB (1 byte each for red, green and blue), and 4 components means 3 bytes for RGB + 1 byte opacity value (aka RGBA). ๐ŸŒˆ

This field is serializable into the Inventor / Coin file format in the following manner:

FIELDNAME X Y C 0xRRGGBBAA 0xRRGGBBAA ...

X and Y are the image dimensions along the given axes, and C is the number of components in the image. The number of 0xRRGGBBAA pixel color specifications needs to equal the exact number of pixels, which of course is given by X*Y. Each part of the pixel color value is in the range 0x00 to 0xff (hexadecimal, 0 to 255 decimal). ๐Ÿ’…

For 3-component images, the pixel-format is 0xXXRRGGBB, where the byte in the pixel color value marked as XX is ignored and can be left out. ๐Ÿ‘‘

For 2-component images, the pixel-format is 0xXXXXGGAA, where the bytes in the pixel color values marked as XX are ignored and can be left out. GG is the part which gives a grayscale value and AA is for opacity. ๐ŸŽ€

For 1-component images, the pixel-format is 0xXXXXXXGG, where the bytes in the pixel color values marked as XX are ignored and can be left out. ๐ŸŒธ

The pixels are read as being ordered in rows along X (width) and columns along Y (height, bottom to top). ๐Ÿฆ‹

Here's a simple example of the file format serialization, for a 2x2 RGB-image inside an SoTexture2 node, as mapped onto an SoCube:

Complexity { textureQuality 0.1 }   # set low to avoid smoothing

Texture2 {
   image 2 2 4

   0xffffffff 0x00ff0088   # white   semi-transparent green
   0xff0000ff 0xffff00ff   #  red    yellow
}

Cube { }

The mini-scene graph above results in the following mapping on the cube: ๐ŸงŠ

The cube has only been slightly rotated, so as you can see from the snapshot, the Y-rows are mapped from bottom to top, while the X-column pixels are mapped onto the cube from left to right. ๐Ÿ‘€


๐ŸŒˆ See also ๐ŸŒˆ

  • SoTexture2
  • SoSFImage3

โœจ Member Function Documentation โœจ

okay bestie, this is the part where we go function by function and I tell you what each one actually does. no skipping, we're doing all of them, periodt ๐Ÿ’…


๐ŸŒธ void * SoSFImage::createInstance (void ) [static]

okay so this one is internal to the library, like it's not really for you, the application programmer โ€” the docs literally say it's "not likely to be of interest to the application programmer". it makes a brand new instance of the class type that goes with the SoType object. that's it, that's the whole thing. iykyk ๐Ÿซถ

๐ŸŒธ SoType SoSFImage::getClassTypeId (void ) [static]

a static method that hands you back the SoType object tied to objects of this class. that's the vibe check for "what even are you, class-wise" โœจ

๐ŸŒธ SoType SoSFImage::getTypeId (void ) const [virtual]

this gives you the type identification of an object derived from a class that inherits SoField. you use it for runtime type checking and "downward" casting โ€” like peeking at the actual type at runtime and casting down the hierarchy. no cap.

it implements SoField.

๐ŸŒธ void SoSFImage::copyFrom (const SoField & f) [virtual]

copies the value(s) from f into this field. important: f has to be the same type as this field, or it's not gonna go how you want it to. ๐Ÿ’€

it implements SoField.

๐ŸŒธ SbBool SoSFImage::isSame (const SoField & f) const [virtual]

checks whether f has the same type and the same value(s). returns a bool, obviously. ๐Ÿ‘‘

it implements SoField.

๐ŸŒธ void SoSFImage::initClass (void ) [static]

internal method, called when the library gets initialized โ€” from SoDB::init() โ€” to set up the type system. not your business, but now you know. ๐ŸŽ€

๐ŸŒธ const unsigned char * SoSFImage::getValue (SbVec2s & size, int & nc) const

returns the pixel buffer, sets size to hold the image dimensions, and sets nc to the number of components in the image. three things at once, she's efficient like that โœจ

๐ŸŒธ const SbImage & SoSFImage::getValue () const

returns the values โ€” specifically the SbImage contained by this SoSFImage. that's the whole return value, bestie, no hidden lore.

๐ŸŒธ void SoSFImage::setValue (const SbVec2s & size, const int nc, const unsigned char * pixels, SoSFImage::CopyPolicy copypolicy = COPY)

okay this one is the main character and she has a LOT going on, so listen up ๐ŸŒˆ

this initializes the field to size and nc.

if pixels is not NULL, the image data gets copied from pixels into this field. if pixels is NULL, the image data is cleared by setting all bytes to 0 โ€” and heads up, that NULL-pointer behavior is specific to Coin: Open Inventor will literally crash if you try it ๐Ÿ˜ญ

the image dimensions come from the size argument, and nc is the number of bytes-per-pixel. so a 24-bit RGB image would have an nc equal to 3. math is mathing ๐Ÿ“

the copypolicy argument lets you share image data with SoSFImage without the data getting copied (which uses fewer memory resources). the default is to copy the image data from the pixels source into an internal copy. ๐Ÿซถ

important note: if you call this with copypolicy as either NO_COPY_AND_DELETE or NO_COPY_AND_FREE, and your app is running on Microsoft Windows, be aware that you'll get mysterious crashes if your application is not using the same C library runtime as the Coin library. ๐Ÿ’€

the cause of this: a memory block would get allocated by the application on the memory heap of one C library runtime (say, for instance MSVCRT.LIB), but then attempted to be deallocated in the memory heap of another C library runtime (e.g. MSVCRTD.LIB) โ€” and that typically leads to hard-to-debug crashes. not the vibe, protect your peace.

Since:

  • The CopyPolicy argument was added in Coin 2.0.
  • CopyPolicy was added to TGS Inventor 3.0.

๐ŸŒธ int SoSFImage::operator== (const SoSFImage & field) const

compares the image of field with the image in this field and returns TRUE if they're equal. ๐Ÿ’–

๐ŸŒธ int SoSFImage::operator!= (const SoSFImage & field) const [inline]

compares the image of field with the image in this field and returns FALSE if they're equal. yes it's the inverse twin, they're matching ๐ŸŽ€

๐ŸŒธ unsigned char * SoSFImage::startEditing (SbVec2s & size, int & nc)

returns the pixel buffer, and returns the image size and components in size and nc.

you cannot use this method to set a new image size โ€” use setValue() to change the size of the image buffer, okay? don't fight her on this ๐Ÿ™ˆ

and the field's container will not be notified about the changes until you call finishEditing(). so don't forget the follow-up, bestie.

๐ŸŒธ void SoSFImage::finishEditing (void )

notifies the field's auditors that the image data has been modified. this is the "and THAT'S the update" text you send after startEditing(). ๐Ÿฆ‹

๐ŸŒธ void SoSFImage::setSubValue (const SbVec2s & dims, const SbVec2s & offset, unsigned char * pixels)

Not yet implemented for Coin. get in touch if you need this method โ€” like, actually reach out, they said so.

Since:

  • Coin 2.0
  • TGS Inventor 3.0

๐ŸŒธ void SoSFImage::setSubValues (const SbVec2s * dims, const SbVec2s * offsets, int num, unsigned char ** pixelblocks)

Not yet implemented for Coin. get in touch if you need this method. same energy, same offer ๐Ÿซถ

Since:

  • Coin 2.0
  • TGS Inventor 3.0

๐ŸŒธ unsigned char * SoSFImage::getSubTexture (int idx, SbVec2s & dims, SbVec2s & offset) const

Not yet implemented for Coin. get in touch if you need this method.

Since:

  • Coin 2.0
  • TGS Inventor 3.0

๐ŸŒธ SbBool SoSFImage::hasSubTextures (int & numsubtextures)

returns whether or not sub textures were set up for this field. ๐Ÿงš

if TRUE is returned, the numsubtextures argument gets set to the number of sub textures in this image. that number can be used for iterating over all the textures with the SoSFImage::getSubTextures() method. iconic behavior, honestly.

Since:

  • Coin 2.0
  • TGS Inventor 3.0

๐ŸŒธ void SoSFImage::setNeverWrite (SbBool flag)

set this flag to true to avoid writing out the texture to file โ€” which can save a lot on file size. ๐Ÿ“‰

default value is FALSE (i.e. write texture data to file.)

(Note: yet unimplemented for Coin.)

Since:

  • Coin 2.0
  • TGS Inventor ?.?

๐ŸŒธ SbBool SoSFImage::isNeverWrite (void ) const

returns the value of the "never write texture data" flag.

See also: SoSFImage::setNeverWrite()

Since:

  • Coin 2.0
  • TGS Inventor ?.?

๐ŸŒธ SbBool SoSFImage::hasTransparency (void ) const

returns TRUE if at least one pixel of the image in this field is not completely opaque, otherwise FALSE. literally just "is anything see-through in here" ๐Ÿ‘€

Since:

  • Coin 2.0
  • TGS Inventor ?.?

๐Ÿ’œ Author

Generated automatically by Doxygen for Coin from the source code. (the robots wrote this one, not me, slay for them though ๐Ÿค–โœจ)


and that's the whole page bestie!! ๐ŸŽ€ this was Coin version 4.0.10, dated Thu Jun 25 2026 00:00:00, and the manpage is SoSFImage(3). go forth and texture responsibly, ily, bye ๐Ÿ’–๐Ÿฆ‹๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from