[Mono-dev] Bitmap manipulation - am I doing it right?
Stefanos A.
stapostol at gmail.com
Tue Mar 31 17:17:44 EDT 2009
Does GDI+ support alpha blending? If so, why don't you just draw a
translucent (say alpha = 128) layer on top of the selected region? You
could also fake this with additive or multiplicative blending, but the
result will look worse.
Την Wed, 01 Apr 2009 00:11:37 +0300,ο(η) Stifu <stifu at free.fr> έγραψε:
>
> Thanks for your answer.
>
> 1) I'm not sure how that would work... Not saying it's not possible or
> anything, I just have no idea. By the way, the size and the color of the
> rectangle can vary, and it can also be semi-transparent (in case that's a
> problem).
> 2) How would you do this, technically? Because the only solution that
> comes
> to my mind is to clone a little part of my Bitmap to create the temporary
> copy... and making a sub-sized clone of a Bitmap is actually much slower
> than making a full clone. So it'd be actually slower than my current
> implementation.
>
>
> Andreas Nahr wrote:
>>
>> 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
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>>
>
--
Χρησιμοποιώ το επαναστατικό πρόγραμμα αλληλογραφίας της Opera:
http://www.opera.com/mail/
More information about the Mono-devel-list
mailing list