imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45);
imageObjectInfo.setBitsPerPixel(state.getBitsPerPixel());
+ imageObjectInfo.setResourceInfo(info.getResourceInfo());
- AFPResourceManager resourceManager = info.getAFPResourceManager();
+ AFPResourceManager resourceManager = info.getResourceManager();
try {
resourceManager.createObject(imageObjectInfo);
} catch (IOException ioe) {
RendererContextWrapper ctx = RendererContext.wrapRendererContext(context);
BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false);
+ AffineTransform trans = state.getData().getTransform();
float scale = AFPRenderer.NORMAL_AFP_RESOLUTION
/ context.getUserAgent().getTargetResolution();
if (scale != 1) {
at.scale(scale, scale);
+ if (!at.isIdentity()) {
+ trans.concatenate(at);
+ }
}
- AffineTransform trans = state.getData().getTransform();
- trans.concatenate(at);
// concatenate to transformation matrix
// state.concatenate(at);
private int y;
/** see HANDLER_CONFIGURATION */
- private Configuration cfg;
+ private Configuration handlerConfiguration;
/** see AFP_FONT_INFO */
private FontInfo fontInfo;
/** true if SVG should be rendered as a bitmap instead of natively */
private boolean paintAsBitmap;
+ /** the resource information */
+ private AFPResourceInfo resourceInfo;
+
/**
* Returns the width.
*
* @return the handler configuration
*/
public Configuration getHandlerConfiguration() {
- return this.cfg;
+ return this.handlerConfiguration;
}
/**
* @param cfg the handler configuration
*/
public void setHandlerConfiguration(Configuration cfg) {
- this.cfg = cfg;
+ this.handlerConfiguration = cfg;
}
/**
*
* @return the AFPResourceManager
*/
- public AFPResourceManager getAFPResourceManager() {
+ public AFPResourceManager getResourceManager() {
return this.resourceManager;
}
return this.paintAsBitmap;
}
+ /**
+ * Sets the resource information
+ *
+ * @param resourceInfo the resource information
+ */
+ public void setResourceInfo(AFPResourceInfo resourceInfo) {
+ this.resourceInfo = resourceInfo;
+ }
+
+ /**
+ * Returns the resource information
+ *
+ * @return the resource information
+ */
+ public AFPResourceInfo getResourceInfo() {
+ return resourceInfo;
+ }
+
/** {@inheritDoc} */
public String toString() {
return "AFPInfo{width=" + width
+ ", height=" + height
+ ", x=" + x
+ ", y=" + y
- + ", cfg=" + cfg
+ + ", cfg=" + handlerConfiguration
+ ", fontInfo=" + fontInfo
+ ", resourceManager=" + resourceManager
+ ", state=" + state
+ ", paintAsBitmap=" + paintAsBitmap
+ + ", resourceInfo=" + resourceInfo
+ "}";
}
afpi.setResourceManager(((AFPResourceManager)context.getProperty(
AFPRendererContextConstants.AFP_RESOURCE_MANAGER)));
- Map foreign = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
- QName qName = new QName(ExtensionElementMapping.URI, null, "conversion-mode");
- if (foreign != null
- && "bitmap".equalsIgnoreCase((String)foreign.get(qName))) {
- afpi.setPaintAsBitmap(true);
+ Map foreignAttributes = (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
+ if (foreignAttributes != null) {
+ AFPForeignAttributeReader foreignAttributeReader = new AFPForeignAttributeReader();
+ AFPResourceInfo resourceInfo = foreignAttributeReader.getResourceInfo(foreignAttributes);
+ afpi.setResourceInfo(resourceInfo);
+
+ QName qName = new QName(ExtensionElementMapping.URI, null, "conversion-mode");
+ if ("bitmap".equalsIgnoreCase((String)foreignAttributes.get(qName))) {
+ afpi.setPaintAsBitmap(true);
+ }
}
return afpi;
}
// Set the object area info
graphicsObjectInfo.setObjectAreaInfo(objectAreaInfo);
- AFPResourceManager resourceManager = afpInfo.getAFPResourceManager();
+ AFPResourceManager resourceManager = afpInfo.getResourceManager();
// Create the graphics object
resourceManager.createObject(graphicsObjectInfo);