Wiki Page Content

Differences between revisions 7 and 8
Revision 7 as of 2010-05-18 14:20:54
Size: 2614
Comment: refactor, add structure
Revision 8 as of 2010-05-21 03:45:21
Size: 3039
Comment: Added info on X11 ShapeExtension
Deletions are marked like this. Additions are marked like this.
Line 24: Line 24:

=== X11 ===

 * Set via the "Shape Extension" http://en.wikipedia.org/wiki/Shape_extension
 * Documentation with C API http://www.xfree86.org/current/shapelib.html
 * If extension is missing from X, add Load "extmod" to the "Modules" section of the xorg.conf file (=makes for a good error message on shape extension detection).

Per-pixel alpha for window-shapes require support from a "compositing window manager".

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

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

X11

Per-pixel alpha for window-shapes require support from a "compositing window manager".

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. 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).

OSX

If Cocoa also uses also a shape, it may be good to break out a common "2D shape calculation" algorithm that applies to both architectures.

Shape Regions

Note that a shape structure made out of regions has a list of 2D points defining a polygon AND a add/delete flag. For example a doughnut is made of two circle regions, one added and one deleted.

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