SoSFImage(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

πŸ’… SoSFImage(3) β€” Library Functions Manual πŸ’…

okay bestie, welcome to the SoSFImage page. Manual name is SoSFImage(3), and it's giving pixel-storage realness. no cap.

✨ NAME ✨

SoSFImage β€” the SoSFImage class is used to store pixel images. periodt.

🌸 SYNOPSIS 🌸

#include <Inventor/fields/SoSFImage.h>

Inherits SoSField.

πŸŽ€ Public Types πŸŽ€

  • enum CopyPolicy { COPY, NO_COPY, NO_COPY_AND_DELETE, NO_COPY_AND_FREE } β€” the copy-policy choices, bestie. pick your fighter.

πŸ¦‹ Public Types inherited from SoField πŸ¦‹

  • enum FieldType { NORMAL_FIELD = 0, EVENTIN_FIELD, EVENTOUT_FIELD, EXPOSED_FIELD } β€” inherited field-type enum, iconic.

πŸ‘‘ Public Member Functions πŸ‘‘

  • virtual SoType getTypeId (void) const β€” get that type id, fr fr.
  • virtual void copyFrom (const SoField &field) β€” copy from another field.
  • const SoSFImage & operator= (const SoSFImage &field) β€” assignment operator, slay.
  • virtual SbBool isSame (const SoField &field) const β€” same or not? vibe check.
  • const unsigned char * getValue (SbVec2s &size, int &nc) const β€” hands you the pixel buffer pointer, fills in size and nc.
  • void setValue (const SbVec2s &size, const int nc, const unsigned char *pixels, CopyPolicy copypolicy=COPY) β€” set the value; default copy policy is COPY.
  • int operator== (const SoSFImage &field) const β€” equality check.
  • int operator!= (const SoSFImage &field) const β€” inequality check.
  • unsigned char * startEditing (SbVec2s &size, int &nc) β€” start editing, get a writable pointer.
  • void finishEditing (void) β€” finish editing, done and dusted.
  • void setSubValue (const SbVec2s &dims, const SbVec2s &offset, unsigned char *pixels) β€” set a sub-value.
  • void setSubValues (const SbVec2s *dims, const SbVec2s *offsets, int num, unsigned char **pixelblocks) β€” set a bunch of sub-values.
  • unsigned char * getSubTexture (int idx, SbVec2s &dims, SbVec2s &offset) const β€” grab a sub-texture by index.
  • SbBool hasSubTextures (int &numsubtextures) β€” do we have sub-textures? fills the count.
  • void setNeverWrite (SbBool flag) β€” set the never-write flag.
  • SbBool isNeverWrite (void) const β€” is never-write on?
  • SbBool hasTransparency (void) const β€” transparency check, very main character.

πŸ’œ Public Member Functions inherited from SoSField πŸ’œ

  • virtual ~SoSField () β€” destructor, bye bestie.

πŸ’– Public Member Functions inherited from SoField πŸ’–

inherited from SoField, still part of the squad:

  • virtual ~SoField ()
  • void setIgnored (SbBool ignore)
  • SbBool isIgnored (void) const
  • void setDefault (SbBool def)
  • SbBool isDefault (void) const
  • SbBool isOfType (const SoType type) const
  • void enableConnection (SbBool flag)
  • SbBool isConnectionEnabled (void) const
  • SbBool connectFrom (SoEngineOutput *master, SbBool notnotify=0, SbBool append=0)
  • SbBool appendConnection (SoEngineOutput *master, SbBool notnotify=0)
  • void disconnect (SoEngineOutput *engineoutput)
  • SbBool isConnectedFromEngine (void) const
  • SbBool getConnectedEngine (SoEngineOutput *&master) const
  • SbBool connectFrom (SoField *master, SbBool notnotify=0, SbBool append=0)
  • SbBool appendConnection (SoField *master, SbBool notnotify=0)
  • 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 *in, 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 Public Member Functions inherited from SoField 🌈

  • static void initClass (void)
  • static void initClasses (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=1)
  • virtual void evaluateConnection (void) const
  • virtual SbBool readConnection (SoInput *in)
  • virtual void writeConnection (SoOutput *out) const
  • SbBool isDestructing (void) const

πŸ’– Detailed Description πŸ’–

okay so the SoSFImage class is used to store pixel images. that's the whole vibe.

SoSFImage provides storage for inline 2D image maps. Images in Coin are mainly used for texture mapping support. periodt.

SoSFImage instances can be exported and imported as any other field class in Coin. no special treatment, just iconic behavior.

The components of an SoSFImage are: its image dimensions (width and height), the number of bytes used for describing each pixel (number of components), and an associated pixel buffer. The size of the pixel buffer will be width*height*components. math is mathing.

For texture maps, the components / bytes-per-pixel setting translates as follows:

  • use 1 for a grayscale imagemap
  • use 2 for grayscale + opacity (i.e. alpha value)
  • use 3 for RGB (1 byte each for red, green and blue)
  • 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, 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). bottom to top, bestie. remember that.

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-scenegraph 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 member function lore. every single one. no skipping. πŸ’…

SoType SoSFImage::getTypeId (void ) const [virtual] πŸ’–

Returns the type identification instance which uniquely identifies the Coin field class the object belongs to. It's virtual, and it implements SoField.

  • See also: getClassTypeId(), SoType
  • Implements: SoField

void SoSFImage::copyFrom (const SoField & f) [virtual] 🫢

Copy value(s) from f into this field. f must be of the same type as this field.

  • Implements: SoField

SbBool SoSFImage::isSame (const SoField & f) const [virtual] ✨

Check for equal type and value(s).

  • Implements: SoField

const unsigned char * SoSFImage::getValue (SbVec2s & size, int & nc) const πŸ¦‹

Return pixel buffer, set size to contain the image dimensions and nc to the number of components in the image.

  • References: SoField::evaluate()
  • Referenced by: SoTextureCubeMap::GLRender()

void SoSFImage::setValue (const SbVec2s & size, const int nc, const unsigned char * pixels, SoSFImage::CopyPolicy copypolicy = COPY) πŸ’–

Initialize this field to size and nc.

If pixels is not NULL, the image data is copied from pixels into this field. If pixels is NULL, the image data is cleared by setting all bytes to 0 (note that the behavior on passing a NULL pointer is specific for Coin, Open Inventor will crash if you try it).

The image dimensions is given by the size argument, and the nc argument specifies the number of bytes-pr-pixel. A 24-bit RGB image would for instance have an nc equal to 3.

The copypolicy argument makes it possible to share image data with SoSFImage without the data being copied (thereby using less memory resources). The default is to copy 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 application is running on Mirosoft Windows, be aware that you will get mysterious crashes if your application is not using the same C library run-time as the Coin library.

The cause of this is that a memory block would then be allocated by the application on the memory heap of one C library run-time (say, for instance MSVCRT.LIB), but attempted deallocated in the memory heap of another C library run-time (e.g. MSVCRTD.LIB), which typically leads to hard-to-debug crashes.

  • Since:
    • The CopyPolicy argument was added in Coin 2.0.
    • CopyPolicy was added to TGS Inventor 3.0.
  • References: SoField::valueChanged()

int SoSFImage::operator== (const SoSFImage & field) const πŸ‘‘

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

int SoSFImage::operator!= (const SoSFImage & field) const [inline] πŸ’…

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

  • References: SoField::operator==()

unsigned char * SoSFImage::startEditing (SbVec2s & size, int & nc) πŸŽ€

Return pixel buffer. Return the image size and components in size and nc.

You can not use this method to set a new image size. Use setValue() to change the size of the image buffer.

The field's container will not be notified about the changes until you call finishEditing().

void SoSFImage::finishEditing (void ) 🌸

Notify the field's auditors that the image data has been modified.

  • References: SoField::valueChanged()

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.

  • Since:
    • Coin 2.0
    • TGS Inventor 3.0
  • References: SoDebugError::postWarning()

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.

  • Since:
    • Coin 2.0
    • TGS Inventor 3.0
  • References: SoDebugError::postWarning()

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
  • References: SoDebugError::postWarning()

SbBool SoSFImage::hasSubTextures (int & numsubtextures) 🌈

Returns whether or not sub textures was set up for this field.

If TRUE is returned, the numsubtextures argument will be set to the number of sub textures in this image. This number can be used for iterating over all textures with the SoSFImage::getSubTextures() method.

  • 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. This 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 ?.?
  • References: SoDebugError::postWarning()

SbBool SoSFImage::isNeverWrite (void ) const ⭐

Returns value of "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.

  • Since:
    • Coin 2.0
    • TGS Inventor ?.?
  • References: SoDebugError::postWarning()

✍️ Author

Generated automatically by Doxygen for Coin from the source code.


And that's the whole page, bestie! The footer is giving Coin, Version 2.5.0, SoSFImage(3) β€” no date in the footer, so we're just gonna say today is a slay. Stay iconic, keep those pixels safe, and don't let Mirosoft Windows catch you lacking. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from