"Note"
Example : An image using the SoImage node This example displays an image using the SoImage node. The program source code is available in:
$OIVHOME/src/Inventor/examples/Features/
Image/image.cxx.
C++ :
C# :
Java :
figure_46817a2f-b9d3-4575-9af4-cfd44298da9c%* SoRasterImageRW
+ SoBMPImageRW + SoDDSImageRW + SoGIFImageRW + SoJP2ImageRW + SoJPEGImageRW + SoPGXImageRW + SoPNGImageRW + SoPNMImageRW + SoPSImageRW + SoSGIRGBImageRW + SoSUNImageRW + SoTIFFImageRW
Figure 5.31. Raster image classes
SoRasterImageRW allows you to read and write image buffers from/to a file. Subclasses are derived from this abstract class to support common graphic file formats such as BMP, DDS, GIF, JPEG2000, JPEG, PGX, PNG, PostScript, SGI (RGBA), RAS (Sun Raster), and TIFF. These classes dynamically load the format-specific libraries (libJPEG, libTIFF, libPNG...) only when needed.
Depending on the library capabilities, large UserGuide_Images are written using tiles two different ways: WRITE_SCANLINES or WRITE_FULL_IMAGE. For the WRITE_SCANLINES formats, the image can be written incrementally, some number of scanlines at a time. Therefore it is only necessary to allocate enough memory for a single tile, which at most will be the size of the maximum OpenGL viewport (typically 2048x2048). If it is WRITE_FULL_IMAGE, the whole image buffer must be allocated and tiles are copied into it; this is less efficient and requires more memory.
All of the classes dealing with image I/O in Open Inventor and its modules use this set of classes to read or write graphics files (SoImage, SoTexture2...) You can also create your own graphic file format import/export by deriving a subclass from SoRasterImageRW and implementing or overloading its methods:
C++ :
C# :
Java :
An example program in the distribution shows how to create your own graphics file reader/writer (PPM format). It can be found at: $OIVHOME/Inventor/examples/Features/RasterRW.