Package dev.avelar.mapnik
Class Color
java.lang.Object
dev.avelar.mapnik.Color
An RGBA colour with 8 bits per channel. Parse one from anything Mapnik's style files accept: a name
(
"rebeccapurple"), "#rrggbb", "#rrggbbaa" or "rgba(r,g,b,a)" with a
from 0 to 1. Colours are accepted wherever the API also takes a colour string.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintalpha()Alpha from 0 (transparent) to 255 (opaque).intblue()booleanstatic ColorfromArgb(int argb) From0xAARRGGBB, the layout ofImage.getArgb(int, int).intgreen()inthashCode()booleanisOpaque()static ColorParse a colour string.intred()static Colorrgb(int red, int green, int blue) inttoArgb()As0xAARRGGBB.toHex()#rrggbb, or#rrggbbaawhen not opaque.toString()Mapnik's own spelling, for examplergb(255,0,0)orrgba(255,0,0,0.5).
-
Field Details
-
WHITE
-
BLACK
-
TRANSPARENT
-
-
Constructor Details
-
Color
public Color(int red, int green, int blue, int alpha) Each channel from 0 to 255.
-
-
Method Details
-
rgb
-
fromArgb
From0xAARRGGBB, the layout ofImage.getArgb(int, int). -
parse
Parse a colour string. ThrowsMapnikExceptionif Mapnik does not understand it. -
red
public int red() -
green
public int green() -
blue
public int blue() -
alpha
public int alpha()Alpha from 0 (transparent) to 255 (opaque). -
isOpaque
public boolean isOpaque() -
toArgb
public int toArgb()As0xAARRGGBB. -
toHex
#rrggbb, or#rrggbbaawhen not opaque. -
equals
-
hashCode
public int hashCode() -
toString
Mapnik's own spelling, for examplergb(255,0,0)orrgba(255,0,0,0.5).
-