aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2009-10-16 14:12:06 +0000
committerVincent Hennebert <vhennebert@apache.org>2009-10-16 14:12:06 +0000
commitc7e17515ef3e7b09b5a822fe81ffbb1e21da6ff9 (patch)
treef1eb79f2bf1a7f4474f09873d73f57fd32112960 /src/java/org/apache/fop
parent5dd6862ad1eed75fdcc205a228aae7a46a00a46d (diff)
downloadxmlgraphics-fop-c7e17515ef3e7b09b5a822fe81ffbb1e21da6ff9.tar.gz
xmlgraphics-fop-c7e17515ef3e7b09b5a822fe81ffbb1e21da6ff9.zip
Made PDFImageHandlerGraphics2D accessible
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@825902 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java18
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java4
2 files changed, 20 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java
index 18717809d..c3242827a 100644
--- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java
+++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java
@@ -35,6 +35,7 @@ import org.apache.fop.pdf.PDFXObject;
import org.apache.fop.render.AbstractImageHandlerGraphics2D;
import org.apache.fop.render.RendererContext;
import org.apache.fop.render.RenderingContext;
+import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo;
import org.apache.fop.svg.PDFGraphics2D;
/**
@@ -63,6 +64,9 @@ public class PDFImageHandlerGraphics2D extends AbstractImageHandlerGraphics2D
renderer.currentPage,
renderer.getFontInfo());
Rectangle effPos = new Rectangle(origin.x + pos.x, origin.y + pos.y, pos.width, pos.height);
+ if (context.getUserAgent().isAccessibilityEnabled()) {
+ pdfContext.setMarkedContentInfo(renderer.addCurrentImageToStructureTree());
+ }
handleImage(pdfContext, image, effPos);
return null;
}
@@ -87,7 +91,13 @@ public class PDFImageHandlerGraphics2D extends AbstractImageHandlerGraphics2D
float sy = fheight / (float)imh;
generator.comment("G2D start");
- generator.saveGraphicsState();
+ boolean accessibilityEnabled = context.getUserAgent().isAccessibilityEnabled();
+ if (accessibilityEnabled) {
+ MarkedContentInfo mci = pdfContext.getMarkedContentInfo();
+ generator.saveGraphicsState(mci.tag, mci.mcid);
+ } else {
+ generator.saveGraphicsState();
+ }
generator.updateColor(Color.black, false, null);
generator.updateColor(Color.black, true, null);
@@ -115,7 +125,11 @@ public class PDFImageHandlerGraphics2D extends AbstractImageHandlerGraphics2D
imageG2D.getGraphics2DImagePainter().paint(graphics, area);
generator.add(graphics.getString());
- generator.restoreGraphicsState();
+ if (accessibilityEnabled) {
+ generator.restoreGraphicsStateAccess();
+ } else {
+ generator.restoreGraphicsState();
+ }
generator.comment("G2D end");
}
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index 380241ba0..6188433c6 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -1347,5 +1347,9 @@ public class PDFRenderer extends AbstractPathOrientedRenderer implements PDFConf
public void setEncryptionParams(PDFEncryptionParams encryptionParams) {
this.pdfUtil.setEncryptionParams(encryptionParams);
}
+
+ MarkedContentInfo addCurrentImageToStructureTree() {
+ return logicalStructureHandler.addImageContentItem(imageReference);
+ }
}