[Mono-dev] Bitmap manipulation - am I doing it right?

Stefanos A. stapostol at gmail.com
Wed Apr 1 04:37:25 EDT 2009


Την Wed, 01 Apr 2009 09:08:02 +0300,ο(η) Stifu <stifu at free.fr> έγραψε:

>
> How would that layer on top work, technically?
> Because if it's not part of the same Bitmap (the only painted on the  
> Panel)
> and I that I need to paint twice, then there's some flickering happening.
> Hence the need for double buffering.
>

I cannot speak for GDI+, because I don't know its architecture. However it  
does support alpha channels, which means it should be able to do alpha  
blending. An easy test is to render a filled rectangle with A = 128, using  
the Graphics object of the panel. (Hook the Paint event and make sure the  
Bitmap is rendered before the Rectangle.)

If you are using double-buffering, the composition will always happen in  
the backbuffer - hence no flickering.

Some general reading on alpha blending:
http://en.wikipedia.org/wiki/Alpha_compositing

Code project article on alpha blending Bitmaps (which is not what you  
actually want, but may be useful if the above technique does not work):
http://www.codeproject.com/KB/GDI-plus/AlphaBlending.aspx


More information about the Mono-devel-list mailing list