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.svg
Class Gradient

    java.lang.Object
      org.newdawn.slick.svg.Gradient

    public class Gradient

extends java.lang.Object

A gradient definition from an SVG file, includes the stops, name and transform.

Author:
  kevin

Constructor Summary
`Gradient(java.lang.String name, boolean radial)` Create a new gradient definition

Method Summary
`void` | `addStep(float location, Color c)` Add a colour step/stop to the gradient
`void` | `genImage()` Generate the image used for texturing the gradient across shapes
`Color` | `getColorAt(float p)` Get the intepolated colour at the given location on the gradient
`Image` | `getImage()` Get the image generated for this gradient
`float` | `getR()` Get the radius value given for this gradient
`Transform` | `getTransform()` Get the transform to apply during this gradient application
`float` | `getX1()` Get the first x value given for this gradient (cx in the case of radial)
`float` | `getX2()` Get the second x value given for this gradient (fx in the case of radial)
`float` | `getY1()` Get the first y value given for this gradient (cy in the case of radial)
`float` | `getY2()` Get the second y value given for this gradient (fy in the case of radial)
`boolean` | `isRadial()` Check if the gradient is radial
`void` | `reference(java.lang.String ref)` Reference another gradient, i.e.
`void` | `resolve(Diagram diagram)` Resolve the gradient reference
`void` | `setR(float r)` Set the radius given in the SVG
`void` | `setTransform(Transform trans)` Set the transform given for this definition
`void` | `setX1(float x1)` Set the first x value given for the gradient (cx in the case of radial)
`void` | `setX2(float x2)` Set the second x value given for the gradient (fx in the case of radial)
`void` | `setY1(float y1)` Set the first y value given for the gradient (cy in the case of radial)
`void` | `setY2(float y2)` Set the second y value given for the gradient (fy in the case of radial)

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

Constructor Detail

### Gradient

    public Gradient(java.lang.String name,
                    boolean radial)

  Create a new gradient definition

  Parameters:
    `name` - The name of the gradient
    `radial` - True if the gradient is radial

Method Detail

### isRadial

    public boolean isRadial()

  Check if the gradient is radial

  Returns:
    True if the gradient is radial

### setTransform

    public void setTransform(Transform trans)

  Set the transform given for this definition

  Parameters:
    `trans` - The transform given for this definition

### getTransform

    public Transform getTransform()

  Get the transform to apply during this gradient application

  Returns:
    The transform given for this gradient

### reference

    public void reference(java.lang.String ref)

  Reference another gradient, i.e. use it's colour stops

  Parameters:
    `ref` - The name of the other gradient to reference

### resolve

    public void resolve(Diagram diagram)

  Resolve the gradient reference

  Parameters:
    `diagram` - The diagram to resolve against

### genImage

    public void genImage()

  Generate the image used for texturing the gradient across shapes

### getImage

    public Image getImage()

  Get the image generated for this gradient

  Returns:
    The image generated for the gradient

### setR

    public void setR(float r)

  Set the radius given in the SVG

  Parameters:
    `r` - The radius for radial gradients

### setX1

    public void setX1(float x1)

  Set the first x value given for the gradient (cx in the case of radial)

  Parameters:
    `x1` - The first x value given for the gradient

### setX2

    public void setX2(float x2)

  Set the second x value given for the gradient (fx in the case of radial)

  Parameters:
    `x2` - The second x value given for the gradient

### setY1

    public void setY1(float y1)

  Set the first y value given for the gradient (cy in the case of radial)

  Parameters:
    `y1` - The first y value given for the gradient

### setY2

    public void setY2(float y2)

  Set the second y value given for the gradient (fy in the case of radial)

  Parameters:
    `y2` - The second y value given for the gradient

### getR

    public float getR()

  Get the radius value given for this gradient

  Returns:
    The radius value given for this gradient

### getX1

    public float getX1()

  Get the first x value given for this gradient (cx in the case of radial)

  Returns:
    The first x value given for this gradient

### getX2

    public float getX2()

  Get the second x value given for this gradient (fx in the case of radial)

  Returns:
    The second x value given for this gradient

### getY1

    public float getY1()

  Get the first y value given for this gradient (cy in the case of radial)

  Returns:
    The first y value given for this gradient

### getY2

    public float getY2()

  Get the second y value given for this gradient (fy in the case of radial)

  Returns:
    The second y value given for this gradient

### addStep

    public void addStep(float location,
                        Color c)

  Add a colour step/stop to the gradient

  Parameters:
    `location` - The location on the gradient the colour affects
    `c` - The color to apply

### getColorAt

    public Color getColorAt(float p)

  Get the intepolated colour at the given location on the gradient

  Parameters:
    `p` - The point of the gradient (0 >= n >= 1)
  Returns:
    The interpolated colour at the given location

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.