class VirtualScreenImpl extends java.lang.Object implements VirtualScreen
Modifier and Type | Field and Description |
---|---|
private java.awt.image.DirectColorModel |
colorModel
The color model that defines pixels representation
|
private int |
height
The screen height.
|
private int[] |
pixels
The pixels array.
|
private java.awt.image.BufferedImage |
screen
The canvas in a memory to draw images.
|
private int |
width
The screen width.
|
Constructor and Description |
---|
VirtualScreenImpl(java.awt.image.DirectColorModel colorModel,
int width,
int height)
Constructs a virtual screen of the given width and height based on the given pixels model.
|
VirtualScreenImpl(int width,
int height)
Constructs a virtual screen with the default color model model as sRGB 32bits per a pixel.
|
Modifier and Type | Method and Description |
---|---|
void |
drawImage(ImageWrapper<?> image,
int x,
int y)
Draw an image at the target position on the screen.
|
java.awt.image.DirectColorModel |
getColorModel()
Describes a pixel format used for drawing.
|
int[] |
getPixels()
Returns RGBA model via pixels, each pixel is encoded as an integer.
|
int |
getScreenHeight()
Gets a screen height.
|
int |
getScreenWidth()
Gets a screen width.
|
private final java.awt.image.DirectColorModel colorModel
private final int width
private final int height
private final int[] pixels
private final java.awt.image.BufferedImage screen
public VirtualScreenImpl(int width, int height)
width
- The screen width.height
- The screen height.public VirtualScreenImpl(java.awt.image.DirectColorModel colorModel, int width, int height)
colorModel
- The pixels model based on sRGB.width
- The screen width.height
- The screen height.public int[] getPixels()
getPixels
in interface VirtualScreen
public int getScreenWidth()
getScreenWidth
in interface VirtualScreen
public int getScreenHeight()
getScreenHeight
in interface VirtualScreen
public java.awt.image.DirectColorModel getColorModel()
getColorModel
in interface VirtualScreen
public void drawImage(ImageWrapper<?> image, int x, int y)
drawImage
in interface VirtualScreen
image
- The target image.x
- The x-coordinate of the target image position.y
- The y-coordinate of the target image position.