Denis,

Upon examining the image that JAI creates I noticed that the color model is not 
bilevel for this bilevel image.  I added the following code to your class 
between the line that creates the planar image and the line that fetches the 
planar image as a buffered image.

        if (planar.getColorModel() instanceof IndexColorModel) {

            IndexColorModel icm = (IndexColorModel) planar.getColorModel();
            int numBands = icm.hasAlpha() ? 4 : 3;
            byte[][] data = new byte[numBands][icm.getMapSize()];

            icm.getReds(data[0]);
            icm.getGreens(data[1]);
            icm.getBlues(data[2]);

            if (numBands == 4) {
                icm.getAlphas(data[3]);
            }

            planar = JAI.create("lookup", planar, new LookupTableJAI(data));
        }

This makes the blocky lines come out smooth and thin.

I've learned that sometimes JAI's tiff codec creates an image with ColorModel 
of type IndexColorModel and sometimes it creates an image with a 
ComponentColorModel.  It seems that that latter type succeeds on your text code 
and the former type fails.  The above code snippet moves your image from using 
an IndexColorModel to using a ComponentColorModel.

Cheers!

         -Kelly
[Message sent by forum member 'kellystevens' (kellystevens)]

http://forums.java.net/jive/thread.jspa?messageID=144467

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to