Package javascript.awt
Class Color
- java.lang.Object
-
- javascript.awt.Color
-
public class Color extends java.lang.ObjectThe java.awt.Color clone- Author:
- gianpiero.diblasi
-
-
Constructor Summary
Constructors Constructor Description Color(int red, int green, int blue, int alpha)Creates the object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidCMYKtoRGB(def.js.Array<java.lang.Integer> cmyk, def.js.Array<java.lang.Integer> rgb)Converts CMYK components of a color to a set of RGB componentsColordarkened(double darkeningFactor)Darkens this Color, the transparency is not changedstatic ColorfromARGB(int color)Creates a Color from a ARGB integer colorstatic ColorfromARGB_HEX(java.lang.String color)Creates a Color from an ARGB hex stringstatic ColorfromJSON(simulation.js.$Object json)Creates a Color from a JSON objectstatic ColorfromRGB(int color)Creates a Color from a RGB integer colorstatic ColorfromRGB_HEX(java.lang.String color)Creates a Color from an RGB hex stringstatic ColorfromRGBA(int color)Creates a Color from a RGBA integer colorstatic ColorfromRGBA_HEX(java.lang.String color)Creates a Color from an RGBA hex stringintgetARGB()Returns the ARGB integer representing this Colordef.js.Array<java.lang.Integer>getARGB_Components()Returns the components of this Colorjava.lang.StringgetARGB_HEX()Returns the ARGB hex string representing this Colorstatic def.js.Array<Color>getHistory()Returns the color historysimulation.js.$ObjectgetJSON()Returns this Color as a JSON objectintgetRGB()Returns the RGB integer representing this Colordef.js.Array<java.lang.Integer>getRGB_Components()Returns the components of this Colorjava.lang.StringgetRGB_HEX()Returns the RGB hex string representing this Colorjava.lang.StringgetRGB_String()Returns the RGB string representing this ColorintgetRGBA()Returns the RGBA integer representing this Colordef.js.Array<java.lang.Integer>getRGBA_Components()Returns the components of this Colorjava.lang.StringgetRGBA_HEX()Returns the RGBA hex string representing this Colorjava.lang.StringgetRGBA_String()Returns the RGBA string representing this ColorColorgray()Converts this Color to gray scaled, the transparency is not changedstatic voidHSLtoRGB(def.js.Array<java.lang.Double> hsl, def.js.Array<java.lang.Integer> rgb)Converts HSL components of a color to a set of RGB componentsstatic voidHSVtoRGB(def.js.Array<java.lang.Double> hsv, def.js.Array<java.lang.Integer> rgb)Converts HSV components of a color to a set of RGB componentsColorlighted(double lightingFactor)Lights up this Color, the transparency is not changedColornegative()Converts this Color to negative, the transparency is not changedstatic voidpushHistory(Color color)Pushes a color in the color history (if not already present)static voidresetHistory()Resets the color historystatic voidRGBtoCMYK(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Integer> cmyk)Converts RGB components of a color to a set of CMYK componentsstatic voidRGBtoHSL(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> hsl)Converts RGB components of a color to a set of HSL componentsstatic voidRGBtoHSV(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> hsv)Converts RGB components of a color to a set of HSV componentsstatic voidRGBtoYUV(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> yuv)Converts RGB components of a color to a set of YUV componentsstatic voidYUVtoRGB(def.js.Array<java.lang.Double> yuv, def.js.Array<java.lang.Integer> rgb)Converts YUV components of a color to a set of RGB components
-
-
-
Constructor Detail
-
Color
public Color(int red, int green, int blue, int alpha)Creates the object- Parameters:
red- The red component (in the range [0,255])green- The green component (in the range [0,255])blue- The blue component (in the range [0,255])alpha- The alpha component (in the range [0,255])
-
-
Method Detail
-
gray
public Color gray()
Converts this Color to gray scaled, the transparency is not changed- Returns:
- This gray scaled Color
-
negative
public Color negative()
Converts this Color to negative, the transparency is not changed- Returns:
- This negativized Color
-
lighted
public Color lighted(double lightingFactor)
Lights up this Color, the transparency is not changed- Parameters:
lightingFactor- The lighting factor (in the range [0,1])- Returns:
- This lighted Color
-
darkened
public Color darkened(double darkeningFactor)
Darkens this Color, the transparency is not changed- Parameters:
darkeningFactor- The darkening factor (in the range [0,1])- Returns:
- This darkened Color
-
getRGB
public int getRGB()
Returns the RGB integer representing this Color- Returns:
- The RGB integer representing this Color
-
getRGBA
public int getRGBA()
Returns the RGBA integer representing this Color- Returns:
- The RGBA integer representing this Color
-
getARGB
public int getARGB()
Returns the ARGB integer representing this Color- Returns:
- The ARGB integer representing this Color
-
getRGB_HEX
public java.lang.String getRGB_HEX()
Returns the RGB hex string representing this Color- Returns:
- The RGB hex string representing this Color
-
getRGB_String
public java.lang.String getRGB_String()
Returns the RGB string representing this Color- Returns:
- The RGB string representing this Color
-
getRGBA_HEX
public java.lang.String getRGBA_HEX()
Returns the RGBA hex string representing this Color- Returns:
- The RGBA hex string representing this Color
-
getRGBA_String
public java.lang.String getRGBA_String()
Returns the RGBA string representing this Color- Returns:
- The RGBA string representing this Color
-
getARGB_HEX
public java.lang.String getARGB_HEX()
Returns the ARGB hex string representing this Color- Returns:
- The ARGB hex string representing this Color
-
getRGB_Components
public def.js.Array<java.lang.Integer> getRGB_Components()
Returns the components of this Color- Returns:
- The components of Color
-
getRGBA_Components
public def.js.Array<java.lang.Integer> getRGBA_Components()
Returns the components of this Color- Returns:
- The components of Color
-
getARGB_Components
public def.js.Array<java.lang.Integer> getARGB_Components()
Returns the components of this Color- Returns:
- The components of Color
-
getJSON
public simulation.js.$Object getJSON()
Returns this Color as a JSON object- Returns:
- This Color as a JSON object
-
fromRGB
public static Color fromRGB(int color)
Creates a Color from a RGB integer color- Parameters:
color- The color- Returns:
- The Color
-
fromRGBA
public static Color fromRGBA(int color)
Creates a Color from a RGBA integer color- Parameters:
color- The color- Returns:
- The Color
-
fromARGB
public static Color fromARGB(int color)
Creates a Color from a ARGB integer color- Parameters:
color- The color- Returns:
- The Color
-
fromRGB_HEX
public static Color fromRGB_HEX(java.lang.String color)
Creates a Color from an RGB hex string- Parameters:
color- The color- Returns:
- The Color
-
fromRGBA_HEX
public static Color fromRGBA_HEX(java.lang.String color)
Creates a Color from an RGBA hex string- Parameters:
color- The color- Returns:
- The Color
-
fromARGB_HEX
public static Color fromARGB_HEX(java.lang.String color)
Creates a Color from an ARGB hex string- Parameters:
color- The color- Returns:
- The Color
-
fromJSON
public static Color fromJSON(simulation.js.$Object json)
Creates a Color from a JSON object- Parameters:
json- The JSON object- Returns:
- The Color
-
HSLtoRGB
public static void HSLtoRGB(def.js.Array<java.lang.Double> hsl, def.js.Array<java.lang.Integer> rgb)Converts HSL components of a color to a set of RGB components- Parameters:
hsl- the hsl arrayrgb- the rgb array
-
RGBtoHSL
public static void RGBtoHSL(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> hsl)Converts RGB components of a color to a set of HSL components- Parameters:
rgb- the rgb arrayhsl- the hsl array
-
HSVtoRGB
public static void HSVtoRGB(def.js.Array<java.lang.Double> hsv, def.js.Array<java.lang.Integer> rgb)Converts HSV components of a color to a set of RGB components- Parameters:
hsv- the hsv arrayrgb- the rgb array
-
RGBtoHSV
public static void RGBtoHSV(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> hsv)Converts RGB components of a color to a set of HSV components- Parameters:
rgb- the rgb arrayhsv- the hsv array
-
CMYKtoRGB
public static void CMYKtoRGB(def.js.Array<java.lang.Integer> cmyk, def.js.Array<java.lang.Integer> rgb)Converts CMYK components of a color to a set of RGB components- Parameters:
cmyk- the cmyk arrayrgb- the rgb array
-
RGBtoCMYK
public static void RGBtoCMYK(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Integer> cmyk)Converts RGB components of a color to a set of CMYK components- Parameters:
rgb- the rgb arraycmyk- the cmyk array
-
YUVtoRGB
public static void YUVtoRGB(def.js.Array<java.lang.Double> yuv, def.js.Array<java.lang.Integer> rgb)Converts YUV components of a color to a set of RGB components- Parameters:
yuv- the yuv arrayrgb- the rgb array
-
RGBtoYUV
public static void RGBtoYUV(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> yuv)Converts RGB components of a color to a set of YUV components- Parameters:
rgb- the rgb arrayyuv- the cmyk array
-
pushHistory
public static void pushHistory(Color color)
Pushes a color in the color history (if not already present)- Parameters:
color- The color
-
getHistory
public static def.js.Array<Color> getHistory()
Returns the color history- Returns:
- The color history
-
resetHistory
public static void resetHistory()
Resets the color history
-
-