Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick.fills
Class GradientFill

    java.lang.Object
      org.newdawn.slick.fills.GradientFill

All Implemented Interfaces:
  ShapeFill

    public class GradientFill

extends java.lang.Object
implements ShapeFill

A fill effect used to define gradients when filling and drawing shapes. A gradient is defined by two control points. Each point that is rendered is coloured based on it's proximity to the points. Note that the points are defined relative to the center of the shape being drawn. This is with the intention that the gradient fills can be used and do not need to be updated when the geometry is moved

Author:
  kevin

Constructor Summary
`GradientFill(float sx, float sy, Color startCol, float ex, float ey, Color endCol)` Create a gradient fill
`GradientFill(float sx, float sy, Color startCol, float ex, float ey, Color endCol, boolean local)` Create a gradient fill
`GradientFill(Vector2f start, Color startCol, Vector2f end, Color endCol, boolean local)` Create a gradient fill

Method Summary
`Color` | `colorAt(float x, float y)` Get the colour that should be applied at the specified location
`Color` | `colorAt(Shape shape, float x, float y)` Get the colour that should be applied at the specified location
`Vector2f` | `getEnd()` Get the position of the end control point
`Color` | `getEndColor()` Get the colour at the end control point
`GradientFill` | `getInvertedCopy()` Get an inverted copy of the gradient
`Vector2f` | `getOffsetAt(Shape shape, float x, float y)` Get the offset for a vertex at a given location based on it's shape
`Vector2f` | `getStart()` Get the position of the start control point
`Color` | `getStartColor()` Get the colour at the start control point
`void` | `setEnd(float x, float y)` Set the end control point's position
`void` | `setEnd(Vector2f end)` Set the end control point's position
`void` | `setEndColor(Color color)` Set the colour to apply at the end control's position
`void` | `setLocal(boolean local)` Indicate if the gradient is defined in shape local coordinates
`void` | `setStart(float x, float y)` Set the start point's position
`void` | `setStart(Vector2f start)` Set the start control point's position
`void` | `setStartColor(Color color)` Set the colour to apply at the start control's position

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GradientFill

    public GradientFill(float sx,
                        float sy,
                        Color startCol,
                        float ex,
                        float ey,
                        Color endCol)

  Create a gradient fill

  Parameters:
    `sx` - The x coordinate of the starting control point
    `sy` - The y coordinate of the starting control point
    `startCol` - The colour to apply at the starting control point
    `ex` - The x coordinate of the ending control point
    `ey` - The y coordinate of the ending control point
    `endCol` - The colour to apply at the ending control point

### GradientFill

    public GradientFill(float sx,
                        float sy,
                        Color startCol,
                        float ex,
                        float ey,
                        Color endCol,
                        boolean local)

  Create a gradient fill

  Parameters:
    `sx` - The x coordinate of the starting control point
    `sy` - The y coordinate of the starting control point
    `startCol` - The colour to apply at the starting control point
    `ex` - The x coordinate of the ending control point
    `ey` - The y coordinate of the ending control point
    `endCol` - The colour to apply at the ending control point
    `local` - True if the gradient is defined in local shape coordinates

### GradientFill

    public GradientFill(Vector2f start,
                        Color startCol,
                        Vector2f end,
                        Color endCol,
                        boolean local)

  Create a gradient fill

  Parameters:
    `start` - The position of the starting control point
    `startCol` - The colour to apply at the starting control point
    `end` - The position of the ending control point
    `endCol` - The colour to apply at the ending control point
    `local` - True if the gradient is defined in local shape coordinates

Method Detail

### getInvertedCopy

    public GradientFill getInvertedCopy()

  Get an inverted copy of the gradient

  Returns:
    The copy with the colours inverted

### setLocal

    public void setLocal(boolean local)

  Indicate if the gradient is defined in shape local coordinates

  Parameters:
    `local` - True if the gradient is defined in shape local coordinates

### getStart

    public Vector2f getStart()

  Get the position of the start control point

  Returns:
    The position of the start control point

### getEnd

    public Vector2f getEnd()

  Get the position of the end control point

  Returns:
    The position of the end control point

### getStartColor

    public Color getStartColor()

  Get the colour at the start control point

  Returns:
    The color at the start control point

### getEndColor

    public Color getEndColor()

  Get the colour at the end control point

  Returns:
    The color at the end control point

### setStart

    public void setStart(float x,
                         float y)

  Set the start point's position

  Parameters:
    `x` - The x coordinate of the start control point
    `y` - The y coordinate of the start control point

### setStart

    public void setStart(Vector2f start)

  Set the start control point's position

  Parameters:
    `start` - The new poisition for the start point

### setEnd

    public void setEnd(float x,
                       float y)

  Set the end control point's position

  Parameters:
    `x` - The x coordinate of the end control point
    `y` - The y coordinate of the end control point

### setEnd

    public void setEnd(Vector2f end)

  Set the end control point's position

  Parameters:
    `end` - The new position for the end point

### setStartColor

    public void setStartColor(Color color)

  Set the colour to apply at the start control's position

  Parameters:
    `color` - The colour to apply at the start control point

### setEndColor

    public void setEndColor(Color color)

  Set the colour to apply at the end control's position

  Parameters:
    `color` - The colour to apply at the end control point

### colorAt

    public Color colorAt(Shape shape,
                         float x,
                         float y)

  Get the colour that should be applied at the specified location

  Specified by:
    `colorAt` in interface `ShapeFill`
  Parameters:
    `shape` - The shape being filled
    `x` - The x coordinate of the point being coloured
    `y` - The y coordinate of the point being coloured
  Returns:
    The colour that should be applied based on the control points of this gradient

### colorAt

    public Color colorAt(float x,
                         float y)

  Get the colour that should be applied at the specified location

  Parameters:
    `x` - The x coordinate of the point being coloured
    `y` - The y coordinate of the point being coloured
  Returns:
    The colour that should be applied based on the control points of this gradient

### getOffsetAt

    public Vector2f getOffsetAt(Shape shape,
                                float x,
                                float y)

  Description copied from interface: `ShapeFill`
  Get the offset for a vertex at a given location based on it's shape

  Specified by:
    `getOffsetAt` in interface `ShapeFill`
  Parameters:
    `shape` - The shape being filled
    `x` - The x coordinate of the point being drawn
    `y` - The y coordinate of the point being drawn
  Returns:
    The offset to apply to this vertex
  See Also:
    `ShapeFill.getOffsetAt(org.newdawn.slick.geom.Shape, float, float)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.