com.tensegrity.graphics
Class Gradient

java.lang.Object
  extended bycom.tensegrity.graphics.Gradient

public class Gradient
extends java.lang.Object

The Gradient class represents a certain style that can be used for area filling. It consists of the following attributes:

The type attribute defines the type of the gradient to fill an area with. The different types of gradients that can be used to fill an area are as follows:

At the actual state of development custom gradients are not supported.

The foreground color attribute defines the first color that is used to render the gradient. It is represented by an int that defines the values for the red, green and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for the green component and bb stands for the blue component of the color.

The background color attribute defines the second color that is used to render the gradient. It is represented by an int that defines the values for the red, green and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for the green component and bb stands for the blue component of the color.

It is not possible to create an instance of this class. In fact this class provides some predefined gradients mentioned before that can be used. This predefined gradients can be gained typewise through a call to getGradient(int, int, int).

Version:
$Id: Gradient.java,v 1.9 2005/04/01 15:42:39 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
static int CENTERCIRCLE
          constant that tells about a type of gradient supported by the Gradient class
static int CENTERSQUARED
          constant that tells about a type of gradient supported by the Gradient class
static int DOWN
          constant that tells about a type of gradient supported by the Gradient class
static int DOWNCENTER
          constant that tells about a type of gradient supported by the Gradient class
static Gradient GRADIENT_CENTERCIRCLE
          constant that defines one of the supported gradients
static Gradient GRADIENT_CENTERSQUARED
          constant that defines one of the supported gradients
static Gradient GRADIENT_DOWN
          constant that defines one of the supported gradients
static Gradient GRADIENT_DOWNCENTER
          constant that defines one of the supported gradients
static Gradient GRADIENT_HORIZONTALCENTER
          constant that defines one of the supported gradients
static Gradient GRADIENT_LEFTBOTTOM
          constant that defines one of the supported gradients
static Gradient GRADIENT_LEFTTOP
          constant that defines one of the supported gradients
static Gradient GRADIENT_LEFTTOPCIRCLE
          constant that defines one of the supported gradients
static int GRADIENT_MAX
          constant that indicates the maximum number of predefined patterns
static Gradient GRADIENT_RIGHTBOTTOM
          constant that defines one of the supported gradients
static Gradient GRADIENT_RIGHTLEFT
          constant that defines one of the supported gradients
static Gradient GRADIENT_RIGHTTOP
          constant that defines one of the supported gradients
static Gradient GRADIENT_RIGHTTOPCIRCLE
          constant that defines one of the supported gradients
static Gradient GRADIENT_TOPBOTTOM
          constant that defines one of the supported gradients
static Gradient GRADIENT_UP
          constant that defines one of the supported gradients
static Gradient GRADIENT_UPCENTER
          constant that defines one of the supported gradients
static Gradient GRADIENT_VERTICALCENTER
          constant that defines one of the supported gradients
static int HORIZONTALCENTER
          constant that tells about a type of gradient supported by the Gradient class
static int LEFTBOTTOM
          constant that tells about a type of gradient supported by the Gradient class
static int LEFTTOP
          constant that tells about a type of gradient supported by the Gradient class
static int LEFTTOPCIRCLE
          constant that tells about a type of gradient supported by the Gradient class
static int RIGHTBOTTOM
          constant that tells about a type of gradient supported by the Gradient class
static int RIGHTLEFT
          constant that tells about a type of gradient supported by the Gradient class
static int RIGHTTOP
          constant that tells about a type of gradient supported by the Gradient class
static int RIGHTTOPCIRCLE
          constant that tells about a type of gradient supported by the Gradient class
static int TOPBOTTOM
          constant that tells about a type of gradient supported by the Gradient class
static int UP
          constant that tells about a type of gradient supported by the Gradient class
static int UPCENTER
          constant that tells about a type of gradient supported by the Gradient class
static int VERTICALCENTER
          constant that tells about a type of gradient supported by the Gradient class
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getBackground()
          Returns the gradients background color value.
 int getForeground()
          Returns the gradients foreground color value.
static Gradient getGradient(int type, int colorback, int colorfore)
          Returns an instance of a Gradient object that belongs to the type given by type.
 int getType()
          Returns the type of the gradient.
 int hashCode()
          Sets the gradients foreground color to the value given by rgb.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RIGHTLEFT

public static final int RIGHTLEFT
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

VERTICALCENTER

public static final int VERTICALCENTER
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

TOPBOTTOM

public static final int TOPBOTTOM
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

HORIZONTALCENTER

public static final int HORIZONTALCENTER
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

UP

public static final int UP
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

UPCENTER

public static final int UPCENTER
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

DOWN

public static final int DOWN
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

DOWNCENTER

public static final int DOWNCENTER
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

LEFTBOTTOM

public static final int LEFTBOTTOM
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

RIGHTBOTTOM

public static final int RIGHTBOTTOM
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

LEFTTOP

public static final int LEFTTOP
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

RIGHTTOP

public static final int RIGHTTOP
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

CENTERSQUARED

public static final int CENTERSQUARED
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

CENTERCIRCLE

public static final int CENTERCIRCLE
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

LEFTTOPCIRCLE

public static final int LEFTTOPCIRCLE
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

RIGHTTOPCIRCLE

public static final int RIGHTTOPCIRCLE
constant that tells about a type of gradient supported by the Gradient class

See Also:
Constant Field Values

GRADIENT_MAX

public static final int GRADIENT_MAX
constant that indicates the maximum number of predefined patterns

See Also:
Constant Field Values

GRADIENT_RIGHTLEFT

public static final Gradient GRADIENT_RIGHTLEFT
constant that defines one of the supported gradients


GRADIENT_VERTICALCENTER

public static final Gradient GRADIENT_VERTICALCENTER
constant that defines one of the supported gradients


GRADIENT_TOPBOTTOM

public static final Gradient GRADIENT_TOPBOTTOM
constant that defines one of the supported gradients


GRADIENT_HORIZONTALCENTER

public static final Gradient GRADIENT_HORIZONTALCENTER
constant that defines one of the supported gradients


GRADIENT_UP

public static final Gradient GRADIENT_UP
constant that defines one of the supported gradients


GRADIENT_UPCENTER

public static final Gradient GRADIENT_UPCENTER
constant that defines one of the supported gradients


GRADIENT_DOWN

public static final Gradient GRADIENT_DOWN
constant that defines one of the supported gradients


GRADIENT_DOWNCENTER

public static final Gradient GRADIENT_DOWNCENTER
constant that defines one of the supported gradients


GRADIENT_LEFTBOTTOM

public static final Gradient GRADIENT_LEFTBOTTOM
constant that defines one of the supported gradients


GRADIENT_RIGHTBOTTOM

public static final Gradient GRADIENT_RIGHTBOTTOM
constant that defines one of the supported gradients


GRADIENT_LEFTTOP

public static final Gradient GRADIENT_LEFTTOP
constant that defines one of the supported gradients


GRADIENT_RIGHTTOP

public static final Gradient GRADIENT_RIGHTTOP
constant that defines one of the supported gradients


GRADIENT_CENTERSQUARED

public static final Gradient GRADIENT_CENTERSQUARED
constant that defines one of the supported gradients


GRADIENT_CENTERCIRCLE

public static final Gradient GRADIENT_CENTERCIRCLE
constant that defines one of the supported gradients


GRADIENT_LEFTTOPCIRCLE

public static final Gradient GRADIENT_LEFTTOPCIRCLE
constant that defines one of the supported gradients


GRADIENT_RIGHTTOPCIRCLE

public static final Gradient GRADIENT_RIGHTTOPCIRCLE
constant that defines one of the supported gradients

Method Detail

getType

public int getType()
Returns the type of the gradient.

Returns:
int the gradients type
See Also:
RIGHTLEFT, VERTICALCENTER, TOPBOTTOM, HORIZONTALCENTER, UP, UPCENTER, DOWN, DOWNCENTER, LEFTBOTTOM, RIGHTBOTTOM, LEFTTOP, RIGHTTOP, CENTERSQUARED, CENTERCIRCLE, LEFTTOPCIRCLE, RIGHTTOPCIRCLE

getBackground

public int getBackground()
Returns the gradients background color value.

Returns:
int the gradients background color value

getForeground

public int getForeground()
Returns the gradients foreground color value.

Returns:
int the gradients foreground color value

hashCode

public int hashCode()
Sets the gradients foreground color to the value given by rgb. This method is only visible within the graphics package.


equals

public boolean equals(java.lang.Object o)

getGradient

public static Gradient getGradient(int type,
                                   int colorback,
                                   int colorfore)
Returns an instance of a Gradient object that belongs to the type given by type.

Parameters:
type - the type of the Gradient to return
Returns:
Gradient an instance of the requested gradient type


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.