aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2003-09-13 14:23:40 +0000
committerGlen Mazza <gmazza@apache.org>2003-09-13 14:23:40 +0000
commit2febf79f726b7956d570d7ae0a0899833b49d795 (patch)
tree26fbee5255dff5e81218ade51c20b6505a996b66
parent925268e364bd4bb9d59b61e53d48077dc1dcb34a (diff)
downloadxmlgraphics-fop-2febf79f726b7956d570d7ae0a0899833b49d795.tar.gz
xmlgraphics-fop-2febf79f726b7956d570d7ae0a0899833b49d795.zip
Applied Thomas DeWeese's (Batik team) patches to the transcoder code.
patch info: http://marc.theaimsgroup.com/?l=fop-dev&m=106318855328310&w=2 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196902 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/ps/PSTextPainter.java2
-rw-r--r--src/java/org/apache/fop/svg/PDFGraphics2D.java40
-rw-r--r--src/java/org/apache/fop/svg/PDFTextPainter.java2
3 files changed, 14 insertions, 30 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java
index 855be1ddc..ca12f70ed 100644
--- a/src/java/org/apache/fop/render/ps/PSTextPainter.java
+++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java
@@ -146,7 +146,7 @@ public class PSTextPainter implements TextPainter {
List gvtFonts;
gvtFonts = (List) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES);
- Paint forg = (Paint) aci.getAttribute(TextAttribute.FOREGROUND);
+ Paint forg = tpi.fillPaint;
Paint strokePaint = tpi.strokePaint;
Float size = (Float) aci.getAttribute(TextAttribute.SIZE);
if (size == null) {
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java
index d3f48f1fe..dc4523d17 100644
--- a/src/java/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java
@@ -471,6 +471,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
g.setPaint(new Color(1, 1, 1, 0));
g.fillRect(0, 0, width * scaleFactor, height * scaleFactor);
g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight()));
+ g.setComposite(gc.getComposite());
if (!g.drawImage(img, 0, 0, buf.getWidth(), buf.getHeight(), observer)) {
return false;
@@ -500,29 +501,10 @@ public class PDFGraphics2D extends AbstractGraphics2D {
mask[maskpos++] = (byte)(alpha & 0xFF);
if (alpha != 255) {
hasMask = true;
- /*
- if (alpha != 0) {
- binaryMask = false;
- }*/
-
- // System.out.println("Alpha: " + alpha);
- // Composite with opaque white...
- add = (255 - alpha);
- mult = (alpha << 16) / 255;
- result[count++] =
- (byte)(add
- + ((((val >> 16) & 0xFF) * mult) >> 16));
- result[count++] =
- (byte)(add
- + ((((val >> 8) & 0xFF) * mult) >> 16));
- result[count++] = (byte)(add
- + ((((val) & 0xFF) * mult)
- >> 16));
- } else {
- result[count++] = (byte)((val >> 16) & 0xFF);
- result[count++] = (byte)((val >> 8) & 0xFF);
- result[count++] = (byte)((val) & 0xFF);
}
+ result[count++] = (byte)((val >> 16) & 0xFF);
+ result[count++] = (byte)((val >> 8) & 0xFF);
+ result[count++] = (byte)((val) & 0xFF);
}
}
break;
@@ -641,12 +623,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public void draw(Shape s) {
// System.out.println("draw(Shape)");
- Color c;
- c = getColor();
- if (c.getAlpha() == 0) {
- return;
- }
-
AffineTransform trans = getTransform();
double[] tranvals = new double[6];
trans.getMatrix(tranvals);
@@ -672,6 +648,11 @@ public class PDFGraphics2D extends AbstractGraphics2D {
}
}
+ Color c;
+ c = getColor();
+ if (c.getAlpha() == 0) {
+ return;
+ }
if (c.getAlpha() != 255) {
Map vals = new java.util.HashMap();
vals.put(PDFGState.GSTATE_ALPHA_STROKE, new Float(c.getAlpha() / 255f));
@@ -1237,6 +1218,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
writeClip(imclip);
Color c = getColor();
applyColor(c, true);
+ applyPaint(getPaint(), true);
int salpha = c.getAlpha();
if (salpha != 255) {
@@ -1374,6 +1356,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
writeClip(imclip);
Color c = getColor();
applyColor(c, true);
+ applyPaint(getPaint(), true);
boolean fill = true;
boolean stroke = false;
@@ -1382,6 +1365,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
stroke = true;
applyStroke(currentStroke);
applyColor(c, false);
+ applyPaint(getPaint(), false);
}
currentStream.write("BT\n");
diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java
index 135d8740e..6dd83e35f 100644
--- a/src/java/org/apache/fop/svg/PDFTextPainter.java
+++ b/src/java/org/apache/fop/svg/PDFTextPainter.java
@@ -138,7 +138,6 @@ public class PDFTextPainter implements TextPainter {
gvtFonts = (List) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES);
- Paint forg = (Paint) aci.getAttribute(TextAttribute.FOREGROUND);
TextPaintInfo tpi = (TextPaintInfo) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.PAINT_INFO);
@@ -146,6 +145,7 @@ public class PDFTextPainter implements TextPainter {
return;
}
+ Paint forg = tpi.fillPaint;
Paint strokePaint = tpi.strokePaint;
Float size = (Float) aci.getAttribute(TextAttribute.SIZE);
if (size == null) {