You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Domagoj Cosic <Do...@hypercis.de> on 2000/10/04 10:39:29 UTC

org.apache.fop.render.awt.AWTRenderer, again

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A few weeks ago, I posted a patch for the AWTRenderer. However, due to
changes between 0.13.0 an 0.14.0, this patch was not completely correct.
Here is a correct, functioning version:

	public void renderImageArea(ImageArea area) {
		int x = currentAreaContainerXPositionShadow +
		    area.getXOffset();
		int y = currentYPosition;
		int w = area.getContentWidth();
		int h = area.getHeight();
		
		FopImage img = area.getImage();
		
		if (img == null) {
		    System.out.println("area.getImage() is null");
		}
		
		String urlString = img.getURL();
		try {
			URL url = new URL(urlString);
			
			ImageIcon icon = new ImageIcon(url);
			Image image = icon.getImage();
			
			graphics.drawImage(image, x / 1000,
					   pageHeight - y / 1000,
					   w / 1000,
					   h / 1000,
					   null);
		} catch(MalformedURLException mue) {
		}
		
		currentYPosition -= h;
	}

It produces same results as the PDF renderer, as one would expect.

I wonder about why my other patch (DOM tree formatting) caused no reaction
at all...

Regards,

Domagoj

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.0.2i

iQA/AwUBOdresTZvP6Gs5imAEQJ5cQCcCNXKE4tDcMVMJUi8zExQMQ7XQvYAoIBK
SM50TvRcpNaiCfZnwDBm20cE
=Zqpk
-----END PGP SIGNATURE-----