Class SequenceOverlay

  • All Implemented Interfaces:
    PixelCoordinateOverlay
    Direct Known Subclasses:
    ShuffleOverlay

    public class SequenceOverlay
    extends java.lang.Object
    implements PixelCoordinateOverlay
    This class returns Pixels of the underlying Bitmap in order from top left (x=0, y=0) to bottom right (x=bitmap.getWidth(), y=bitmap.getHeight()).
    • Constructor Summary

      Constructors 
      Constructor Description
      SequenceOverlay​(java.awt.image.BufferedImage bufferedImage)
      Creates a SequenceOverlay that returns Pixels of the underlying BufferedImage in order from top left (x=0, y=0) to bottom right (x=bitmap.getWidth(), y=bitmap.getHeight()).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      Returns the number of remaining pixels (not yet returned by next())
      protected void createOverlay()
      Creates the overlay as an independent method to address pixels without using BufferedImages coordinates.
      int next()
      Returns the next pixel value as an int (representing ARGB as its bytes), meaning the next pixel determined by the Overlay.
      void setPixel​(int value)
      Sets the current pixel to the given value
      protected boolean typeAccepted​(int type)
      Checks whether the type of the given image is accepted by this overlay.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bufferedImage

        protected final java.awt.image.BufferedImage bufferedImage
      • pixelOrder

        protected java.util.List<java.lang.Integer> pixelOrder
      • currentPosition

        protected int currentPosition
      • currentX

        protected int currentX
      • currentY

        protected int currentY
    • Constructor Detail

      • SequenceOverlay

        public SequenceOverlay​(java.awt.image.BufferedImage bufferedImage)
                        throws UnsupportedImageTypeException
        Creates a SequenceOverlay that returns Pixels of the underlying BufferedImage in order from top left (x=0, y=0) to bottom right (x=bitmap.getWidth(), y=bitmap.getHeight()).
        Parameters:
        bufferedImage - the BufferedImage to represent the pixels of.
        Throws:
        UnsupportedImageTypeException - if the type of bufferedImage is bnot supported by this overlay
    • Method Detail

      • typeAccepted

        protected boolean typeAccepted​(int type)

        Checks whether the type of the given image is accepted by this overlay.

        Overwritten by subclasses to apply their own rules for acceptance.

        Parameters:
        type - representation of an image type as an int of BufferedImage.imageType

        (type doesn't matter, for this overlay, but it may for subclasses)

        Returns:
        true if the images type is accepted by this overlay
      • createOverlay

        protected void createOverlay()

        Creates the overlay as an independent method to address pixels without using BufferedImages coordinates.

        Subclasses overwrite this method to use their own logic of creating the overlay.

      • next

        public int next()
                 throws java.util.NoSuchElementException
        Description copied from interface: PixelCoordinateOverlay
        Returns the next pixel value as an int (representing ARGB as its bytes), meaning the next pixel determined by the Overlay.
        Specified by:
        next in interface PixelCoordinateOverlay
        Returns:
        int representing the next pixel by the Overlay.
        Throws:
        java.util.NoSuchElementException - if there is no next pixel
      • setPixel

        public void setPixel​(int value)
        Description copied from interface: PixelCoordinateOverlay
        Sets the current pixel to the given value
        Specified by:
        setPixel in interface PixelCoordinateOverlay
        Parameters:
        value - the value to set the current pixel to