Package steganography.image.overlays
Class SequenceOverlay
- java.lang.Object
-
- steganography.image.overlays.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()).
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.image.BufferedImage
bufferedImage
protected int
currentPosition
protected int
currentX
protected int
currentY
protected java.util.List<java.lang.Integer>
pixelOrder
-
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 valueprotected boolean
typeAccepted(int type)
Checks whether the type of the given image is accepted by this overlay.
-
-
-
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 interfacePixelCoordinateOverlay
- 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 interfacePixelCoordinateOverlay
- Parameters:
value
- the value to set the current pixel to
-
available
public int available()
Description copied from interface:PixelCoordinateOverlay
Returns the number of remaining pixels (not yet returned by next())- Specified by:
available
in interfacePixelCoordinateOverlay
- Returns:
- number of remaining pixels
-
-