Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to kill java2D dithering? RenderingHints does not disable unwanted dithering

Reply
Thread Tools

How to kill java2D dithering? RenderingHints does not disable unwanted dithering

 
 
andreas.ryland@gmail.com
Guest
Posts: n/a
 
      06-19-2006
I have seen this question being posted before, and some workarounds
suggested, however it always seemed to be in an applet context and as
such the worarounds were not usable to me.

Using the code pasted below, I draw a directcolormodel image on a
indexcolormodel image, with a ready-calculated indexcolormodel
provided.

But the images have problems and the quality is not good because solid
filled areas are dithered into half tones when half tones are available
in the palette in the indexcolormodel provided. I try to stop java from
changing the colors of the pixels in my image by setting the dither
disble rendering hint but this has no effect.

Is this a bug or do I have to take and special steps to make the
rendring hint count ?

BufferedImage newImage = new
BufferedImage(image.getWidth(),image.getHeight(),B ufferedImage.TYPE_BYTE_INDEXED,(IndexColorModel)cm );
gfx.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
gfx.drawImage(image,0,0,null);
gfx.dispose();

 
Reply With Quote
 
 
 
 
Andrey Kuznetsov
Guest
Posts: n/a
 
      06-20-2006
> BufferedImage newImage = new
> BufferedImage(image.getWidth(),image.getHeight(),B ufferedImage.TYPE_BYTE_INDEXED,(IndexColorModel)cm );
> gfx.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
> gfx.drawImage(image,0,0,null);
> gfx.dispose();


are you already tried with getRGB() and setRGB()?

Andrey

--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
PJA and manifest Class-path problem and Could not find class: com.eteks.java2d.PJAGraphicsEnvironment pcouas@infodev.fr Java 1 04-13-2010 05:21 PM
how to implement dithering & frc control 256 color Dstn powerman VHDL 0 04-05-2006 03:30 AM
how to remove dithering in scanned images? peter Digital Photography 4 11-20-2005 01:13 AM
Java2D: not possible to set 32bpp ints? Timo Nentwig Java 6 05-08-2004 12:22 AM



Advertisments