JAI ColorConvertDescriptor, ColorMapOpImage, IndexColorModel anddefine one color as transparent


B

Bernhard Messerer

High all!

Same problem as I posted some days ago, but some more info... I'm now
working with JAI and think I could define a color transparent via either
the ColorConvertDescriptor or the ColorOpImage.
ColorOpImage seems to transform the palette somehow with
"transformColormap(byte[][] colormap)", but I have no idea on how to use
this to define a color as transparent (if possible).
ColorConvertDescriptor seems to convert the colors via a ColorModel, but
I have no idea on how to create this. May images (loaded TIFF images or
PNGs) seems to use an IndexColorModel (this is what getClass().getName()
says), and as I understand it I'd just have to create the same
IndexColorModel with a transparent index defined (the constructor takes
this as argument). But how to create "the same" ColorModel? And I assume
this takes more time to render then, I think best woulod be to just
replace the IndexColorModel of my TIFF image with "the same" (again,
how?) but with a transparentIndex defined (How to get this index for
e.g., white???); But how can I "replace" the ColorModel of a RenderedOp
(this is what is loaded from a file).
Is there any other way to define a color as transparent in JAI?

kind regards,

Messi
 
Ad

Advertisements

R

Roedy Green

Same problem as I posted some days ago, but some more info... I'm now
working with JAI and think I could define a color transparent via either
the ColorConvertDescriptor or the ColorOpImage.

I think life will be much clearer if you study the source code for
IndexedColorModel. It is really very simple.
 

Top