Class SbRasterImage


  • public class SbRasterImage
    extends Inventor
    Class encapsulating a raster image and its attributes. This class encapsulates a raster image, including its size and number of color components.

    See Also:
    SoRasterImageRW
    • Constructor Detail

      • SbRasterImage

        public SbRasterImage​(SbVec2i32 size,
                             SbRasterImage.Components components,
                             SoBufferObject bufferObject)
        Constructor that initializes with an image. Image data is assumed to be packed (no padding between pixels or rows) and pixel components are assumed to be in RGBA order.
      • SbRasterImage

        public SbRasterImage()
        Constructor that creates an empty image.
      • SbRasterImage

        @Deprecated
        public SbRasterImage​(SbVec2i32 size,
                             SbRasterImage.Components components,
                             byte[] bytes)
        Deprecated.
        As of Open Inventor 9400. Use SbRasterImage constructor with SoBufferObject instead.
        Constructor that initializes with a large image.

        Warning Deprecated since Open Inventor 9400. Use SbRasterImage constructor with SoBufferObject instead.

      • SbRasterImage

        @Deprecated
        public SbRasterImage​(SbVec2s size,
                             SbRasterImage.Components components,
                             byte[] bytes)
        Deprecated.
        As of Open Inventor 9400. Use SbRasterImage constructor with SoBufferObject instead.
        Constructor that initializes with an image.

        Warning Deprecated since Open Inventor 9400. Use SbRasterImage constructor with SoBufferObject instead.

    • Method Detail

      • setSize

        public void setSize​(SbVec2s size)
        Sets the raster image size in pixels.
        The parameter is the size of the whole raster image. The maximum size that can be specified using this method is 32767 by 32767 (because the parameter is an SbVec2s). To specify a larger image size use the method setSize_i32.
      • getBuffer

        @Deprecated
        public byte[] getBuffer()
        Deprecated.
        As of Open Inventor 9400. Use SbRasterImage.getBufferObject() instead.
        Returns the pixel buffer of the raster image.

        Warning Deprecated since Open Inventor 9400. Use SbRasterImage.getBufferObject() instead.

      • getComponents

        public SbRasterImage.Components getComponents()
        Returns the number of components of each pixel as an enum.
        For example, an RGBA image returns RGB_TRANSPARENCY.
      • setComponents

        public void setComponents​(SbRasterImage.Components comp)
        Sets the number of components in each pixel of the raster image.
        For example, an RGB image has 3 components.
      • getNumMipmaps

        public int getNumMipmaps()
        Returns the number of mipmaps contained by the buffer.
      • getComponentsCount

        public int getComponentsCount()
        Returns the number of components of each pixel.
        Returns -1 in case of invalid or unknown components type.

        E.g: For an RGB image it returns 3 (R, G and B).

      • getBufferObject

        public SoBufferObject getBufferObject()
        Returns the pixel buffer of the raster image.
      • getComponentsSize

        public int getComponentsSize()
        Returns the size in bytes of each pixel in the image.
        Returns -1 in case of invalid or unknown components type.

        E.g: For an RGB image containing byte data, the pixel size is 3 bytes.

      • setSizei32

        public void setSizei32​(SbVec2i32 size)
        Sets the raster image size in pixels.
        The parameter is the size of the whole raster image to be saved. Use for sizes with at least one side greater than 32767.
      • setBuffer

        public void setBuffer​(SoBufferObject bufferObject)
        Sets the pixel buffer of the raster image.
        Image data is assumed to be packed (no padding between pixels or rows) and pixel components are assumed to be in RGBA order.
      • getSize

        public SbVec2s getSize()
        Returns the raster image size in pixels.
      • removeAlphaChannel

        public boolean removeAlphaChannel()
        Removes the Alpha channel from the current raster image. If the copy policy is COPY (Open Inventor owns the memory) then the buffer is reallocated with the correct size. Otherwise the content of the buffer is just modified.

        Returns:
        True if the format contains an alpha channel and it was possible to remove it.

      • getSizei32

        public SbVec2i32 getSizei32()
        Returns the raster image size in pixels for large images.