Hy Paolo, I couldn't wait.... :)
And tried it... You made it, the images now show up!
(they do not support transparence).
http://www.hydrologis.com/testfiles/test.pdf
Inside the legend window I miss some strings... on what could that depend?
Lots of thanks for the help,
Sincerely
Andrea
On Friday 15 October 2004 11:53, Paulo Soares wrote:
> I know where the problem is. When you set the rectangle with a
> transparent color that transparency is also carried to the images.
> Here's the fix to be applied on itext-paulo-139 PdfGraphics2D:
>
> private boolean drawImage(Image img, Image mask, AffineTransform
> xform, Color bgColor, ImageObserver obs) {
> if (xform==null) return true;
>
> xform.translate(0, img.getHeight(obs));
> xform.scale(img.getWidth(obs), img.getHeight(obs));
>
> AffineTransform inverse = this.normalizeMatrix();
> AffineTransform flipper =
> AffineTransform.getScaleInstance(1,-1);
> inverse.concatenate(xform);
> inverse.concatenate(flipper);
>
> double[] mx = new double[6];
> inverse.getMatrix(mx);
> if (currentFillGState != 255) {
> PdfGState gs = fillGState[255];
> if (gs == null) {
> gs = new PdfGState();
> gs.setFillOpacity(1);
> fillGState[255] = gs;
> }
> cb.setGState(gs);
> }
>
> try {
> com.lowagie.text.Image image = null;
> if(!convertImagesToJPEG){
> image = com.lowagie.text.Image.getInstance(img,
> bgColor);
> }
> else{
> BufferedImage scaled = new
> BufferedImage(img.getWidth(null), img.getHeight(null),
> BufferedImage.TYPE_INT_RGB);
> Graphics2D g3 = scaled.createGraphics();
> g3.drawImage(img, 0, 0, img.getWidth(null),
> img.getHeight(null), null);
> g3.dispose();
>
> ByteArrayOutputStream baos = new
> ByteArrayOutputStream();
> com.sun.image.codec.jpeg.JPEGImageEncoder encoder =
> com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(baos);
> com.sun.image.codec.jpeg.JPEGEncodeParam param =
> com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam(scaled);
> param.setQuality(jpegQuality, true);
> encoder.encode(scaled, param);
> scaled.flush();
> scaled = null;
> image =
> com.lowagie.text.Image.getInstance(baos.toByteArray());
>
> }
> if (mask!=null) {
> com.lowagie.text.Image msk =
> com.lowagie.text.Image.getInstance(mask, null, true);
> msk.makeMask();
> msk.setInvertMask(true);
> image.setImageMask(msk);
> }
> cb.addImage(image, (float)mx[0], (float)mx[1], (float)mx[2],
> (float)mx[3], (float)mx[4], (float)mx[5]);
> } catch (Exception ex) {
> throw new IllegalArgumentException();
> }
> if (currentFillGState != 255) {
> PdfGState gs = fillGState[currentFillGState];
> cb.setGState(gs);
> }
> return true;
> }
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: Andrea Antonello [mailto:[EMAIL PROTECTED]
> > Sent: Friday, October 15, 2004 6:13 AM
> > To: Paulo Soares; [EMAIL PROTECTED];
> > Leonard Rosenthol
> > Subject: Re: [iText-questions] problems with output
> >
> > Hy Paolo,
> >
> > > If you changed the top layer to be transparent it will show
> >
> > the pictures
> >
> > > below.
> >
> > I have no layer on top. There was a rectangle, which had
> > transparent fill.
> > However it was at the very bottom.
> > Anyway I now changed it to 4 lines to see if it is that and
> > the result doesn't
> > change:
> > http://www.hydrologis.com/testfiles/test.pdf
> >
> > which brings me back to what Leonard says:
> > > No, the pictures are drawn correctly in the
> >
> > correct "layer" - but
> >
> > > they have the wrong opacity set.
> > >
> > > I just changed the /ExtGState /ca value and they appeared
> > > correctly in Acrobat.
> >
> > In that case I don't understand what the opacity should mean.
> > Really the
> > alphablending? The blending is set by the same routine for
> > all the shapes. So
> > the images should really have no transparency set.
> > What you mean by opacity.
> >
> >
> > What do you think?
> >
> > Thanks for your help,
> > Andrea
> >
> >
> >
> > --
> > ______________________________________________________________
> > ______________
> > HydroloGIS - Environmental Open Source Solutions
> > www.hydrologis.com
> >
> > Andrea Antonello
> > Environmental Engineer
> > mobile: +393288497722
> >
> > "Let it be as much a great honour to take as to give learning,
> > if you want to be called wise."
> > Skuggsja' - The King's mirror - 1240 Reykjavik
> > ______________________________________________________________
> > ______________
--
____________________________________________________________________________
HydroloGIS - Environmental Open Source Solutions
www.hydrologis.com
Andrea Antonello
Environmental Engineer
mobile: +393288497722
"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik
____________________________________________________________________________
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions