aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2009-02-05 15:01:36 +0000
committerJeremias Maerki <jeremias@apache.org>2009-02-05 15:01:36 +0000
commit7fbf442044c42fce773c36cd9aea80694abf007d (patch)
tree323b2991e93ecddce9dad5b58a2dc1a183172722 /src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java
parent46334ec875bcbbd0fba0370a62c8446c2a038f12 (diff)
parent879e33c0429f91fd9d6734b7d00410b71afbfa1d (diff)
downloadxmlgraphics-fop-7fbf442044c42fce773c36cd9aea80694abf007d.tar.gz
xmlgraphics-fop-7fbf442044c42fce773c36cd9aea80694abf007d.zip
Merge from Trunk revisions 740276 - 741103.
Hooked in the new AFP resource level defaults into the IF-size of the image handlers. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@741120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java')
-rw-r--r--src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java b/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java
index 247ab6d6f..1228365f2 100644
--- a/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java
+++ b/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java
@@ -32,6 +32,9 @@ import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
import org.apache.fop.afp.AFPDataObjectInfo;
import org.apache.fop.afp.AFPObjectAreaInfo;
import org.apache.fop.afp.AFPPaintingState;
+import org.apache.fop.afp.AFPResourceInfo;
+import org.apache.fop.afp.AFPResourceManager;
+import org.apache.fop.afp.modca.ResourceObject;
import org.apache.fop.render.ImageHandler;
import org.apache.fop.render.RenderingContext;
@@ -46,9 +49,11 @@ public abstract class AbstractAFPImageHandlerRawStream extends AFPImageHandler
AFPRendererImageInfo rendererImageInfo) throws IOException {
AFPDataObjectInfo dataObjectInfo = super.generateDataObjectInfo(rendererImageInfo);
ImageRawStream rawStream = (ImageRawStream) rendererImageInfo.getImage();
+ AFPRendererContext rendererContext
+ = (AFPRendererContext)rendererImageInfo.getRendererContext();
+ AFPInfo afpInfo = rendererContext.getInfo();
-
- updateDataObjectInfo(dataObjectInfo, rawStream);
+ updateDataObjectInfo(dataObjectInfo, rawStream, afpInfo.getResourceManager());
setAdditionalParameters(dataObjectInfo, rawStream);
return dataObjectInfo;
@@ -66,8 +71,15 @@ public abstract class AbstractAFPImageHandlerRawStream extends AFPImageHandler
}
private void updateDataObjectInfo(AFPDataObjectInfo dataObjectInfo,
- ImageRawStream rawStream) throws IOException {
+ ImageRawStream rawStream, AFPResourceManager resourceManager) throws IOException {
dataObjectInfo.setMimeType(rawStream.getFlavor().getMimeType());
+
+ AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
+ if (!resourceInfo.levelChanged()) {
+ resourceInfo.setLevel(resourceManager.getResourceLevelDefaults()
+ .getDefaultResourceLevel(ResourceObject.TYPE_IMAGE));
+ }
+
InputStream inputStream = rawStream.createInputStream();
try {
dataObjectInfo.setData(IOUtils.toByteArray(inputStream));
@@ -111,7 +123,7 @@ public abstract class AbstractAFPImageHandlerRawStream extends AFPImageHandler
// Image content
ImageRawStream imageStream = (ImageRawStream)image;
- updateDataObjectInfo(dataObjectInfo, imageStream);
+ updateDataObjectInfo(dataObjectInfo, imageStream, afpContext.getResourceManager());
setAdditionalParameters(dataObjectInfo, imageStream);
// Create image