legacy.video
Class RGB

java.lang.Object
  extended by legacy.video.RGB

public class RGB
extends java.lang.Object

RGB.class is a container for RGBA color composites with values ranging from 0 to 255 for each.
Warning access to componets r,g,b,a are public but may not effect the value used by any rendition service or class, these feild are availble for optimiziation considerations only. modify at your own risk.
Reccomend read only.

Author:
Benjamin Tarrant

Field Summary
 int a
          alpha component ranging from 0 to 255 where 0 is considered to be fully translucent
Recommend read only.
 int b
          blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
 int g
          green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
 int r
          red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
 int value
          alpha, red, green and blue components packed as a single int for use with display adaptor
Recommend read only.
 
Constructor Summary
RGB(int rgb)
          RGB(int rgb) creates a a record of all three components plus alpha extracted from 0xAARRGGBB
RGB(int r, int g, int b)
          RGB(int r, int g, int b) creates a a record of all three components plus alpha by default set to 255 and it's real value calulated as 0xAARRGGBB
RGB(int r, int g, int b, int a)
          RGB(int r, int g, int b, int a) creates a a record of all three components plus alpha and it's real value calulated as 0xAARRGGBB
 
Method Summary
static int blendColor(int baseRGB, int colorRGB)
          blendColor blends to colors togeather using the second colors alpha value as the quantity to blend.
static int blendColor(RGB baseRGB, RGB colorRGB)
          blendColor blends to colors togeather using the second colors alpha value as the quantity to blend.
 int getA()
          getter for alpha component
 int getB()
          getter for blue component
 int getColor()
          getter for alpha, red, green and blue components packed as a single int for use with display adaptor
Warningmay be inacurate if any component has been directly altered.
static int getColor(int r, int g, int b, int a)
          getColor(int r, int g, int b, int a) packs the RGBA components into a single int for use with the display adaptor
 int getG()
          getter for green component
 int getR()
          getter for red component
 void setA(int a)
          safe setter for the alpha component, will adjust value;
 void setB(int b)
          safe setter for the blue component, will adjust value;
 void setG(int g)
          safe setter for the green component, will adjust value;
 void setR(int r)
          safe setter for the red component, will adjust value;
 void setValue(int value)
          safe setter for the alpha, red, greed and blue components by packed value, will adjust components.;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

r

public int r
red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
Recommend read only.


g

public int g
green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
Recommend read only.


b

public int b
blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
Recommend read only.


a

public int a
alpha component ranging from 0 to 255 where 0 is considered to be fully translucent
Recommend read only.


value

public int value
alpha, red, green and blue components packed as a single int for use with display adaptor
Recommend read only.

Constructor Detail

RGB

public RGB(int rgb)
RGB(int rgb) creates a a record of all three components plus alpha extracted from 0xAARRGGBB

Parameters:
rgb - red green blue and alpha component ranging from 0 to 255 where 255 is considered to be at it's higest luminace for red green and blue and the alpha range from 0 to 255 where 0 is considered to be fully translucent

RGB

public RGB(int r,
           int g,
           int b)
RGB(int r, int g, int b) creates a a record of all three components plus alpha by default set to 255 and it's real value calulated as 0xAARRGGBB

Parameters:
r - red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
g - green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
b - blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

RGB

public RGB(int r,
           int g,
           int b,
           int a)
RGB(int r, int g, int b, int a) creates a a record of all three components plus alpha and it's real value calulated as 0xAARRGGBB

Parameters:
r - red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
g - green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
b - blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
a - alpha component ranging from 0 to 255 where 0 is considered to be fully translucent
Method Detail

getR

public int getR()
getter for red component

Returns:
red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

setR

public void setR(int r)
safe setter for the red component, will adjust value;

Parameters:
r - red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

getG

public int getG()
getter for green component

Returns:
green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

setG

public void setG(int g)
safe setter for the green component, will adjust value;

Parameters:
g - green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

getB

public int getB()
getter for blue component

Returns:
blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

setB

public void setB(int b)
safe setter for the blue component, will adjust value;

Parameters:
b - blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.

getA

public int getA()
getter for alpha component

Returns:
alpha component ranging from 0 to 255 where 0 is considered to be fully translucent

setA

public void setA(int a)
safe setter for the alpha component, will adjust value;

Parameters:
a - blue component ranging from 0 to 255 where 0 is considered to be fully translucent.

getColor

public int getColor()
getter for alpha, red, green and blue components packed as a single int for use with display adaptor
Warningmay be inacurate if any component has been directly altered.

Returns:
packed value of compaonents as 0xAARRGGBB

setValue

public void setValue(int value)
safe setter for the alpha, red, greed and blue components by packed value, will adjust components.;

Parameters:
value - in the rgba format as 0xAARRGGBB

getColor

public static final int getColor(int r,
                                 int g,
                                 int b,
                                 int a)
getColor(int r, int g, int b, int a) packs the RGBA components into a single int for use with the display adaptor

Parameters:
r - red component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
g - green component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
b - blue component ranging from 0 to 255 where 255 is considered to be at it's higest luminace.
a - alpha component ranging from 0 to 255 where 0 is considered to be fully translucent
Returns:
packed value of compaonents as 0xAARRGGBB

blendColor

public static final int blendColor(RGB baseRGB,
                                   RGB colorRGB)
blendColor blends to colors togeather using the second colors alpha value as the quantity to blend.

Parameters:
baseRGB - the RGB triplet to blend
colorRGB - the RGB quad to blend
Returns:
the Composite color

blendColor

public static final int blendColor(int baseRGB,
                                   int colorRGB)
blendColor blends to colors togeather using the second colors alpha value as the quantity to blend.

Parameters:
baseRGB - the packed RGB triplet to blend
colorRGB - the packed RGB quad to blend
Returns:
the Composite color