org.graphstream.ui.swingViewer.util
Class GradientFactory

java.lang.Object
  extended by org.graphstream.ui.swingViewer.util.GradientFactory

public class GradientFactory
extends Object


Field Summary
static float[][] predefFractions
           
static float[] predefFractions10
           
static float[] predefFractions2
           
static float[] predefFractions3
           
static float[] predefFractions4
           
static float[] predefFractions5
           
static float[] predefFractions6
           
static float[] predefFractions7
           
static float[] predefFractions8
           
static float[] predefFractions9
           
static boolean version16
           
 
Constructor Summary
GradientFactory()
           
 
Method Summary
static Paint gradientInArea(int x0, int y0, int width, int height, Style style)
          Generate a gradient in the given pixel area following the given style.
static Paint linearGradientFromStyle(float x0, float y0, float x1, float y1, Style style)
          Generate a linear gradient between two given points corresponding to the given style.
static Paint radialGradientFromStyle(float cx, float cy, float radius, float fx, float fy, Style style)
          Generate a radial gradient between whose center is at (cx,cy) with the given radius.
static Paint radialGradientFromStyle(float cx, float cy, float radius, Style style)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version16

public static boolean version16

predefFractions

public static float[][] predefFractions

predefFractions2

public static float[] predefFractions2

predefFractions3

public static float[] predefFractions3

predefFractions4

public static float[] predefFractions4

predefFractions5

public static float[] predefFractions5

predefFractions6

public static float[] predefFractions6

predefFractions7

public static float[] predefFractions7

predefFractions8

public static float[] predefFractions8

predefFractions9

public static float[] predefFractions9

predefFractions10

public static float[] predefFractions10
Constructor Detail

GradientFactory

public GradientFactory()
Method Detail

gradientInArea

public static Paint gradientInArea(int x0,
                                   int y0,
                                   int width,
                                   int height,
                                   Style style)
Generate a gradient in the given pixel area following the given style. This produces a gradient only if the style fill-mode is compatible.

Parameters:
x0 - The left corner of the area.
y0 - The bottom corner of the area.
width - The area width.
height - The area height.
style - The style.
Returns:
A gradient paint or null if the style does not specify a gradient.

linearGradientFromStyle

public static Paint linearGradientFromStyle(float x0,
                                            float y0,
                                            float x1,
                                            float y1,
                                            Style style)
Generate a linear gradient between two given points corresponding to the given style.

Parameters:
x0 - The start point abscissa.
y0 - The start point ordinate.
x1 - The end point abscissa.
y1 - The end point ordinate.
style - The style.
Returns:
A paint for the gradient or null if the style specifies no gradient (the fill mode is not a linear gradient or there is only one fill colour).

radialGradientFromStyle

public static Paint radialGradientFromStyle(float cx,
                                            float cy,
                                            float radius,
                                            Style style)

radialGradientFromStyle

public static Paint radialGradientFromStyle(float cx,
                                            float cy,
                                            float radius,
                                            float fx,
                                            float fy,
                                            Style style)
Generate a radial gradient between whose center is at (cx,cy) with the given radius. The focus (fx,fy) is the start position of the gradient in the circle.

Parameters:
cx - The center point abscissa.
cy - The center point ordinate.
fx - The start point abscissa.
fy - The start point ordinate.
radius - The gradient radius.
style - The style.
Returns:
A paint for the gradient or null if the style specifies no gradient (the fill mode is not a radial gradient or there is only one fill colour).


Copyright © 2013. All Rights Reserved.