anar

Class AColor

java.lang.Object
  extended by anar.Parametric
      extended by anar.Pt
          extended by anar.PtABS
              extended by anar.PtABS4D
                  extended by anar.AColor
All Implemented Interfaces:
iArithmetic, iTaggable, iTransformable, XYZ, java.lang.Cloneable
Direct Known Subclasses:
OogColor

public class AColor
extends PtABS4D

Colors are 32bits ARGB or AHSB use swap metho to switch between RGB and HSB


Field Summary
static boolean debug
           
 
Fields inherited from class anar.Pt
globalRender, render
 
Fields inherited from class anar.Parametric
meta
 
Constructor Summary
AColor(AColor copy)
           
AColor(float g)
           
AColor(float g, float a)
           
AColor(float r, float g, float b)
           
AColor(float r, float g, float b, float a)
           
AColor(Param g)
           
AColor(Param g, Param a)
           
AColor(Param r, Param g, Param b)
           
AColor(Param r, Param g, Param b, Param a)
           
 
Method Summary
 float a()
           
 AColor a(float value)
           
 AColor addA(float value)
           
 AColor addAlpha(float value)
          Add ALPHA of the color.
 AColor addB(float value)
           
static AColor[] addBlue(AColor[] colorScheme, int value)
           
 AColor addBlue(float value)
          Add BLUE of the color.
static AColor[] addBrightness(AColor[] colorScheme, int value)
           
 AColor addBrightness(float value)
          Change BRIGHTNESS of the color.
 AColor addG(float value)
           
static AColor[] addGreen(AColor[] colorScheme, int value)
           
 AColor addGreen(float value)
          Add GREEN of the color.
 AColor addH(float value)
           
static AColor[] addHue(AColor[] colorScheme, int value)
           
 AColor addHue(float value)
          Add HUE of the color.
 AColor addHueDegree(float value)
          Add HUE of the color.
 AColor addHueRadian(float value)
          Add HUE of the color.
 AColor addL(float value)
           
 AColor addR(float value)
           
static AColor[] addRed(AColor[] colorScheme, int value)
           
 AColor addRed(float value)
          Add RED of the color.
 AColor addS(float value)
           
static AColor[] addSaturation(AColor[] colorScheme, int value)
           
 AColor addSaturation(float value)
          Add SATURATION of the color.
 AColor alpha(float value)
          Change the ALPHA of the color.
static AColor[] analogous(AColor color, int numOfColors, float angle)
          Generate a serie of colors similar to the given color, uniformly distributed on the given angle.
 AColor[] analogous(int numOfColors, float angle)
           
 float b()
           
 AColor b(float value)
           
static AColor[] blue(AColor[] colorScheme, int value)
           
 AColor blue(float value)
          Change the BLUE of the color.
static AColor[] brightness(AColor[] colorScheme, int value)
           
 AColor brightness(float value)
          Change BRIGHTNESS of the color.
 AColor complementary()
           
 float g()
           
 AColor g(float value)
           
static AColor[] green(AColor[] colorScheme, int value)
           
 AColor green(float value)
          Change the GREEN of the color.
 float h()
           
 AColor h(float value)
           
static int HSB(float g)
           
static int HSB(float g, float a)
           
static int HSB(float h, float s, float b)
           
static int HSB(float h, float s, float b, float a)
           
static AColor HSBtoRGB(AColor inColor)
           
static AColor HSBtoRGB(float h, float s, float b)
           
static AColor HSBtoRGB(float h, float s, float b, float a)
           
static AColor[] hue(AColor[] colorScheme, int value)
           
 AColor hue(float value)
          Change the HUE of the color.
 AColor hueDegree(float value)
          Change the HUE of the color.
 AColor hueRadian(float value)
          Change the HUE of the color.
static int interpolate(AColor c1, AColor c2, float cf)
           
 float l()
           
 AColor l(float value)
           
 float r()
           
 AColor r(float value)
           
static AColor[] red(AColor[] colorScheme, int value)
           
 AColor red(float value)
          Change the RED of the color.
static int RGB(float g)
           
static int RGB(float g, float a)
           
static int RGB(float r, float g, float b)
           
static int RGB(float r, float g, float b, float a)
           
static AColor RGBtoHSB(AColor inColor)
           
static AColor RGBtoHSB(float r, float g, float b)
           
 float s()
           
 AColor s(float value)
           
static AColor[] saturation(AColor[] colorScheme, int value)
           
 AColor saturation(float value)
          Change the SATURATION of the color.
 void swap()
           
static AColor toAColor(int inColor)
           
 java.lang.String toHexa(float c)
           
 AColor toHSB()
          Convert the color to HSB
 java.lang.String toHTML()
           
 int toInt()
           
static int toInt(AColor inColor)
           
 java.lang.String toPovRay()
           
 AColor toRGB()
          Convert the color to RGB
 java.lang.String toString()
           
 
Methods inherited from class anar.PtABS4D
build, set, set, w, w, w
 
Methods inherited from class anar.PtABS
clone, set, set, set, set, set, set, set, set, set, tag, x, x, y, y, z, z
 
Methods inherited from class anar.Pt
apply, bound, boundCenter, copy, create, create, create, create, create, create, create, create, create, create, create, create, createNull, createRnd, createRnd, createRnd, divide, divide, divide, divide, dot, dot, draw, equalsPt, equalsPt, fill, fill, fill, fill, fill, fill, fillP5, getTransform, isOver, isOver, length, length, length, lengthNoSq, lengthSq, lengthSq, minus, minus, minus, minus, minus, multiply, multiply, multiply, multiply, multiply, onScreen, orphaned, plus, plus, plus, plus, plus, plus, render, rotateX, rotateX, rotateY, rotateY, rotateZ, rotateZ, scale, scale, scale, scale, scale, scale, scale, scale, scaleX, scaleX, scaleY, scaleY, scaleZ, scaleZ, set, setMeta, tag, toANSYS, toAutocad, toAutocadPart, toMegaPPOV, toObjExporter, toObjExporterAsObject, toPovRayAsObject, toRadiance, toRadianceAsObject, toRhino, toRhinoAsObject, toRhinoAsVar, toShortString, toSingleName, toSketchUp, toSketchUpAsPoint3D, toStringComa, toStringComaPovRay, toStringTab, toStringTabRad, translate, translate, translate, translate, translate, translate, translateX, translateX, translateY, translateY, translateZ, translateZ, x, y, z
 
Methods inherited from class anar.Parametric
child, get, getMeta, getPrimitive, parent, parent, parentList, parentList, parentList, parentListGraphViz, parentListGraphViz, parentListRecursive, parentListRecursiveGraphViz, parentToString, parentToStringRecursive, parentToStringRecursive, primitiveToString, replaceParent, replaceParent, replicate, tag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Constructor Detail

AColor

public AColor(float r,
              float g,
              float b,
              float a)

AColor

public AColor(float r,
              float g,
              float b)

AColor

public AColor(float g)

AColor

public AColor(float g,
              float a)

AColor

public AColor(AColor copy)

AColor

public AColor(Param r,
              Param g,
              Param b,
              Param a)
Parameters:
r -
g -
b -
a -

AColor

public AColor(Param r,
              Param g,
              Param b)

AColor

public AColor(Param g,
              Param a)

AColor

public AColor(Param g)
Method Detail

r

public float r()

g

public float g()

b

public float b()

h

public float h()

s

public float s()

l

public float l()

a

public float a()

RGB

public static int RGB(float r,
                      float g,
                      float b,
                      float a)

RGB

public static int RGB(float r,
                      float g,
                      float b)

RGB

public static int RGB(float g)

RGB

public static int RGB(float g,
                      float a)

HSB

public static int HSB(float h,
                      float s,
                      float b,
                      float a)

HSB

public static int HSB(float h,
                      float s,
                      float b)

HSB

public static int HSB(float g)

HSB

public static int HSB(float g,
                      float a)

swap

public void swap()

RGBtoHSB

public static AColor RGBtoHSB(AColor inColor)

RGBtoHSB

public static AColor RGBtoHSB(float r,
                              float g,
                              float b)

HSBtoRGB

public static AColor HSBtoRGB(AColor inColor)

HSBtoRGB

public static AColor HSBtoRGB(float h,
                              float s,
                              float b)

HSBtoRGB

public static AColor HSBtoRGB(float h,
                              float s,
                              float b,
                              float a)

toRGB

public AColor toRGB()
Convert the color to RGB

Returns:

toHSB

public AColor toHSB()
Convert the color to HSB

Returns:

toInt

public int toInt()

toInt

public static int toInt(AColor inColor)

toAColor

public static AColor toAColor(int inColor)

toString

public java.lang.String toString()
Overrides:
toString in class PtABS4D

toPovRay

public java.lang.String toPovRay()
Overrides:
toPovRay in class Pt

toHexa

public java.lang.String toHexa(float c)

toHTML

public java.lang.String toHTML()

interpolate

public static int interpolate(AColor c1,
                              AColor c2,
                              float cf)
Parameters:
c1 - Color 1
c2 - Color 2
cf - Ratio Between first to second color (100% 0 to 1)
Returns:

hue

public AColor hue(float value)
Change the HUE of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

hueDegree

public AColor hueDegree(float value)
Change the HUE of the color. The value is set to the color.

Parameters:
value - (0.360)
Returns:

hueRadian

public AColor hueRadian(float value)
Change the HUE of the color. The value is set to the color.

Parameters:
value - (0.2PI)
Returns:

saturation

public AColor saturation(float value)
Change the SATURATION of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

brightness

public AColor brightness(float value)
Change BRIGHTNESS of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

red

public AColor red(float value)
Change the RED of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

green

public AColor green(float value)
Change the GREEN of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

blue

public AColor blue(float value)
Change the BLUE of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

alpha

public AColor alpha(float value)
Change the ALPHA of the color. The value is set to the color.

Parameters:
value - (0,255)
Returns:

r

public AColor r(float value)
Parameters:
value -
Returns:
See Also:
red(float)

g

public AColor g(float value)
Parameters:
value -
Returns:
See Also:
green(float)

b

public AColor b(float value)
Parameters:
value -
Returns:
See Also:
blue(float)

h

public AColor h(float value)
Parameters:
value -
Returns:
See Also:
hue(float)

s

public AColor s(float value)
Parameters:
value -
Returns:
See Also:
saturation(float)

l

public AColor l(float value)
Parameters:
value -
Returns:
See Also:
brightness(float)

a

public AColor a(float value)
Parameters:
value -
Returns:
See Also:
alpha(float)

addHue

public AColor addHue(float value)
Add HUE of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addHueDegree

public AColor addHueDegree(float value)
Add HUE of the color. The value is added to the color.

Parameters:
value - (0.360) or negative
Returns:

addHueRadian

public AColor addHueRadian(float value)
Add HUE of the color. The value is added to the color.

Parameters:
value - (0.2PI) or negative
Returns:

addSaturation

public AColor addSaturation(float value)
Add SATURATION of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addBrightness

public AColor addBrightness(float value)
Change BRIGHTNESS of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addRed

public AColor addRed(float value)
Add RED of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addGreen

public AColor addGreen(float value)
Add GREEN of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addBlue

public AColor addBlue(float value)
Add BLUE of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addAlpha

public AColor addAlpha(float value)
Add ALPHA of the color. The value is added to the color.

Parameters:
value - (0,255) or negative
Returns:

addR

public AColor addR(float value)
Parameters:
value -
Returns:
See Also:
addRed(float)

addG

public AColor addG(float value)
Parameters:
value -
Returns:
See Also:
addGreen(float)

addB

public AColor addB(float value)
Parameters:
value -
Returns:
See Also:
addBlue(float)

addH

public AColor addH(float value)
Parameters:
value -
Returns:
See Also:
addHue(float)

addS

public AColor addS(float value)
Parameters:
value -
Returns:
See Also:
addSaturation(float)

addL

public AColor addL(float value)
Parameters:
value -
Returns:
See Also:
addBrightness(float)

addA

public AColor addA(float value)
Parameters:
value -
Returns:
See Also:
addAlpha(float)

hue

public static AColor[] hue(AColor[] colorScheme,
                           int value)
Parameters:
colorScheme -
value -
Returns:

saturation

public static AColor[] saturation(AColor[] colorScheme,
                                  int value)
Parameters:
colorScheme -
value -
Returns:

brightness

public static AColor[] brightness(AColor[] colorScheme,
                                  int value)
Parameters:
colorScheme -
value -
Returns:

red

public static AColor[] red(AColor[] colorScheme,
                           int value)
Parameters:
colorScheme -
value -
Returns:

green

public static AColor[] green(AColor[] colorScheme,
                             int value)
Parameters:
colorScheme -
value -
Returns:

blue

public static AColor[] blue(AColor[] colorScheme,
                            int value)
Parameters:
colorScheme -
value -
Returns:

addHue

public static AColor[] addHue(AColor[] colorScheme,
                              int value)
Parameters:
colorScheme -
value -
Returns:

addSaturation

public static AColor[] addSaturation(AColor[] colorScheme,
                                     int value)
Parameters:
colorScheme -
value -
Returns:

addBrightness

public static AColor[] addBrightness(AColor[] colorScheme,
                                     int value)
Parameters:
colorScheme -
value -
Returns:

addRed

public static AColor[] addRed(AColor[] colorScheme,
                              int value)
Parameters:
colorScheme -
value -
Returns:

addGreen

public static AColor[] addGreen(AColor[] colorScheme,
                                int value)
Parameters:
colorScheme -
value -
Returns:

addBlue

public static AColor[] addBlue(AColor[] colorScheme,
                               int value)
Parameters:
colorScheme -
value -
Returns:

complementary

public AColor complementary()

analogous

public AColor[] analogous(int numOfColors,
                          float angle)
Parameters:
numOfColors -
angle - in Degree
Returns:
See Also:
analogous(AColor, int, float)

analogous

public static AColor[] analogous(AColor color,
                                 int numOfColors,
                                 float angle)
Generate a serie of colors similar to the given color, uniformly distributed on the given angle.
Ex: analogous(red,3,10); gives 3 colors:
 
 (1) red -5`
 (2) red (himself)
 (3) red +5`
see references on the web

Parameters:
color -
numOfColors -
angle - in Degree
Returns: