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

Andreas Nahr ClassDevelopment at A-SoftTech.com
Tue Mar 31 08:18:10 EDT 2009


What you are doing is very inefficient.
Two ideas:
1) Don't directly draw onto the image if you are only want so show something
to the user and not really want to manipulate the image. You could easily
use a rectangle control and show that above the image control.
2) Before you paint the rectangle copy the overpainted area into a temporary
image. Then draw the rectangle. To (re)move the rectangle copy the data back
from the temporary image (do not copy the entire image or create a new one)

Andreas

-----Ursprüngliche Nachricht-----
Von: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag von Stifu
Gesendet: Dienstag, 31. März 2009 10:10
An: mono-devel-list at lists.ximian.com
Betreff: [Mono-dev] Bitmap manipulation - am I doing it right?


Hello,

I have an application that displays graphics, stored in a Bitmap.
When you hover the concerned Panel, a square shows what tile you're
currently highlighting. So if you move your cursor, the square moves too.

What I'm doing is, each time I repaint my Panel, clone the Bitmap then draw
the rectangle (square) on it. If I didn't clone it first and worked directly
with the original Bitmap, then the squares would never go away, and keep on
multiplying as you move your cursor over the Panel.
So I'm just wondering: is cloning the right thing to do here? Or is there a
better / more efficient way to achieve the same results, like some kind of
temporary modifications to a Bitmap or whatever? (I'm using double
buffering, so everything has to be on the same Bitmap)

I already implemented clipping to improve performances, but I wanted to know
if there was anything else I could do... Thanks.
-- 
View this message in context:
http://www.nabble.com/Bitmap-manipulation---am-I-doing-it-right--tp22800298p
22800298.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list