* @return a data object info object
* @throws IOException thrown if an I/O exception of some sort has occurred.
*/
public AFPDataObjectInfo generateDataObjectInfo(
AFPRendererImageInfo rendererImageInfo) throws IOException {
AFPDataObjectInfo dataObjectInfo = createDataObjectInfo();
// set resource information
setResourceInformation(dataObjectInfo,
rendererImageInfo.getURI(),
rendererImageInfo.getForeignAttributes());
Point origin = rendererImageInfo.getOrigin();
Rectangle2D position = rendererImageInfo.getPosition();
int srcX = Math.round(origin.x + (float)position.getX());
int srcY = Math.round(origin.y + (float)position.getY());
Rectangle targetRect = new Rectangle(
srcX,
srcY,
(int)Math.round(position.getWidth()),
(int)Math.round(position.getHeight()));
AFPRendererContext rendererContext
= (AFPRendererContext)rendererImageInfo.getRendererContext();
AFPInfo afpInfo = rendererContext.getInfo();
AFPPaintingState paintingState = afpInfo.getPaintingState();
dataObjectInfo.setObjectAreaInfo(createObjectAreaInfo(paintingState, targetRect));
return dataObjectInfo;
}