/** {@inheritDoc} */
public void generateForm(RenderingContext context, Image image, PSImageFormResource form)
throws IOException {
PSRenderingContext psContext = (PSRenderingContext)context;
PSGenerator gen = psContext.getGenerator();
final ImageGraphics2D imageG2D = (ImageGraphics2D)image;
ImageInfo info = image.getInfo();
String imageDescription = info.getMimeType() + " " + info.getOriginalURI();
final Dimension2D dimensionsPt = info.getSize().getDimensionPt();
final Dimension2D dimensionsMpt = info.getSize().getDimensionMpt();
FormGenerator formGen = new FormGenerator(
form.getName(), imageDescription, dimensionsPt) {
protected void generatePaintProc(PSGenerator gen)
throws IOException {
gen.getResourceTracker().notifyResourceUsageOnPage(
PSProcSets.EPS_PROCSET);
gen.writeln("BeginEPSF");
PSGraphics2DAdapter adapter = new PSGraphics2DAdapter(gen, false);
adapter.paintImage(imageG2D.getGraphics2DImagePainter(),
null,
0, 0,
(int)Math.round(dimensionsMpt.getWidth()),
(int)Math.round(dimensionsMpt.getHeight()));
gen.writeln("EndEPSF");