Redrawing Failed when ColorkeyBitmap is used.

Nov 1, 2011 at 5:55 PM

I tried to move Rectangle Control.

And Background Image is rendered by ColorkeyBitmap for transparency.

But unfortunately redrawing UI doesn't work.

When i remove ColorkeyBitmap, redrawing UI succeedes.(also I have ever used invalidateValue but the result is same.)

What do you think is the problem?

The Only reason why i use ColorkeyBitmap is to apply transparency property.

Please help me.

Thank you.

Nov 2, 2011 at 3:21 AM
Edited Nov 2, 2011 at 3:37 AM

WritePreamble() and WritePostscript() are used in CopyPixelsCore() in ChainedBitmap.cs.

When I remove those two functions, the problem above is solved.(ChainedBitmap is parent of ColorkeyBitmap)


//  WritePreamble();
    _formatConverterSourceFormat = sourceFormat;
    _formatConverter = new FormatConvertedBitmap(source, destinationFormat, Palette, 0);
//  WritePostscript();

What's difference of two cases?

Is there any problem if i remove WritePreamble() and WritePostscript() ?

Nov 2, 2011 at 9:08 PM

WritePreamble is ensures that the freezable can be changed. It checkes two conditions:

1) That the calling thread is the owner thread of the freezable. Freezables are not thread-safe, they can only be updated by the thread that created them.
2) That the freezable is not frozen. Frozen freezables cannot be modified, that are in a read-only state.

WritePostscript raises the changed notifications for the freezable. This includes calling the OnChanged virtual, invalidating sub properties, and raising the Changed event.

Both are extrememly important to the correct functioning of a freezable.

I'm not certain as to what you are trying to do.  A repro is always useful.