Wiki Page Content

Differences between revisions 4 and 5
Revision 4 as of 2010-05-18 14:13:03
Size: 2352
Comment: Fix wiki markup
Revision 5 as of 2010-05-18 14:14:46
Size: 2363
Comment: Fix more wiki syntax
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
# some setting may be needed for this step, like a key color
# optional, may be enabled via a mode or when architecture needs it
# optional, depends on architecture requirements
# this internal function can receive pointers to all the above and use what it needs
 # some setting may be needed for this step, like a key color
 # optional, may be enabled via a mode or when architecture needs it
 # optional, depends on architecture requirements
 # this internal function can receive pointers to all the above and use what it needs
Line 32: Line 32:
* Sets shape by generating regions: http://comrade.ownz.com/docs/shapewnd.html
* Shape of Form by using background key color: http://msdn.microsoft.com/en-us/beginner/cc963986.aspx
* Setting per-Window alpha: http://msdn.microsoft.com/en-us/beginner/cc963986.aspx
* Form app in .Net calling the Win32 Api: http://www.codeproject.com/KB/miscctrl/AlphaForm.aspx
* Great summary with examples for all modes in Delphi: http://melander.dk/articles/alphasplash/
 * Sets shape by generating regions: http://comrade.ownz.com/docs/shapewnd.html
 * Shape of Form by using background key color: http://msdn.microsoft.com/en-us/beginner/cc963986.aspx
 * Setting per-Window alpha: http://msdn.microsoft.com/en-us/beginner/cc963986.aspx
 * Form app in .Net calling the Win32 Api: http://www.codeproject.com/KB/miscctrl/AlphaForm.aspx
 * Great summary with examples for all modes in Delphi: http://melander.dk/articles/alphasplash/
Line 41: Line 41:
* MSDN info: http://msdn.microsoft.com/en-us/library/ms633556%28VS.85%29.aspx
* Sample code: http://www.nuonsoft.com/blog/2009/05/27/how-to-use-updatelayeredwindow/
 * MSDN info: http://msdn.microsoft.com/en-us/library/ms633556%28VS.85%29.aspx
 * Sample code: http://www.nuonsoft.com/blog/2009/05/27/how-to-use-updatelayeredwindow/

This is a scratch pad for the Shaped Windows Google Summer of Code 2010 project, by Eli Gottlieb

The code is available here: http://hg.libsdl.org/SDL-gsoc2010_shaped_windows

Status

Documentation

Notes

Pre-Processing

Possible pre-processing pipeline:

input_mask surface -(1)-> 8bit alpha -(2)-> 1bit mask -(3)-> 2D region -(4)-> arch specific set shape

  • # some setting may be needed for this step, like a key color # optional, may be enabled via a mode or when architecture needs it # optional, depends on architecture requirements # this internal function can receive pointers to all the above and use what it needs

Windows

Regions

Most commonly used is code that essentially sets a "region" which defines which pixels are shown and which are not. Most algorithms uses the Win32 region functions to compose this shape which is simple but works. If Cocoa also uses a shape, it may be good to break out a common "2D shape calculation" algorithm that applies to both architectures. In any case, the input to this process is a binarized (1bit) image. Note that you don't get any "blending" on the edges with this approach.

Here some other sample code:

Layered Window

Now there is another way to provide transparency using a alpha-bitmap in Windows. The API now is the UpdateLayeredWindow() call:

Even with this approach a shape may still be important to get rid of clicks to the window - a window that is almost transparent (i.e. alpha=1) seems to have no shape, but will still receive clicks on those pixels. Note also, that the layered window API is not supported on WinCE (but the shape API is).

None: SDL-gsoc2010_shaped_windows (last edited 2016-06-10 19:33:30 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit