Package uk.ac.starlink.ttools.plot
Class GraphicsBitmap
- java.lang.Object
-
- uk.ac.starlink.ttools.plot.GraphicsBitmap
-
public class GraphicsBitmap extends java.lang.Object
Allows one to draw 1-bit graphcs onto a graphics context and to retrieve the resulting bitmap in the form of a Pixellator.It took me ages slogging through the
java.awt.image
javadocs to work out how to get a graphics context backed by a primitive array buffer.- Since:
- 23 Aug 2007
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description GraphicsBitmap(int width, int height)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the bitmap.java.awt.Graphics2D
createGraphics()
Returns a graphics context which can draw monochrome graphics on this bitmap.Pixellator
createPixellator()
Returns a pixellator which will iterate over the painted pixels in this bitmap.Pixellator
createPixellator(java.awt.Rectangle bounds)
Returns a pixellator which will iterate over a sub-region of the painted pixels in this bitmap.int
getHeight()
Returns the height of this bitmap.int
getWidth()
Returns the width of this bitmap.
-
-
-
Method Detail
-
createGraphics
public java.awt.Graphics2D createGraphics()
Returns a graphics context which can draw monochrome graphics on this bitmap.- Returns:
- graphics context
-
clear
public void clear()
Clears the bitmap.
-
getWidth
public int getWidth()
Returns the width of this bitmap.- Returns:
- width
-
getHeight
public int getHeight()
Returns the height of this bitmap.- Returns:
- height
-
createPixellator
public Pixellator createPixellator()
Returns a pixellator which will iterate over the painted pixels in this bitmap. Pixels in the pixellator reflect the pixel state at iteration time.- Returns:
- bitmap pixellator
-
createPixellator
public Pixellator createPixellator(java.awt.Rectangle bounds)
Returns a pixellator which will iterate over a sub-region of the painted pixels in this bitmap. Pixels in the pixellator reflect the pixel state at iteration time.- Parameters:
bounds
- region of space for which the pixellator is wanted- Returns:
- bitmap subset pixellator
-
-