Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
andreas.ryland@gmail.com - 19 Jun 2006 21:02 GMT
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(),BufferedImage.TYPE_BYTE_INDEXED,(IndexColorModel)cm);
gfx.setRenderingHint(RenderingHints.KEY_DITHERING,RenderingHints.VALUE_DITHER_DISABLE);
gfx.drawImage(image,0,0,null);
gfx.dispose();
Andrey Kuznetsov - 20 Jun 2006 13:32 GMT
> BufferedImage newImage = new
> BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.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

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.