|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot2.paper.RgbImage
public class RgbImage
An efficiently stored RGB or RGBA image backed by an int buffer.
Each pixel is represented by a 4-byte int, with the three least-significant
bytes giving 0-255 levels of red, green, blue (msb->lsb)
and, optionally, the most significant byte giving alpha.
This corresponds to the BufferedImage
constants
TYPE_INT_RGB
and TYPE_INT_ARGB
.
The values in the buffer are therefore the same as those used by
BufferedImage
setRGB
/getRGB
,
but can (presumably) be manipulated more efficiently by addressing the
array here directly.
These RGB values are also the same as those used by Compositor
.
Note: in tests, painting a colour on the image's
graphics context does not seem to give exactly the expected result
in terms of ARGB values in the buffer, though it's not far off.
See the RgbImageTest
testcase for more discussion.
Method Summary | |
---|---|
static RgbImage |
createRgbImage(int width,
int height,
boolean hasAlpha)
Constructs an RgbImage. |
int[] |
getBuffer()
Returns the data as a modifiable int array. |
BufferedImage |
getImage()
Returns the data as a BufferedImage. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public BufferedImage getImage()
public int[] getBuffer()
public static RgbImage createRgbImage(int width, int height, boolean hasAlpha)
width
- width in pixelsheight
- height in pixelshasAlpha
- true for ARGB, false for RGB
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |