Class GradientFactory

java.lang.Object
org.graphstream.ui.swing_viewer.util.GradientFactory

public class GradientFactory
extends java.lang.Object
  • Field Summary

    Fields 
    Modifier and Type Field Description
    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

    Constructors 
    Constructor Description
    GradientFactory()  
  • Method Summary

    Modifier and Type Method Description
    static java.awt.Paint gradientInArea​(int x0, int y0, int width, int height, org.graphstream.ui.graphicGraph.stylesheet.Style style)
    Generate a gradient in the given pixel area following the given style.
    static java.awt.Paint linearGradientFromStyle​(float x0, float y0, float x1, float y1, org.graphstream.ui.graphicGraph.stylesheet.Style style)
    Generate a linear gradient between two given points corresponding to the given style.
    static java.awt.Paint radialGradientFromStyle​(float cx, float cy, float radius, float fx, float fy, org.graphstream.ui.graphicGraph.stylesheet.Style style)
    Generate a radial gradient between whose center is at (cx,cy) with the given radius.
    static java.awt.Paint radialGradientFromStyle​(float cx, float cy, float radius, org.graphstream.ui.graphicGraph.stylesheet.Style style)  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • gradientInArea

      public static java.awt.Paint gradientInArea​(int x0, int y0, int width, int height, org.graphstream.ui.graphicGraph.stylesheet.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 java.awt.Paint linearGradientFromStyle​(float x0, float y0, float x1, float y1, org.graphstream.ui.graphicGraph.stylesheet.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 java.awt.Paint radialGradientFromStyle​(float cx, float cy, float radius, org.graphstream.ui.graphicGraph.stylesheet.Style style)
    • radialGradientFromStyle

      public static java.awt.Paint radialGradientFromStyle​(float cx, float cy, float radius, float fx, float fy, org.graphstream.ui.graphicGraph.stylesheet.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).