org.newdawn.slick.font.effects
Class GradientEffect

java.lang.Object
  extended by org.newdawn.slick.font.effects.GradientEffect
All Implemented Interfaces:
ConfigurableEffect, Effect

public class GradientEffect
extends java.lang.Object
implements ConfigurableEffect

Paints glyphs with a gradient fill.

Author:
Nathan Sweet

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.newdawn.slick.font.effects.ConfigurableEffect
ConfigurableEffect.Value
 
Constructor Summary
GradientEffect()
          Default constructor for injection
GradientEffect(java.awt.Color topColor, java.awt.Color bottomColor, float scale)
          Create a new effect to apply a graident
 
Method Summary
 void draw(java.awt.image.BufferedImage image, java.awt.Graphics2D g, UnicodeFont unicodeFont, Glyph glyph)
          Called to draw the effect.
 java.awt.Color getBottomColor()
          Get the colour at the bottom of the graident
 int getOffset()
          Get the offset the gradients starts at
 float getScale()
          Get the percentage scaling being applied to the gradient across the surface
 java.awt.Color getTopColor()
          Get the colour at the top of the graident
 java.util.List getValues()
          Returns the list of ConfigurableEffect.Values for this effect.
 boolean isCyclic()
          Check if the graident is repeating
 void setBottomColor(java.awt.Color bottomColor)
          Set the colour at the bottom of the graident
 void setCyclic(boolean cyclic)
          If set to true, the gradient will repeat.
 void setOffset(int offset)
          Sets the pixel offset to move the gradient up or down.
 void setScale(float scale)
          Changes the height of the gradient by a percentage.
 void setTopColor(java.awt.Color topColor)
          Set the colour at the top of the graident
 void setValues(java.util.List values)
          Sets the list of ConfigurableEffect.Values for this effect.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GradientEffect

public GradientEffect()
Default constructor for injection


GradientEffect

public GradientEffect(java.awt.Color topColor,
                      java.awt.Color bottomColor,
                      float scale)
Create a new effect to apply a graident

Parameters:
topColor - The colour at the top of the graident
bottomColor - The colour at the bottom of the gradient
scale - The scale of the graident
Method Detail

draw

public void draw(java.awt.image.BufferedImage image,
                 java.awt.Graphics2D g,
                 UnicodeFont unicodeFont,
                 Glyph glyph)
Description copied from interface: Effect
Called to draw the effect.

Specified by:
draw in interface Effect
Parameters:
image - The image to draw into
g - The graphics context to use for applying the effect
unicodeFont - The font being rendered
glyph - The particular glyph being rendered
See Also:
Effect.draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)

getTopColor

public java.awt.Color getTopColor()
Get the colour at the top of the graident

Returns:
The colour at the top of the gradient

setTopColor

public void setTopColor(java.awt.Color topColor)
Set the colour at the top of the graident

Parameters:
topColor - The colour at the top of the graident

getBottomColor

public java.awt.Color getBottomColor()
Get the colour at the bottom of the graident

Returns:
The colour at the bottom of the gradient

setBottomColor

public void setBottomColor(java.awt.Color bottomColor)
Set the colour at the bottom of the graident

Parameters:
bottomColor - The colour at the bottom of the graident

getOffset

public int getOffset()
Get the offset the gradients starts at

Returns:
The offset the gradient starts at

setOffset

public void setOffset(int offset)
Sets the pixel offset to move the gradient up or down. The gradient is normally centered on the glyph.

Parameters:
offset - The offset the gradient is moved by

getScale

public float getScale()
Get the percentage scaling being applied to the gradient across the surface

Returns:
The scale of the graident

setScale

public void setScale(float scale)
Changes the height of the gradient by a percentage. The gradient is normally the height of most glyphs in the font.

Parameters:
scale - The scale to apply

isCyclic

public boolean isCyclic()
Check if the graident is repeating

Returns:
True if the gradient is repeating

setCyclic

public void setCyclic(boolean cyclic)
If set to true, the gradient will repeat.

Parameters:
cyclic - True if the graident repeats

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getValues

public java.util.List getValues()
Description copied from interface: ConfigurableEffect
Returns the list of ConfigurableEffect.Values for this effect. This list is not typically backed by the effect, so changes to the values will not take affect until ConfigurableEffect.setValues(List) is called.

Specified by:
getValues in interface ConfigurableEffect
See Also:
ConfigurableEffect.getValues()

setValues

public void setValues(java.util.List values)
Description copied from interface: ConfigurableEffect
Sets the list of ConfigurableEffect.Values for this effect.

Specified by:
setValues in interface ConfigurableEffect
See Also:
ConfigurableEffect.setValues(java.util.List)


Copyright © 2006 New Dawn Software. All Rights Reserved.