Class GreyImage
java.lang.Object
uk.ac.starlink.ttools.plot2.layer.GreyImage
A greyscale image backed by a a byte buffer.
The buffer is initially set to zero values, corresponding to black.
White corresponds to byte values of 255.
Trial and error suggests that it is more efficient in time,
though not in memory, to use greyscale than bitmap images
(BufferedImage.TYPE_BYTE_BINARY), even if only bitmap type values
are required.
- Since:
- 26 Nov 2013
- Author:
- Mark Taylor
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic GreyImage
createGreyImage
(int width, int height) Factory method to create an instance.Returns a pixel iterator that iterates over all the pixels that have been altered (are non-white) in this image.byte[]
Returns the byte array backing the image.getImage()
Returns the greyscale image.
-
Method Details
-
getImage
Returns the greyscale image.- Returns:
- image
-
getBuffer
public byte[] getBuffer()Returns the byte array backing the image.- Returns:
- byte array
-
createPixer
Returns a pixel iterator that iterates over all the pixels that have been altered (are non-white) in this image. In the current implementation this is not efficient to be re-used.- Returns:
- iterator over non-white pixels
-
createGreyImage
Factory method to create an instance.- Parameters:
width
- image width in pixelsheight
- image height in pixels
-