Hi Gary,

The current implementation of the TexturePaint object is optimized for
ByteComponent and IntegerComponent images such as:

        TYPE_INT_XRGB
        TYPE_INT_ARGB
        TYPE_BYTE_INDEXED

You should notice a drastic improvement in speed if you use one of those
formats for your image.

Also, the code to transfer images to the destination is a giant matrix
of source to dest algorithms.  That matrix is only sparsely populated.
The unpopulated entries use workaround code that does something akin to
"convert src to ARGB, convert dest to ARGB, draw between temps, save
dest pixels back from ARGB buffer".  The above formats are more likely
to have an optimized entry in their (source image) row of the matrix.

                                ...jim


------------- Begin Included Message -------------

X-Accept-Language: en
Date: Thu, 27 Jan 2000 21:15:01 -0800
From: Gary Myron <[EMAIL PROTECTED]>
Subject: [JAVA2D] Drawing fill patterns
To: [EMAIL PROTECTED]

Hi all,

We have an application that draws many polygons and rectangles that are
filled with various fill patterns.  The performance is poor.  The fill pattern,
or TexturePaint, draw is at least 3x slower than alpha channel fills.
I would welcome any suggestions on how we can improve our performance.

This is our current process:

At initialization we create all of the patterns.  We create a 16x16 bit
BufferedImage
and draw various lines into the image.  We then create a TexturePaint from the
image.

        BufferedImage bi = new BufferedImage(16,16,
                                        BufferedImage.TYPE_4BYTE_ABGR_PRE);
        Graphics2D g = bi.createGraphics();
        g.drawLine(0,15,15,0);   // course 45 degree pattern
        TexturePaint tp = new TexturePaint(bi, new Rectangle(16,16));
        // tp is placed in a table for later drawing

At paint time:

We look up the desired pattern in a table and get its TexturePaint.  When call
setPaint with the pattern and draw the filled polygon or rectangle.

comments?

===========================================================================
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".

------------- End Included Message -------------

===========================================================================
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