mirror of
https://github.com/apache/xmlgraphics-fop.git
synced 2024-09-14 00:01:49 +02:00
Made PDFImageHandlerGraphics2D accessible
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@825902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5dd6862ad1
commit
c7e17515ef
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user