本文整理汇总了Java中org.apache.batik.ext.awt.LinearGradientPaint类的典型用法代码示例。如果您正苦于以下问题:Java LinearGradientPaint类的具体用法?Java LinearGradientPaint怎么用?Java LinearGradientPaint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LinearGradientPaint类属于org.apache.batik.ext.awt包,在下文中一共展示了LinearGradientPaint类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateGradient
import org.apache.batik.ext.awt.LinearGradientPaint; //导入依赖的package包/类
private MultipleGradientPaint calculateGradient(final float[] fractions, final Color[] colors) {
// set up the end points
Point2D start = this.start;
Point2D end = this.end;
if(isReversed()) {
//if(picker.reversedCheck.isSelected()) {
start = this.end;
end = this.start;
}
// set up the cycle type
MultipleGradientPaint.CycleMethodEnum cycle = MultipleGradientPaint.NO_CYCLE;
if(isRepeated()) {
//if(picker.repeatedRadio.isSelected()) {
cycle = MultipleGradientPaint.REPEAT;
}
if(isReflected()) {
//if(picker.reflectedRadio.isSelected()) {
cycle = MultipleGradientPaint.REFLECT;
}
// create the underlying gradient paint
MultipleGradientPaint paint = null;
if(isRadial()) { //picker.styleCombo.getSelectedItem().toString().equals("Radial")) {
paint = new org.apache.batik.ext.awt.RadialGradientPaint(
start, (float)start.distance(end),start,
fractions, colors, cycle, MultipleGradientPaint.SRGB
);
} else {
paint = new org.apache.batik.ext.awt.LinearGradientPaint(
(float)start.getX(),
(float)start.getY(),
(float)end.getX(),
(float)end.getY(),
fractions,colors,cycle);
}
return paint;
}