ColorPaint Class
Simple helper for Paint class.
Methods
create
(
static
color
Creates new color Paint object in several ways.
- one parameter: hexadecimal color formatted 0xAARRGGBB, AA = alpha, RR = red, GG = green, BB = blue
- two paramaters: hex color and stroke's style
- three parameters: red, green, blue - all ranged 0..255
- four paramterers: alpha, red, green, blue - all ranged 0..255
Parameters:
-
color
Integer multipleThe color, can be expresed as one integer, three colors RGB components or four ARGB components.
Example:
var opaqueBlue = ColorPaint.create(0xff0000ff);
var opaqueRed = ColorPaint.create(255, 0, 0);
var semiGreen = ColorPaint.create(128, 0, 255, 0);
// it is possible to use 2nd parameter for stroke style
var opaqueSolidBlueForRect = ColorPaint.create(0xff0000ff, #fill);
canvas.draw(10, 10, 100, 100, opaqueSolidBlueForRect);
stock
() static
Returns stocked objects. Predefined colors:
- transparent
- black - fully opaque black
- white - fully opaque white
- red - fully opaque red
- green - fully opaque green
- blue - fully opaque blue
- silver - fully opaque silver (218, 218, 218) or (0xDA, 0xDA, 0xDA)
Example:
canvas.drawRect(10, 10, 100, 100, ColorPaint.stock().red);