aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/ps
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2014-07-10 17:40:50 +0000
committerVincent Hennebert <vhennebert@apache.org>2014-07-10 17:40:50 +0000
commit47b6aab658b32a63bce57d230ea13d3c2d155401 (patch)
treeb03d1d11b9ddf1b15b1a56affe8cfb3d356af154 /src/java/org/apache/fop/render/ps
parentc693acafafe51330759b97ae953584e68846c7fb (diff)
downloadxmlgraphics-fop-47b6aab658b32a63bce57d230ea13d3c2d155401.tar.gz
xmlgraphics-fop-47b6aab658b32a63bce57d230ea13d3c2d155401.zip
Small adjustments to make duplication in linear and radial gradients more apparent
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1609521 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps')
-rw-r--r--src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java67
1 files changed, 25 insertions, 42 deletions
diff --git a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
index 7bb230323..87e9e384f 100644
--- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
@@ -96,47 +96,44 @@ public class PSSVGGraphics2D extends PSGraphics2D implements GradientRegistrar {
}
}
- private void handleLinearGradient(LinearGradientPaint lgp, PSGenerator gen) throws IOException {
- MultipleGradientPaint.CycleMethodEnum cycle = lgp.getCycleMethod();
+ private void handleLinearGradient(LinearGradientPaint gp, PSGenerator gen) throws IOException {
+ MultipleGradientPaint.CycleMethodEnum cycle = gp.getCycleMethod();
if (cycle != MultipleGradientPaint.NO_CYCLE) {
return;
}
- float[] fractions = lgp.getFractions();
- Color[] cols = lgp.getColors();
AffineTransform transform = new AffineTransform(getBaseTransform());
transform.concatenate(getTransform());
- transform.concatenate(lgp.getTransform());
+ transform.concatenate(gp.getTransform());
- List theMatrix = new ArrayList();
+ List<Double> theMatrix = new ArrayList<Double>();
double [] mat = new double[6];
transform.getMatrix(mat);
for (int idx = 0; idx < mat.length; idx++) {
theMatrix.add(Double.valueOf(mat[idx]));
}
-
List<Double> theCoords = new java.util.ArrayList<Double>();
- theCoords.add(lgp.getStartPoint().getX());
- theCoords.add(lgp.getStartPoint().getX());
- theCoords.add(lgp.getEndPoint().getX());
- theCoords.add(lgp.getEndPoint().getY());
+ theCoords.add(gp.getStartPoint().getX());
+ theCoords.add(gp.getStartPoint().getX());
+ theCoords.add(gp.getEndPoint().getX());
+ theCoords.add(gp.getEndPoint().getY());
+ Color[] cols = gp.getColors();
List<Color> someColors = new java.util.ArrayList<Color>();
+ float[] fractions = gp.getFractions();
if (fractions[0] > 0f) {
someColors.add(cols[0]);
}
for (int count = 0; count < cols.length; count++) {
- Color c1 = cols[count];
- if (c1.getAlpha() != 255) {
- LOG.warn("Opacity is not currently supported for Postscript output");
- }
- someColors.add(c1);
+ Color c = cols[count];
+ someColors.add(c);
}
if (fractions[fractions.length - 1] < 1f) {
someColors.add(cols[cols.length - 1]);
}
+
List<Double> theBounds = new java.util.ArrayList<Double>();
for (int count = 0; count < fractions.length; count++) {
float offset = fractions[count];
@@ -157,34 +154,26 @@ public class PSSVGGraphics2D extends PSGraphics2D implements GradientRegistrar {
- private void handleRadialGradient(RadialGradientPaint rgp, PSGenerator gen) throws IOException {
- MultipleGradientPaint.CycleMethodEnum cycle = rgp.getCycleMethod();
+ private void handleRadialGradient(RadialGradientPaint gp, PSGenerator gen) throws IOException {
+ MultipleGradientPaint.CycleMethodEnum cycle = gp.getCycleMethod();
if (cycle != MultipleGradientPaint.NO_CYCLE) {
return;
}
- AffineTransform transform;
- transform = new AffineTransform(getBaseTransform());
+ AffineTransform transform = new AffineTransform(getBaseTransform());
transform.concatenate(getTransform());
- transform.concatenate(rgp.getTransform());
+ transform.concatenate(gp.getTransform());
- AffineTransform resultCentre = applyTransform(rgp.getTransform(),
- rgp.getCenterPoint().getX(), rgp.getCenterPoint().getY());
- AffineTransform resultFocus = applyTransform(rgp.getTransform(),
- rgp.getFocusPoint().getX(), rgp.getFocusPoint().getY());
-
- List<Double> theMatrix = new java.util.ArrayList<Double>();
+ List<Double> theMatrix = new ArrayList<Double>();
double [] mat = new double[6];
transform.getMatrix(mat);
for (int idx = 0; idx < mat.length; idx++) {
theMatrix.add(Double.valueOf(mat[idx]));
}
- float[] fractions = rgp.getFractions();
-
- double ar = rgp.getRadius();
- Point2D ac = rgp.getCenterPoint();
- Point2D af = rgp.getFocusPoint();
+ double ar = gp.getRadius();
+ Point2D ac = gp.getCenterPoint();
+ Point2D af = gp.getFocusPoint();
List<Double> theCoords = new java.util.ArrayList<Double>();
double dx = af.getX() - ac.getX();
double dy = af.getY() - ac.getY();
@@ -204,21 +193,15 @@ public class PSSVGGraphics2D extends PSGraphics2D implements GradientRegistrar {
theCoords.add(new Double(ac.getY()));
theCoords.add(new Double(ar));
- Color[] cols = rgp.getColors();
+ Color[] cols = gp.getColors();
List<Color> someColors = new java.util.ArrayList<Color>();
+ float[] fractions = gp.getFractions();
if (fractions[0] > 0f) {
someColors.add(cols[0]);
}
for (int count = 0; count < cols.length; count++) {
- Color cc = cols[count];
- if (cc.getAlpha() != 255) {
- /* This should never happen because radial gradients with opacity should now
- * be rasterized in the PSImageHandlerSVG class. Please see the shouldRaster()
- * method for more information. */
- LOG.warn("Opacity is not currently supported for Postscript output");
- }
-
- someColors.add(cc);
+ Color c = cols[count];
+ someColors.add(c);
}
if (fractions[fractions.length - 1] < 1f) {
someColors.add(cols[cols.length - 1]);