A
andreas.ryland
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();
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();