public class RgbImage extends Object
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.
Modifier and Type | Method and Description |
---|---|
static RgbImage |
createRgbImage(int width,
int height,
boolean hasAlpha)
Constructs an RgbImage with default background colour.
|
static RgbImage |
createRgbImage(int width,
int height,
boolean hasAlpha,
int bg)
Constructs an RgbImage with a given background coour.
|
int[] |
getBuffer()
Returns the data as a modifiable int array.
|
BufferedImage |
getImage()
Returns the data as a BufferedImage.
|
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 RGBpublic static RgbImage createRgbImage(int width, int height, boolean hasAlpha, int bg)
width
- width in pixelsheight
- height in pixelshasAlpha
- true for ARGB, false for RGBbg
- initial value for all elements in the image bufferCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.