<br><div class="gmail_quote">On Mon, May 23, 2011 at 12:43 AM, Hans-Peter Diettrich <span dir="ltr"><<a href="mailto:DrDiettrich1@aol.com">DrDiettrich1@aol.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Max Vlasov schrieb:<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Ok, another example. Imagine that two alpha png is merged and drawed on the form on the fly.<br>
</blockquote>
<br></div>
Is that on-the-fly merging really necessary?<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
And you drag a small window over this form. My experience tells me that win32 will do great automatic job of narrowing the final drawing of the bitmap to smallest rectangle possible, but my internal procedures of alpha-blending can get this information only from GetUpdateRect/GetUpdateRgn, otherwise every single pixel moving of this window will lead to full alpha-blending of these bitmaps. ClipRect won't provide this information<br>
</blockquote>
<br></div>
I'm not sure what you mean. When the dragged window also uses alpha-blending, then Windows (GDI) must do that job. Using GetUpdateRect IMO should not work, because BeginPaint restricts output to the ClipRect.<div><div>
</div><div class="h5"><br>
<br>
DoDi<br>
<br></div></div></blockquote></div><br><br>I must admit I was wrong saying that ClipRect doesn't provide the information about updating areas. It does, partly my misunderstanding came from the naming change in Delphi. Usually win32 rect/region api functions comes in pairs with similar names, but ClipRect property is not a call to GetClipRect (there's no such function), but to GetClipBox function that is just partly related to clipping regions. And Luiz is also right referring to rcPaint member. So if one needs the update rect, there are plenty of options already. <br>
<br>Actually I needed access not only to update rect, but to the update region (for example in order to effectively resolve small rectangles in different areas of a big window). In this case I also found a replacement for GetUpdateRgn, it's GetRandomRgn, documented not so long ago (so I was not aware of its existence) and according to the help it contains the correct region not only before, but also after BeginPaint. So I will probably use this one instead of windowproc hacking<br>
<br>As for necessity for on-the-fly drawing, I usually pay much attention to resources used and don't allocate much unless is necessary. The system working on the fly consumes much less memory because doesn't use intermediate buffer. Sometimes it even can not use bitmaps at all (regions filling/framing) So there are several approaches, I think they all have their rights to exist. <br>
<br>Max<br>