Hi All,
I’ve been trying to get the Java “RadialGradientPaint” class to work in the paintable canvas but without any success.
The standard “GradientPaint” class works fine. I can use the Point2D class do define my x, y coordinates, hold different color instances in Jython variables, etc. Everything works fine. But when I try to apply the same concepts to a “RadialGradientPaint” instance, Ignition throws me this error:
I am at my wits end! I cannot figure out why it will not work. Any help would be much appreciated. Below is a copy of the script that I have in the paintable canvas. Thanks in advance for your help.
import java.util.ArrayList as ArrayList
from java.awt import Color
from java.awt import Paint
from java.awt import GradientPaint
from java.awt import LinearGradientPaint
from java.awt import MultipleGradientPaint
from java.awt import RadialGradientPaint
from java.awt.geom import Ellipse2D
from java.awt.geom import Point2D
from java.lang import Float, Double
#define Java Arrays
coverageArray = ArrayList()
colorArray = ArrayList()
#declare Java Graphics2D instance
g = event.graphics
#declare colors and put into Java array
colorDarkGrey = Color(14,14,14)
colorLightBlue = Color(51,153,204)
colorArray.add(colorDarkGrey)
colorArray.add(colorLightBlue)
#add coverage distribution points to Java Array
coverageArray.add(0.0)
coverageArray.add(1.0)
#build an Java Ellipse2D instance
myEllipse = Ellipse2D.Float(1, 1, 98, 98)
#find the center of the ellipse and put into a Java Point2D instance
myCenter = Point2D.Float((event.width / 2), (event.height / 2))
#create a Java RadialGradientPaint instance
newPaint = RadialGradientPaint(myCenter, 20.0, coverageArray, colorArray)
#build the ellipse object and fill with the radial gradient
g.setPaint(newPaint)
g.fill(myEllipse)
g.draw(myEllipse)