Class ImageModelJ2D

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable

    public class ImageModelJ2D
    extends ImageModel
    An opaque class which encapsulates all the image manipulation logics, and allows the implementation of these logics to be transparently changed (e.g. by using or not JAI, etc...)
    Author:
    Fabrizio Giudici
    See Also:
    Serialized Form
    • Constructor Detail

      • ImageModelJ2D

        public ImageModelJ2D​(@Nonnull
                             java.lang.Object bufferedImage)
        Creates a new EditableImage given a BufferedImage
        Parameters:
        bufferedImage - the buffered image
    • Method Detail

      • createImage

        @Nonnull
        public static EditableImage createImage​(@Nonnull
                                                java.awt.image.BufferedImage bufferedImage)
      • getWidth

        @Nonnegative
        public int getWidth()
        Specified by:
        getWidth in class ImageModel
      • getHeight

        @Nonnegative
        public int getHeight()
        Specified by:
        getHeight in class ImageModel
      • getColorModel

        @Nonnull
        public java.awt.image.ColorModel getColorModel()
        Specified by:
        getColorModel in class ImageModel
      • getMemorySize

        @Nonnegative
        public long getMemorySize()
        Returns an estimate of the memory allocated by this image. The default implementation returns the number of pixels multiplied by the number of bands multiplied the size in bytes of each pixel. Can be overridden for more accurate implementations.
        Overrides:
        getMemorySize in class ImageModel
        Returns:
        the memory allocated for this image
      • createCopy

        @Nonnull
        public EditableImage createCopy​(boolean copyContents)
        Creates a similar image, that is a blank image with the same characteristics of this image (width, height, data type, sample model, color model).
        Specified by:
        createCopy in class ImageModel
        Returns:
        a new, similar image
      • getInnerProperty

        @Nonnull
        public <T> T getInnerProperty​(@Nonnull
                                      java.lang.Class<T> propertyClass)
        Specified by:
        getInnerProperty in class ImageModel
      • toObjectForDeserialization

        @Nonnull
        protected java.lang.Object toObjectForDeserialization​(@Nonnull
                                                              java.awt.image.RenderedImage renderedImage)
        Specified by:
        toObjectForDeserialization in class ImageModel