return true;
}
// convert java.awt.GradientPaint to LinearGradientPaint to avoid rasterization
if (paint instanceof GradientPaint) {
GradientPaint gpaint = (GradientPaint) paint;
paint = new LinearGradientPaint(
(float) gpaint.getPoint1().getX(),
(float) gpaint.getPoint1().getY(),
(float) gpaint.getPoint2().getX(),
(float) gpaint.getPoint2().getY(),
new float[] {0, 1},
new Color[] {gpaint.getColor1(), gpaint.getColor2()},
gpaint.isCyclic() ? LinearGradientPaint.REPEAT : LinearGradientPaint.NO_CYCLE);
}
if (paint instanceof LinearGradientPaint) {
LinearGradientPaint gp = (LinearGradientPaint)paint;
// This code currently doesn't support 'repeat'.
// For linear gradients it is possible to construct
// a 'tile' that is repeated with a PDF pattern, but
// it would be very tricky as you would have to rotate
// the coordinate system so the repeat was axially
// aligned. At this point I'm just going to rasterize it.
MultipleGradientPaint.CycleMethodEnum cycle = gp.getCycleMethod();
if (cycle != MultipleGradientPaint.NO_CYCLE) {
return false;
}
Color[] cols = gp.getColors();
float[] fractions = gp.getFractions();
// Build proper transform from gradient space to page space
// ('Patterns' don't get userspace transform).
AffineTransform transform;
transform = new AffineTransform(getBaseTransform());
transform.concatenate(getTransform());
transform.concatenate(gp.getTransform());
List theMatrix = new java.util.ArrayList();
double [] mat = new double[6];
transform.getMatrix(mat);
for (int idx = 0; idx < mat.length; idx++) {
theMatrix.add(new Double(mat[idx]));
}
Point2D p1 = gp.getStartPoint();
Point2D p2 = gp.getEndPoint();
List theCoords = new java.util.ArrayList();
theCoords.add(new Double(p1.getX()));
theCoords.add(new Double(p1.getY()));
theCoords.add(new Double(p2.getX()));
theCoords.add(new Double(p2.getY()));