Class Paint
java.lang.Object
lol.trq.helios.batch.Paint
How a shape is coloured: one colour, a gradient across its box, or a radial gradient from its centre. Colours are
packed
0xAARRGGBB, not premultiplied, and mixed per channel in sRGB.
Box gradients are bilinear between four corner colours; linear gradients at any angle are expressed exactly that way. For a line the box is the line itself, so a horizontal gradient runs from its start to its end.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Paintcorners(int topLeft, int topRight, int bottomRight, int bottomLeft) A different colour in each corner, blended bilinearly.static Painthorizontal(int left, int right) Left to right.static intlerp(int a, int b, float t) Mixes two packed colours per channel.static Paintlinear(float degrees, int from, int to) A linear gradient across the box at an angle; 0 degrees runs left to right, 90 top to bottom.static Paintradial(int centre, int edge, float radius) A radial gradient from the centre of the shape.static Paintsolid(int argb) One colour.static Paintvertical(int top, int bottom) Top to bottom.
-
Method Details
-
solid
-
corners
A different colour in each corner, blended bilinearly.- Parameters:
topLeft- top-left colourtopRight- top-right colourbottomRight- bottom-right colourbottomLeft- bottom-left colour- Returns:
- the paint
-
horizontal
Left to right.- Parameters:
left- colour at the left edgeright- colour at the right edge- Returns:
- the paint
-
vertical
Top to bottom.- Parameters:
top- colour at the top edgebottom- colour at the bottom edge- Returns:
- the paint
-
linear
A linear gradient across the box at an angle; 0 degrees runs left to right, 90 top to bottom.- Parameters:
degrees- the directionfrom- colour at the start cornerto- colour at the end corner- Returns:
- the paint
-
radial
A radial gradient from the centre of the shape.- Parameters:
centre- colour at the centreedge- colour atradiusand beyondradius- where the edge colour is reached; 0 or less means the shape's half width or half height, whichever is larger- Returns:
- the paint
-
lerp
public static int lerp(int a, int b, float t) Mixes two packed colours per channel.- Parameters:
a- the colour at 0b- the colour at 1t- the mix, clamped to[0, 1]- Returns:
- the mixed colour
-