Hi Eric, > final BufferedImage buf = new BufferedImage(Math.round(fWidth*scale), > Math.round(fHeight*scale), BufferedImage.TYPE_BYTE_BINARY, new
"Well, here's you problem". You're creating a binary image, with only two possible colors. So the dithering can't be smooth by definition - each color can only be black or white. Thanks, Dmitri On Thu, May 11, 2006 at 09:00:27AM +0200, Erik Vanherck wrote: > Hi, > > In a certain piece of code we were using Jai to dither a rendering of our > chart objects, however this caused some performance issues and we noticed > the RenderingHints.KEY_DITHERING so we tried moving the dithering into the > rendering of the chart that was already using the graphics2D of a > bufferedImage. While very performant, it doesn't yield the expected > result. Instead of dithered it gives us a thresholded black and white > image. I found very little information about the dithering hint while > googling and searching the forums, except people asking how to turn it off > ;-) > > Now my question is, should the pseudo code below work ? > > <--- code snippet ---> > > byte[] map = {(byte)0xFF, (byte)0x00}; > final BufferedImage buf = new BufferedImage(Math.round(fWidth*scale), > Math.round(fHeight*scale), BufferedImage.TYPE_BYTE_BINARY, new > IndexColorModel(1,2,map,map,map)); > final Graphics2D g2 = (Graphics2D)buf.getGraphics(); > g2.setRenderingHint(RenderingHints.KEY_DITHERING,RenderingHints.VALUE_DITHER_ENABLE); > g2.scale(scale,scale); > fChart.setGraphics2D(g2); > fChart.render(); > return buf; > > <--- code snippet ---> > > For reference we are using jdk 1.4.2_08 and any solution should work in > java.awt.headless mode. > > Any feedback is highly appreciated > > Best regards, > Erik > > > Erik Vanherck - Product Delivery Manager > Inventive Designers > Visit http://www.inventivedesigners.com > Visit http://www.inventivedesigners.com/scriptura for Scriptura > information ! > > Phone: +32 - 3 - 8210170 > Fax: +32 - 3 - 8210171 > Email: [EMAIL PROTECTED] > > "Computers in the future may weigh no more than 1.5 tons." - Popular > Mechanics, forecasting the relentless march of science, 1949 > Inventive Designers' Email Disclaimer: > http://www.inventivedesigners.com/email-disclaimer > > =========================================================================== > 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". =========================================================================== 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".