Class Pixels
java.lang.Object
org.openpatch.scratch.Pixels
The pixels of the stage or of an image file, to read colours from. Coordinates count pixels
from the top left corner (0, 0).
Pixels terrain = Pixels.of("assets/terrain.png");
boolean solid = terrain.getColor(10, 20).getAlpha() > 0;
Pixels screen = Pixels.of(this.getStage());
The stage's pixels are what its world layers show at that moment: backdrop, stage colour, pen strokes, stamps and sprites with their effects, the same as colour sensing sees. Texts, shaders and the UI layer are not included.
-
Method Summary
-
Method Details
-
of
-
of
-
getWidth
public int getWidth()- Returns:
- the width in pixels
-
getHeight
public int getHeight()- Returns:
- the height in pixels
-
getColor
- Parameters:
x- pixels from the left edgey- pixels from the top edge- Returns:
- the colour there, or transparent black outside
-
getArgb
public int getArgb(int x, int y) - Parameters:
x- pixels from the left edgey- pixels from the top edge- Returns:
- the colour there packed as alpha, red, green, blue, or 0 outside
-