net.paulhertz.aifile
Class CMYKColor

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

public class CMYKColor
extends Object

Provides storage and conversion utilities for CMYK colors.


Constructor Summary
CMYKColor()
          Instantiates a CMYK color with all components set to 0 (i.e., white)
CMYKColor(double[] cmyk)
          Instantiates a CMYK color
CMYKColor(double c, double m, double y, double k)
          Instantiates a CMYK color from c, m, y and k components represented as doubles in the range 0..1
 
Method Summary
 double c()
           
 double k()
           
 double m()
           
static CMYKColor rgb2cmyk(double[] rgb)
          Uses the standard quick and dirty direct transform of RGB to CMYK.
static CMYKColor rgb2cmyk(double red, double green, double blue)
          Uses the standard quick and dirty direct transform of RGB to CMYK.
static CMYKColor rgb2cmyk(int[] rgb)
          Uses the standard quick and dirty direct transform of RGB to CMYK.
static CMYKColor rgb2cmyk(RGBColor rgb)
          Uses the standard quick and dirty direct transform of RGB to CMYK.
 void setC(double c)
           
 void setK(double k)
           
 void setM(double m)
           
 void setY(double y)
           
 double y()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMYKColor

public CMYKColor(double c,
                 double m,
                 double y,
                 double k)
Instantiates a CMYK color from c, m, y and k components represented as doubles in the range 0..1

Parameters:
c -
m -
y -
k -

CMYKColor

public CMYKColor(double[] cmyk)
Instantiates a CMYK color

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

CMYKColor

public CMYKColor()
Instantiates a CMYK color with all components set to 0 (i.e., white)

Method Detail

c

public double c()
Returns:
the cyan component

setC

public void setC(double c)
Parameters:
c - the cyan component (0..1) to set

m

public double m()
Returns:
the magenta component

setM

public void setM(double m)
Parameters:
m - the magenta componet (0..1) to set

y

public double y()
Returns:
the yellow component

setY

public void setY(double y)
Parameters:
y - the yellow component (0..1) to set

k

public double k()
Returns:
the black component

setK

public void setK(double k)
Parameters:
k - the black component (0..1) to set

rgb2cmyk

public static CMYKColor rgb2cmyk(double red,
                                 double green,
                                 double blue)
Uses the standard quick and dirty direct transform of RGB to CMYK. You can use it, but don't believe it.

Parameters:
red - the red component, in the range 0..1
green - the green component, in the range 0..1
blue - the blue component, in the range 0..1
Returns:
the "equivalent" CMYK color

rgb2cmyk

public static CMYKColor rgb2cmyk(int[] rgb)
Uses the standard quick and dirty direct transform of RGB to CMYK. You can use it, but don't believe it.

Parameters:
rgb - an RGB color represented as an array of ints in the range 0..255
Returns:
the "equivalent" CMYK color

rgb2cmyk

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

Parameters:
rgb - an RGB color represented as an array of doubles in the range 0..1
Returns:
the "equivalent" CMYK color

rgb2cmyk

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

Parameters:
rgb - an RGB color
Returns:
the "equivalent" CMYK color


Processing library IgnoCodeLib by Paul Hertz. (C) 2013