[Magick-bugs] Fix for recent "Convert to windows .ico format no longer inverts alpha channel." patch
Matthew Litwin
mlitwin at sonic.net
Mon Jan 12 10:30:24 PST 2009
I got this one wrong, in a way which busts conversion to .ico's when
there is an alpha channel.
I said:
> So around line 997 where we have
>
> if (next->matte == MagickFalse)
> *q++=ScaleQuantumToChar(255);
> else
> *q++=ScaleQuantumToChar(p->opacity);
>
> I think the last line should be
> *q++=ScaleQuantumToChar(255 - p->opacity);
but in fact it should be
*q++=ScaleQuantumToChar(QuantumRange - p->opacity);
255 is of course a char value, but we are converting from a Quantum
*to* a char.
I've tested this change on some more real world examples.
One thing I still don't understand, though, is the *q+
+=ScaleQuantumToChar(255) line, which seems like it should then be
"*q++=ScaleQuantumToChar(QuantumRange)" Perhaps in the next->matte ==
MagickFalse, the particular value is unimportant, though I've not
tested that.
Sorry for the confusion!
-Matt
More information about the Magick-bugs
mailing list