Thanks,

I'll try to repay the favor to someone else with a question I can answer.

Bill Ensley
Bear Printing

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 9:58 AM
To: Bill Ensley; iText Mail Group
Subject: Re: [iText-questions] Transparant Images


Here you have, in a silver platter:

import java.io.*;
import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import java.awt.Color;

public class stamperjap {
    public static void main(String args[]) {
        try {
            Document doc = new Document();
            PdfWriter writer = PdfWriter.getInstance(doc, new
FileOutputStream("c:\\stamperjap.pdf"));
            doc.open();
            PdfContentByte cb = writer.getDirectContent();
            for (int k = 0; k < 40; ++k)
                doc.add(new Paragraph("This text is under the images - this
text is under the images."));
            byte dataImage[] = {-1, 0, 0, 0, -1, 0, 0, 0, -1};
            Image img1 = Image.getInstance(3, 1, 3, 8, dataImage);
            img1.scalePercent(6400, 19200);
            Image img2 = Image.getInstance(3, 1, 3, 8, dataImage);
            img2.scalePercent(6400, 19200);
            Image img3 = Image.getInstance(3, 1, 3, 8, dataImage);
            img3.scalePercent(6400, 19200);
            img1.setAbsolutePosition(50, 600);
            img2.setAbsolutePosition(50, 600 - 200);
            img3.setAbsolutePosition(50, 600 - 400);
            byte maskr[] = {0x18, 0x3c, 0x66, (byte)0xc3, 0x66, 0x3c, 0x18};
            Image mask = Image.getInstance(8, 7, 1, 1, maskr);
            mask.makeMask();
            mask.setInvertMask(true);
            img2.setImageMask(mask);
            byte smaskr[] = new byte[63];
            for (int k = 0; k < smaskr.length / 2 + 1; ++k)
                smaskr[k] = smaskr[smaskr.length - 1 - k] = (byte)(k * 254 *
2 / smaskr.length);
            Image smask = Image.getInstance(63, 1, 1, 8, smaskr);
            smask.makeMask();
            img3.setImageMask(smask);
            cb.addImage(img1);
            cb.addImage(img2);
            cb.addImage(img3);
            doc.close();
            System.out.println("Fim.");
        }
        catch ( Exception e ) {
            e.printStackTrace();
        }
    }
}

Best Regards,
Paulo Soares

----- Original Message -----
From: "Bill Ensley" <[EMAIL PROTECTED]>
To: "iText Mail Group" <[EMAIL PROTECTED]>
Sent: Wednesday, June 09, 2004 21:06
Subject: RE: [iText-questions] Transparant Images


> Paulo,
>
> Thank you for your response, but I must just not be getting it.
>
> Do you have any code samples, other than the tutorial, that illustrate
image
> masking and transparency?
>
> Thanks
> Bill Ensley
> Bear Printing
>
>
> -----Original Message-----
> From: Paulo Soares [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 05, 2004 5:13 AM
> To: Bill Ensley; iText Mail Group
> Subject: Re: [iText-questions] Transparant Images
>
>
> The pdf format doesn't support ARGB, only RGB. Transparency is done:
>
> - setting an array to mark the transparent colors (6 elements for RGB)
> - creating a BW image to use as a mask
> - creating a grayscale image to use as an smask to have 256 degrees of
alpha
>
> Best Regards,
> Paulo Soares
>
> ----- Original Message -----
> From: "Bill Ensley" <[EMAIL PROTECTED]>
> To: "iText Mail Group" <[EMAIL PROTECTED]>
> Sent: Saturday, June 05, 2004 2:52
> Subject: RE: [iText-questions] Transparant Images
>
>
> > Sorry to bother again, but image.setTransparency() is not working at
all,
> I
> > see no effect on the output.
> >
> > Any thoughts?
> >
> > Thanks
> > Bill Ensley
> > Bear Printing
> >   -----Original Message-----
> >   From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of Bill
> Ensley
> >   Sent: Friday, June 04, 2004 6:00 PM
> >   To: iText Mail Group
> >   Subject: RE: [iText-questions] Transparant Images
> >
> >
> >   Never mine, I found it
> >   Image.setTransparency(int[]);
> >
> >   Bill Ensley
> >   Bear Printing
> >     -----Original Message-----
> >     From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of Bill
> Ensley
> >     Sent: Friday, June 04, 2004 5:15 PM
> >     To: iText Mail Group
> >     Subject: [iText-questions] Transparant Images
> >
> >
> >     My Apologies,
> >     I'm sure someone has already asked this question, but I was unable
to
> > find it in the mail archives.
> >
> >     I have a dynamically generated ARGB Image that has some transparent
> > areas.
> >
> >     When I put this image into a PDF, it loses it's transparency.
> >
> >     Am I missing something simple?
> >
> >     Thanks
> >     Bill Ensley
> >     Bear Printing
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: GNOME Foundation
> Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
> GNOME Users and Developers European Conference, 28-30th June in Norway
> http://2004/guadec.org
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
>From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to