[udig-devel] dpi issues
andrea antonello
andrea.antonello at gmail.com
Wed Mar 26 08:38:08 PDT 2008
> >You are telling me that if you zoom in one of your BIRT created pdfs
> >you do not see grained curves and so on?
>
> Oh I certainly do, but in a '300 dpi' output the blockiness is only
> seen by zooming in 4x more than in a '72 dpi' output.
Yeah, that is what I wanted to hear. So that means you are right in
your assumptions and I am pretty glad to be wrong. Then this seems
really to be only an itext limit, which makes me wonder, since it is a
very advanced library. I will have to check that back absolutely.
Thanks for pointing that out.
Andrea
> I should say that the method I'm using, which was based on code from
> some udig snippet somewhere (and feedback from this list) effectively
> allocates a much bigger BufferedImage for the 300 dpi case - the
> image needs, of course, to have one pixel for each 'dot' in the
> dpi. That image is handed over to BIRT and BIRT creates the report
> (it has a choice of pdf, postscript, html, doc, ppt, etc). I've only
> really used html, pdf outputs.
>
> Here's the basic code:
>
> mult = ((double) dpi) / 72.0;
>
> /**
> * Note: TYPE_INT_ARGB produces colour-inverted PDF images for some
> reason. Since we prefer
> * nice pdf reports to worrying about transparency, we use TYPE_INT_RGB.
> */
> int type = BufferedImage.TYPE_INT_RGB;
> BufferedImage image = new BufferedImage((int) (width * mult), (int)
> (height * mult), type);
>
> Graphics2D g = image.createGraphics();
>
> [snip]
>
> DrawMapParameter dmp = new DrawMapParameter(g, new
> java.awt.Dimension((int) (width * mult),
> (int) (height * mult)), map, bs, dpi, style, new NullProgressMonitor());
> try {
> ApplicationGIS.drawMap(dmp);
> }
> catch (RenderException e) {
> logger.log(Level.WARNING, "Problem drawing Map:" + e);
> }
> finally {
> g.dispose();
> }
>
> try {
> mapImageFile = File.createTempFile("ewo", "." + getImageExtensionType());
> ImageIO.write(image, getImageExtensionType(), mapImageFile);
> fis = new FileInputStream(mapImageFile.getPath());
> }
> catch (IOException e) {
> logger.log(Level.WARNING, "Problem writing Map report image " + e);
> }
>
> return fis;
>
> // and 'fis' is used by BIRT.
>
> Vince.
>
> Vince Darley
> CEO, Eurobios UK Ltd
> Tel: +44 207 921 0445
> Mobile: +44 794 154 8527
> www.eurobios.com
>
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
More information about the udig-devel
mailing list