Class RGBColor
- java.lang.Object
-
- science.aist.imaging.api.domain.color.Color
-
- science.aist.imaging.api.domain.color.RGBColor
-
- All Implemented Interfaces:
Serializable
,ThreeChannelColor
public class RGBColor extends Color implements ThreeChannelColor
Class the represents an RGB color
- Since:
- 1.0
- Author:
- Andreas Pointner
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
createColorRepresentation(RGBColor rgbColor)
static RGBColor
createRGBColor(int color)
static RGBColor
darken(RGBColor color, float amount)
Darkens a color by a given amountdouble
getBlue()
double
getChannel1()
double
getChannel2()
double
getChannel3()
int
getColorRepresentation()
double
getGreen()
double
getRed()
boolean
isCompatibleWithType(ChannelType channelType)
Checks if color is compatible with channel typestatic RGBColor
lighten(RGBColor color, float amount)
Lightens a color by a given amountvoid
setBlue(double blue)
void
setChannel1(double channel)
void
setChannel2(double channel)
void
setChannel3(double channel)
void
setGreen(double green)
void
setRed(double red)
-
Methods inherited from class science.aist.imaging.api.domain.color.Color
equals, getChannel, getChannels, getChannelsShort, getNumberOfChannels, hashCode
-
-
-
-
Field Detail
-
WHITE
public static final transient RGBColor WHITE
White RGB Color
-
BLACK
public static final transient RGBColor BLACK
Black RGB Color
-
RED
public static final transient RGBColor RED
Red RGB Color
-
GREEN
public static final transient RGBColor GREEN
Green RGB Color
-
BLUE
public static final transient RGBColor BLUE
Blue RGB Color
-
-
Method Detail
-
createRGBColor
public static RGBColor createRGBColor(int color)
- Parameters:
color
- rgb color representation int in form- Returns:
- a new rgbColor object
-
createColorRepresentation
public static int createColorRepresentation(RGBColor rgbColor)
- Parameters:
rgbColor
- RGBColor object- Returns:
- converts into a int value which represents the rgb color value
-
lighten
public static RGBColor lighten(RGBColor color, float amount)
Lightens a color by a given amount- Parameters:
color
- The color to lightenamount
- The amount to lighten the color. 0 will leave the color unchanged; 1 will make the color completely white- Returns:
- The bleached color
-
darken
public static RGBColor darken(RGBColor color, float amount)
Darkens a color by a given amount- Parameters:
color
- The color to darkenamount
- The amount to darken the color. 0 will leave the color unchanged; 1 will make the color completely black- Returns:
- The stained color
-
getRed
public double getRed()
-
setRed
public void setRed(double red)
-
getGreen
public double getGreen()
-
setGreen
public void setGreen(double green)
-
getBlue
public double getBlue()
-
setBlue
public void setBlue(double blue)
-
getColorRepresentation
public int getColorRepresentation()
-
getChannel1
public double getChannel1()
- Specified by:
getChannel1
in interfaceThreeChannelColor
- Returns:
- The first channel for the represented color
-
setChannel1
public void setChannel1(double channel)
- Specified by:
setChannel1
in interfaceThreeChannelColor
- Parameters:
channel
- The first channel for the represented color
-
getChannel2
public double getChannel2()
- Specified by:
getChannel2
in interfaceThreeChannelColor
- Returns:
- The second channel for the represented color
-
setChannel2
public void setChannel2(double channel)
- Specified by:
setChannel2
in interfaceThreeChannelColor
- Parameters:
channel
- The second channel for the represented color
-
getChannel3
public double getChannel3()
- Specified by:
getChannel3
in interfaceThreeChannelColor
- Returns:
- The third channel for the represented color
-
setChannel3
public void setChannel3(double channel)
- Specified by:
setChannel3
in interfaceThreeChannelColor
- Parameters:
channel
- The third channel for the represented color
-
isCompatibleWithType
public boolean isCompatibleWithType(ChannelType channelType)
Description copied from class:Color
Checks if color is compatible with channel type- Overrides:
isCompatibleWithType
in classColor
- Parameters:
channelType
- to be checked- Returns:
- true iff compatible
-
-