Class GreyImage
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.GreyImage
-
public class GreyImage extends java.lang.Object
A greyscale image backed by a a byte buffer. The buffer is initially set to zero values, corresponding to white. Black 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:
GraphicsBitmap
,RgbImage
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GreyImage
createGreyImage(int width, int height)
Factory method to create an instance.Pixer
createPixer()
Returns a pixel iterator that iterates over all the pixels that have been altered (are non-white) in this image.byte[]
getBuffer()
Returns the byte array backing the image.java.awt.image.BufferedImage
getImage()
Returns the greyscale image.
-
-
-
Method Detail
-
getImage
public java.awt.image.BufferedImage getImage()
Returns the greyscale image.- Returns:
- image
-
getBuffer
public byte[] getBuffer()
Returns the byte array backing the image.- Returns:
- byte array
-
createPixer
public Pixer 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
public static GreyImage createGreyImage(int width, int height)
Factory method to create an instance.- Parameters:
width
- image width in pixelsheight
- image height in pixels
-
-