[python-win32] HRGN, RGNDATA, RGNDATAHEADER

Tim Roberts timr at probo.com
Tue Jan 15 02:23:23 CET 2008


Henry Baxter wrote:
>
> I created a region from a series of points, used the region, and 
> everything works perfectly. I'm interested to know if you know of a 
> better way to do what I'm doing though, since you are obviously quite 
> knowledgeable :)
>
> I have an application with a graphical background and rounded corners. 
> The rounding requires that a certain very small portion of the 
> rectangular window area be fully transparent and/or not there at all. ...
>
> I have calculated that the window region requires 7 different 
> rectangles, all tiny except for one big one in the middle. My (simple) 
> testing shows it is faster than SetLayeredWindowAttributes.

If there are only 7 rectangles, that's not a big deal.  Sometimes people 
get surprised when they draw a polygonal region and discover to their 
horror that it requires 200 rectangles.  Having each blit result in 200 
calls to the driver is not a good thing.  Seven is not a problem.


> Now, do you think I have found a good solution, or is there a better 
> way? I understand that having common controls on a window and using 
> UpdateLayeredWindow can be tricky. I'm interested to know what you think.

One thing about the region code is that it has been in the operating for 
a very long time, and as a result, most of the icky bugs have long since 
been squashed.  The layered window stuff is relatively new.

GDI+ has some nifty features for turning paths into regions, but in the 
end it gets down to the same HRGN structure you have now, and I don't 
know if there are GDI+ wrappers for Python or not.  GDI+ is C++ classes, 
so it isn't a simple ctypes wrap.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list