diewald_CV_kit.utility
Class PixelColor

java.lang.Object
  extended by diewald_CV_kit.utility.PixelColor

public final class PixelColor
extends Object

a class to generate/analyse colors in a fast way.

Author:
thomas diewald (c) 2011

Constructor Summary
PixelColor(int rgba)
           
PixelColor(int r, int g, int b)
           
PixelColor(int r, int g, int b, int a)
           
 
Method Summary
 int alpha()
           
static int alpha(int rgba)
           
 int blue()
           
static int blue(int rgba)
           
static float brighntess(float r, float g, float b)
           
static float brighntess(int rgb)
           
static int color(int gray)
           
static int color(int gray, int a)
           
static int color(int r, int g, int b)
           
static int color(int r, int g, int b, int a)
           
 int getCol()
           
 int green()
           
static int green(int rgba)
           
static int hsb2rgb(float h, float s, float b)
          converts a hsb-value (hue, saturation, brightness) value, to an rgb-value.
static float[] hsb2rgb(float h, float s, float b, float[] rgb)
          converts a hsb-value (hue, saturation, brightness) value, to an rgb-value.
static float hue(float r, float g, float b)
           
static float hue(int rgb)
           
 int red()
           
static int red(int rgba)
           
static float[] rgb2hsb(float r, float g, float b, float[] hsb)
           
static float[] rgb2hsb(int rgb, float[] hsb)
          converts a rgb-value (single integer) value, to an hsb-value.
static float saturation(float r, float g, float b)
           
static float saturation(int rgb)
           
 void setA(int a)
           
 void setB(int b)
           
 void setCol(int rgba)
           
 void setCol(int r, int g, int b)
           
 void setCol(int r, int g, int b, int a)
           
 void setG(int g)
           
 void setR(int r)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PixelColor

public PixelColor(int rgba)

PixelColor

public PixelColor(int r,
                  int g,
                  int b)

PixelColor

public PixelColor(int r,
                  int g,
                  int b,
                  int a)
Method Detail

setCol

public final void setCol(int rgba)

setCol

public final void setCol(int r,
                         int g,
                         int b)

setCol

public final void setCol(int r,
                         int g,
                         int b,
                         int a)

setR

public final void setR(int r)

setG

public final void setG(int g)

setB

public final void setB(int b)

setA

public final void setA(int a)

red

public final int red()

green

public final int green()

blue

public final int blue()

alpha

public final int alpha()

getCol

public final int getCol()

toString

public final String toString()
Overrides:
toString in class Object

color

public static final int color(int r,
                              int g,
                              int b,
                              int a)

color

public static final int color(int r,
                              int g,
                              int b)

color

public static final int color(int gray,
                              int a)

color

public static final int color(int gray)

alpha

public static final int alpha(int rgba)

red

public static final int red(int rgba)

green

public static final int green(int rgba)

blue

public static final int blue(int rgba)

rgb2hsb

public static final float[] rgb2hsb(int rgb,
                                    float[] hsb)
converts a rgb-value (single integer) value, to an hsb-value. resulting values: hue (0-360), saturation(0-100), brightness(0-100)

Parameters:
rgb - an red-color
Returns:
the hsb-color as an new array, if no parameter was given(hsb)

rgb2hsb

public static final float[] rgb2hsb(float r,
                                    float g,
                                    float b,
                                    float[] hsb)

hue

public static final float hue(int rgb)

hue

public static final float hue(float r,
                              float g,
                              float b)

saturation

public static final float saturation(int rgb)

saturation

public static final float saturation(float r,
                                     float g,
                                     float b)

brighntess

public static final float brighntess(int rgb)

brighntess

public static final float brighntess(float r,
                                     float g,
                                     float b)

hsb2rgb

public static final float[] hsb2rgb(float h,
                                    float s,
                                    float b,
                                    float[] rgb)
converts a hsb-value (hue, saturation, brightness) value, to an rgb-value. resulting values: red (0-255), green (0-255), blue (0-255)

Parameters:
h - hue
s - saturation
b - brightness
rgb - array (size has to be 3), to save the values if rgb == null, a new array will be generated which will slow down execution!!!
Returns:
the rgb-color as an new array, if no parameter was given(rgb)

hsb2rgb

public static final int hsb2rgb(float h,
                                float s,
                                float b)
converts a hsb-value (hue, saturation, brightness) value, to an rgb-value. resulting values: red (0-255), green (0-255), blue (0-255)

Parameters:
h - hue
s - saturation
b - brightness
Returns:
the rgb-color as an integer


Processing library diewald_CV_kit by Thomas Diewald. (C) 2012