Interface MFImage

All Superinterfaces:
MField, X3DField
All Known Implementing Classes:
MFImageObject

public interface MFImage
extends MField
MFImage is an array of SFImage values.


Package hint: This interface is defined by the X3D Java Language Binding Specification for the Scene Authoring Interface (SAI).
See Also:
SAI Java Specification: B.4.18, SAI Abstract Specification: 5.2.15 SAIFieldType, X3D Abstract Specification: 5.3.6 SFImage and MFImage, X3D Tooltips, X3D Tooltips: field, X3D Tooltips: fieldValue, X3D Scene Authoring Hints
  • Method Summary

    Modifier and Type Method Description
    void append​(java.awt.image.RenderedImage[] newValue)
    Places a new value at the end of the existing value array, increasing the field length accordingly.
    int getComponents​(int imageIndex)
    Get the number of color components in the image.
    int getHeight​(int imageIndex)
    Get the height of the image array.
    java.awt.image.WritableRenderedImage getImage​(int imageIndex)
    Fetch the Java representation of the underlying image from these pixels.
    void getPixels​(int imageIndex, int[] pixels)
    Get the image pixel value in the given eventOut.
    int getWidth​(int imageIndex)
    Get the width of the image array.
    void insertValue​(int index, java.awt.image.RenderedImage newValue)
    Insert a new value prior to the index location in the existing value array, increasing the field length accordingly.
    void set1Value​(int imageIndex, int newValue)
    Replace a single value at the appropriate location in the existing value array.
    void set1Value​(int imageIndex, int width, int height, int components, int[] pixels)  
    void setImage​(int imageIndex, java.awt.image.RenderedImage image)
    Set the image value in the given writable field to the new image defined by a set of pixels.
    void setImage​(java.awt.image.RenderedImage[] image)  
    void setSubImage​(int imageIndex, java.awt.image.RenderedImage image, int sourceWidth, int sourceHeight, int sourceXOffset, int sourceYOffset, int destinationXOffset, int destinationYOffset)
    Copy a region of the argument RenderedImage to replace a portion of the current SFimage.
    void setValue​(int[] newValue)
    Assign a new value array containing imageIndex, width, height, and components count, followed by array of pixels.

    Methods inherited from interface org.web3d.x3d.sai.MField

    clear, remove, size

    Methods inherited from interface org.web3d.x3d.sai.X3DField

    addX3DEventListener, getDefinition, isReadable, isWritable, removeX3DEventListener
  • Method Details

    • getWidth

      int getWidth​(int imageIndex)
      Get the width of the image array.
      Parameters:
      imageIndex - the index of the selected image
      Returns:
      The width of the image in pixels
    • getHeight

      int getHeight​(int imageIndex)
      Get the height of the image array.
      Parameters:
      imageIndex - the index of the selected image
      Returns:
      The height of the image in pixels
    • getComponents

      int getComponents​(int imageIndex)
      Get the number of color components in the image. The value will always be between 1 and 4 indicating the number of components of the color specification to be read from the image pixel data.
      Parameters:
      imageIndex - the index of the selected image
      Returns:
      The number of components
    • getPixels

      void getPixels​(int imageIndex, int[] pixels)
      Get the image pixel value in the given eventOut.

      The number of items in the pixels array will be width * height. If there are less items than this an ArrayIndexOutOfBoundsException will be generated. The integer values are represented according to the number of components.

      1 Component Images
      The integer has the intensity value stored in the lowest byte and can be obtained:

          intensity = (pixel[i]     ) &0xFF;
        

      2 Component Images
      The integer has the transparency value stored in the lowest byte and the intensity in the next byte:

          intensity = (pixel[i] >> 8) &0xFF;
          alpha     = (pixel[i]     ) &0xFF;
        

      3 Component Images
      The three color components are stored in the integer array as follows:

          red   = (pixel[i] >> 16) &0xFF;
          green = (pixel[i] >>  8) &0xFF;
          blue  = (pixel[i]      ) &0xFF;
        

      4 Component Images
      The integer has the value stored in the array as follows:

          red   = (pixel[i] >> 24) &0xFF;
          green = (pixel[i] >> 16) &0xFF;
          blue  = (pixel[i] >>  8) &0xFF;
          alpha = (pixel[i]      ) &0xFF;
        

      The width and height values must be greater than or equal to zero. The number of components is between 1 and 4. Any value outside of these bounds will generate an IllegalArgumentException.

      Parameters:
      imageIndex - the index of the selected image
      pixels - The array to copy pixel values into
    • getImage

      java.awt.image.WritableRenderedImage getImage​(int imageIndex)
      Fetch the Java representation of the underlying image from these pixels. This is the same copy that the browser uses to generate texture information from.
      Parameters:
      imageIndex - the index of the selected image
      Returns:
      The image reference representing the current state
    • setImage

      void setImage​(int imageIndex, java.awt.image.RenderedImage image)
      Set the image value in the given writable field to the new image defined by a set of pixels.
      Parameters:
      imageIndex - the index of the selected image
      image - The new image to use as the source
    • setSubImage

      void setSubImage​(int imageIndex, java.awt.image.RenderedImage image, int sourceWidth, int sourceHeight, int sourceXOffset, int sourceYOffset, int destinationXOffset, int destinationYOffset)
      Copy a region of the argument RenderedImage to replace a portion of the current SFimage.

      The sub image set shall not resize the base image representation and therefore performs an intersection clip of the provided image. The user provided image shall be of the same format (pixel depth, pixel representation) as the original image obtained through the getImage() method.

      RenderedImages are row order from top to bottom. A 4x8 RenderImage is indexed as follows:

      
       X >01234567
         ----------
       0 |********|
       1 |********|
       2 |********|
       3 |********|
       ^ ----------
       Y
      
        
      SFImages are row order from bottom to top. A 4x8 RenderImage is indexed as follows:
      
       X >01234567
         ----------
       3 |********|
       2 |********|
       1 |********|
       0 |********|
       ^ ----------
       Y
      
        

      Note: The parameter srcYOffset is referenced to the RenderedImage object (indexed top to bottom).
      The parameter destYOffset is referenced to the SFImage object (indexed bottom to top).

      Parameters:
      imageIndex - the index of the selected image
      image - The new image to use as the source
      sourceWidth - The width of the argument sub-image region to copy
      sourceHeight - The height of the argument sub-image region to copy
      sourceXOffset - The initial x dimension (width) offset into the argument sub-image that begins the region to copy
      sourceYOffset - The initial y dimension (height) offset into the argument sub-image that begins the region to copy
      destinationXOffset - The initial x dimension (width) offset in the SFimage object that begins the region to receive the copy
      destinationYOffset - The initial y dimension (height) offset in the SFimage object that begins the region to receive the copy
    • set1Value

      void set1Value​(int imageIndex, int newValue)
      Replace a single value at the appropriate location in the existing value array. Size of the current underlying value array does not change.
      Parameters:
      imageIndex - the index of the selected image
      newValue - provides new value to apply
    • set1Value

      void set1Value​(int imageIndex, int width, int height, int components, int[] pixels)
    • setValue

      void setValue​(int[] newValue)
      Assign a new value array containing imageIndex, width, height, and components count, followed by array of pixels.
      Parameters:
      newValue - the newValue to set
    • setImage

      void setImage​(java.awt.image.RenderedImage[] image)
    • append

      void append​(java.awt.image.RenderedImage[] newValue)
      Places a new value at the end of the existing value array, increasing the field length accordingly.
      Parameters:
      newValue - The newValue to append
    • insertValue

      void insertValue​(int index, java.awt.image.RenderedImage newValue)
      Insert a new value prior to the index location in the existing value array, increasing the field length accordingly.
      Parameters:
      index - The position for the inserted value in the current array
      newValue - The newValue to insert