Bridges-Java  3.4.2
Bridges(Java API)
Public Member Functions | Static Public Member Functions | Static Package Functions | Package Attributes | List of all members
bridges.base.Color Class Reference

Detailed Description

@brief This class is used to represent colors in BRIDGES.

We use an RGBA model
to represent colors, with each component in the range 0-255. BRIDGES
also supports named colors for user convenience, but these are converted
into [RGBA] prior to transmission to the server for visualization.

<p>

Supported named colors are listed below and here: https://drafts.csswg.org/css-color-3/#svg-color

aliceblue, antiquewhite, cyan, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, darkblue, darkcyan, darkgoldenrod, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, magenta, gainsboro, ghostwhite, gold, goldenrod, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen

All named colors are fully opaque by default.

Default Color is opaque white

Date
7/8/19, Kalpathi Subramanian
@author K.R. Subramanian,
@date 7/8/19

Public Member Functions

 Color ()
 
 Color (int r, int g, int b, float a)
 
 Color (int r, int g, int b)
 
 Color (String color)
 
void setColor (int r, int g, int b, float a)
 
void setRed (int r)
 
int getRed ()
 
void setGreen (int g)
 
int getGreen ()
 
void setBlue (int b)
 
int getBlue ()
 
void setAlpha (float a)
 
float getAlpha ()
 
String getRepresentation ()
 
String getHexRepresentation ()
 
byte[] getByteRepresentation ()
 
boolean equals (Object obj)
 
String toString ()
 
void setColor (String col_name)
 

Static Public Member Functions

static Color colorFromHex (String hexStr) throws IllegalArgumentException
 

Static Package Functions

 [static initializer]
 

Package Attributes

int green
 
int blue
 

Constructor & Destructor Documentation

◆ Color() [1/4]

bridges.base.Color.Color ( )

Construct a default color object (steel blue)

◆ Color() [2/4]

bridges.base.Color.Color ( int  r,
int  g,
int  b,
float  a 
)

Constructor, given r, g, b, a components

Parameters
rred component
ggreen component
bblue component
aalpha component

◆ Color() [3/4]

bridges.base.Color.Color ( int  r,
int  g,
int  b 
)
Constructor, given r, g, b components

alpha (opacity) defaults to 255

Parameters
rred component
ggreen component
bblue component

◆ Color() [4/4]

bridges.base.Color.Color ( String  color)

Constructor, given color name

Parameters
colorone of the CSS colors (check above for full list of colors)

Member Function Documentation

◆ [static initializer]()

bridges.base.Color.[static initializer]
staticpackage

◆ colorFromHex()

static Color bridges.base.Color.colorFromHex ( String  hexStr) throws IllegalArgumentException
static

◆ equals()

boolean bridges.base.Color.equals ( Object  obj)

◆ getAlpha()

float bridges.base.Color.getAlpha ( )

Gets the alpha component

Returns
alpha returns the alpha (opacity) component of the color

◆ getBlue()

int bridges.base.Color.getBlue ( )

gets the blue component

Returns
blue returns the blue component of the color

◆ getByteRepresentation()

byte [] bridges.base.Color.getByteRepresentation ( )

gets a Byte array representation of a Color

Returns
- returns the RGBA color as a byte array

◆ getGreen()

int bridges.base.Color.getGreen ( )

gets the green component

Returns
green returns the green component of the color

◆ getHexRepresentation()

String bridges.base.Color.getHexRepresentation ( )

Gets the RGB Color representation as a Hex String

Returns
- returns the RGB color as hexadecimal String

◆ getRed()

int bridges.base.Color.getRed ( )

gets the red component

Returns
red returns the red component of the color

◆ getRepresentation()

String bridges.base.Color.getRepresentation ( )

Gets the Color representation as a String

Returns
returns the color as a String with an RGBA array format

◆ setAlpha()

void bridges.base.Color.setAlpha ( float  a)

sets the alpha(opacity) component

Parameters
aalpha component (0-1.0)

◆ setBlue()

void bridges.base.Color.setBlue ( int  b)

sets the blue component

Parameters
bblue component

◆ setColor() [1/2]

void bridges.base.Color.setColor ( int  r,
int  g,
int  b,
float  a 
)
sets color to the given r, g, b, a components
Parameters
rred component
ggreen component
bblue component
aalpha component

◆ setColor() [2/2]

void bridges.base.Color.setColor ( String  col_name)

sets the color to the RGBA components given the color name

Parameters
col_namecolor name

◆ setGreen()

void bridges.base.Color.setGreen ( int  g)

sets the green component

Parameters
ggreen component

◆ setRed()

void bridges.base.Color.setRed ( int  r)
sets the red component
Parameters
rred component

◆ toString()

String bridges.base.Color.toString ( )

Member Data Documentation

◆ blue

int bridges.base.Color.blue
package

◆ green

int bridges.base.Color.green
package

The documentation for this class was generated from the following file: