On 18.10.2012 14:14, Armin Le Grand wrote:
[...]
..but will convert BitmapColor to sal_uInt8 (because there is a inline
operator in the class BitmapColor), then casting to sal_uInt32 (since
ColorData is a typedef to sal_uInt32) and thus would be wrong. Sigh.

Herbert is right, these operators are dangerous. I found two ways:
(a) extract RGB by feet from BitmapColor and construct a Color with it
(b) use the 'operator Color()' : '== aBitmapColor.operator Color()'

Where (a) will need more code, and (b) looks ugly.
I tend to (b) currently...

Option (c) could be even better: removal of both the dangerous conversion BitmapColor::operator sal_uInt8() and the implicit construction of a BitmapColor from a sal_uInt8.

But binfilter depends on their behind the scenes conversions and nobody should or would want to touch binfilter to make it compile again after such a change. Yet another reason to get rid of binfilter...

Herbert

Reply via email to