Example usage for java.awt LinearGradientPaint getFractions

List of usage examples for java.awt LinearGradientPaint getFractions

Introduction

In this page you can find the example usage for java.awt LinearGradientPaint getFractions.

Prototype

public final float[] getFractions() 

Source Link

Document

Returns a copy of the array of floats used by this gradient to calculate color distribution.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.legend.CustomLegendGraphic.java

private static LinearGradientPaint getTranslatedLinearGradientPaint(LinearGradientPaint gradient,
        Point2D startPoint, Point2D endPoint, boolean vertical) {
    if (vertical) {
        return new LinearGradientPaint(0f, (float) startPoint.getY(), 0f, (float) endPoint.getY(),
                gradient.getFractions(), gradient.getColors());
    } else {/*from   w w  w  .  j a  v  a 2  s  .co m*/
        return new LinearGradientPaint((float) startPoint.getX(), 0f, (float) endPoint.getX(), 0f,
                gradient.getFractions(), gradient.getColors());
    }
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.legend.SmartLegendTitle.java

public static Paint transformLinearGradient(LinearGradientPaint paint, Shape target) {
    Rectangle2D bounds = target.getBounds2D();
    float left = (float) bounds.getMinX();
    float right = (float) bounds.getMaxX();
    LinearGradientPaint newPaint = new LinearGradientPaint(left, 0, right, 0, paint.getFractions(),
            paint.getColors());//from   w ww  .j  a va  2  s.c o  m
    return newPaint;
}