Catalano.Imaging
Class Color
- java.lang.Object
-
- Catalano.Imaging.Color
-
public class Color extends java.lang.ObjectRepresents RGB color.
-
-
Field Summary
Fields Modifier and Type Field and Description intbBlue channel's component.static ColorBlackBlack.static ColorBlueBlue.static ColorCyanCyan.static ColorDarkGrayDark Gray.intgGreen channel's component.static ColorGrayGray.static ColorGreenGreen.static ColorLightGrayLight Gray.static ColorMagentaMagenta.static ColorOrangeOrange.static ColorPinkPink.intrRed channel's component.static ColorRedRed.static ColorWhiteWhite.static ColorYellowYellow.
-
Constructor Summary
Constructors Constructor and Description Color()Initialize a new instance of the Color class.Color(int rgb)Initialize a new instance of the Color class.Color(int[] rgb)Initialize a new instance of the Color class.Color(int red, int green, int blue)Initialize a new instance of the Color class.Color(java.lang.String hex)Initialize a new instance of the Color class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static intCount(FastBitmap fastBitmap)Count many colors has in the image.booleanequals(java.lang.Object obj)static booleanisEqual(Color c1, Color c2)Compare two colors.java.lang.StringtoHex()Convert RGB to Hex representation.static java.lang.StringtoHex(int red, int green, int blue)Convert RGB to Hex representation.static inttoPackedRGB(int red, int green, int blue)Pack the rgb values into an int representation.
-
-
-
Field Detail
-
Black
public static final Color Black
Black. R: 0 G: 0 B: 0
-
Blue
public static final Color Blue
Blue. R: 0 G: 0 B: 255
-
Cyan
public static final Color Cyan
Cyan. R: 0 G: 255 B: 255
-
DarkGray
public static final Color DarkGray
Dark Gray. R: 64 G: 64 B: 64
-
Gray
public static final Color Gray
Gray. R: 128 G: 128 B: 128
-
Green
public static final Color Green
Green. R: 0 G: 255 B: 0
-
LightGray
public static final Color LightGray
Light Gray. R: 192 G: 192 B: 192
-
Magenta
public static final Color Magenta
Magenta. R: 255 G: 0 B: 255
-
Orange
public static final Color Orange
Orange. R: 255 G: 200 B: 0
-
Pink
public static final Color Pink
Pink. R: 255 G: 175 B: 175
-
Red
public static final Color Red
Red. R: 255 G: 0 B: 0
-
Yellow
public static final Color Yellow
Yellow. R: 255 G: 200 B: 0
-
White
public static final Color White
White. R: 255 G: 255 B: 255
-
r
public int r
Red channel's component.
-
g
public int g
Green channel's component.
-
b
public int b
Blue channel's component.
-
-
Constructor Detail
-
Color
public Color()
Initialize a new instance of the Color class.
-
Color
public Color(int red, int green, int blue)Initialize a new instance of the Color class.- Parameters:
red- Red component.green- Green component.blue- Blue component.
-
Color
public Color(int[] rgb)
Initialize a new instance of the Color class.- Parameters:
rgb- RGB array.
-
Color
public Color(int rgb)
Initialize a new instance of the Color class.- Parameters:
rgb- Packed RGB.
-
Color
public Color(java.lang.String hex)
Initialize a new instance of the Color class.- Parameters:
hex- Hex color representation.
-
-
Method Detail
-
toPackedRGB
public static int toPackedRGB(int red, int green, int blue)Pack the rgb values into an int representation.- Parameters:
red- Red channel's component.green- Green channel's component.blue- Blue channel's component.- Returns:
- Packed RGB.
-
Count
public static int Count(FastBitmap fastBitmap)
Count many colors has in the image.- Parameters:
fastBitmap- Image to be procesed.- Returns:
- Number of colors.
-
isEqual
public static boolean isEqual(Color c1, Color c2)
Compare two colors.- Parameters:
c1- First color.c2- Second color.- Returns:
- True if the color is the same, otherwise false.
-
toHex
public static java.lang.String toHex(int red, int green, int blue)Convert RGB to Hex representation.- Parameters:
red- Red component.green- Green component.blue- Blue component.- Returns:
- Hex color representation.
-
toHex
public java.lang.String toHex()
Convert RGB to Hex representation.- Returns:
- Hex color representation.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG