net.paulhertz.aifile
Class RGBColor

java.lang.Object
  extended by net.paulhertz.aifile.RGBColor

public class RGBColor
extends Object

Provides storage and conversion utilities for an RGBColor.


Constructor Summary
RGBColor()
          Instantiates an RGB color with all components set to 0 (i.e., black)
RGBColor(double[] rgb)
          Instantiates an RGB color.
RGBColor(double r, double g, double b)
          Instantiates an RGB color from r, g and b components represented as doubles in the range 0..1
RGBColor(int r, int g, int b)
          Instantiates an RGB color from r, g and b components represented as ints in the range 0..255
 
Method Summary
 double b()
           
static RGBColor cmyk2rgb(CMYKColor cmyk)
          Uses the standard quick and dirty direct transform of CMYK to RGB.
static RGBColor cmyk2rgb(double[] cmyk)
          Uses the standard quick and dirty direct transform of CMYK to RGB.
static RGBColor cmyk2rgb(double cyan, double magenta, double yellow, double black)
          Uses the standard quick and dirty direct transform of CMYK to RGB.
 double g()
           
 double r()
           
 void setB(double b)
           
 void setG(double g)
           
 void setR(double r)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RGBColor

public RGBColor(double r,
                double g,
                double b)
Instantiates an RGB color from r, g and b components represented as doubles in the range 0..1

Parameters:
r - red component
g - green component
b - blue component

RGBColor

public RGBColor(int r,
                int g,
                int b)
Instantiates an RGB color from r, g and b components represented as ints in the range 0..255

Parameters:
r - red component
g - green component
b - blue component

RGBColor

public RGBColor(double[] rgb)
Instantiates an RGB color.

Parameters:
rgb - an array with three entries for r, g, and b components represented as doubles in the range 0..1

RGBColor

public RGBColor()
Instantiates an RGB color with all components set to 0 (i.e., black)

Method Detail

r

public double r()
Returns:
the red component

setR

public void setR(double r)
Parameters:
r - the red component (0..1) to set

g

public double g()
Returns:
the green component

setG

public void setG(double g)
Parameters:
g - the green component (0..1) to set

b

public double b()
Returns:
the blue component

setB

public void setB(double b)
Parameters:
b - the blue component (0..1) to set

cmyk2rgb

public static RGBColor cmyk2rgb(double cyan,
                                double magenta,
                                double yellow,
                                double black)
Uses the standard quick and dirty direct transform of CMYK to RGB. You can use it, but don't believe it.

Parameters:
cyan - the cyan component, in the range 0..1
magenta - the magenta component, in the range 0..1
yellow - the yellow component, in the range 0..1
black - the black component, in the range 0..1
Returns:
the "equivalent" RGB color

cmyk2rgb

public static RGBColor cmyk2rgb(double[] cmyk)
Uses the standard quick and dirty direct transform of CMYK to RGB. You can use it, but don't believe it.

Parameters:
cmyk - an array of four doubles in the range 0..1, representing c, m, y and k components
Returns:
the "equivalent" RGB color

cmyk2rgb

public static RGBColor cmyk2rgb(CMYKColor cmyk)
Uses the standard quick and dirty direct transform of CMYK to RGB. You can use it, but don't believe it.

Parameters:
cmyk - a CMYKColor
Returns:
the "equivalent" RGB color


Processing library IgnoCodeLib by Paul Hertz. (C) 2013