Maemo widget experience – circular clock with transparent background

So last week, I started writing a maemo fremantle widget in a few spare pockets of time. One thing got me stuck. I could not get the thing to be transparent. I tried looking at other widgets’ code but just couldn’t figure it out. Finally at the Extending Hildon Desktop BoF yesterday at the Maemo Summit, I got my answer: set the colormap of the window to be 32bit rgba.

Here is the code needed in the __init__ in a python widget:

colormap = self.get_screen().get_rgba_colormap()
self.set_colormap (colormap)

In the expose event handler, you have to clear with the cairo context (which I had figured out last week) with code like:

cr = self.window.cairo_create()
cr.set_source_rgba (1.0, 1.0, 1.0, 0.0)

My flickr fremantle tag photoset shows the progression and what runs now is:

clock on transparent background

There is still a little work to do, like respecting theme colours and more accurate positioning of hour etc before I create a package to push into extras.

5 Responses to “Maemo widget experience – circular clock with transparent background”

  1. Kalle Vahlman Says:

    One would expect the clearing happen with the CLEAR operator since such thing exists (and has higher chance of using shortcuts to do it).

    Is ther any specific reason not to use CLEAR?

  2. admin Says:

    no reason at all, with clear it will probably work also.

  3. Murray Cumming Says:

    The (my) example code uses transparency:

    If you didn’t find that, please file a bug saying that it should be mentioned from wherever you were looking.

  4. admin Says:

    Murray: thanks, bug filed at:

    Other stuff I looked at was uncommented source code so I had no clue what magic I needed :)

    Your example code is actually very well commented, I wish I had seen it last week :)

  5. Benjamin Otte Says:

    CLEAR does one of two things: It is either optimized to be faster than SRC or it falls back to SRC. In neither case, using the CLEAR operator is worse. If anything, it will be faster.

Leave a Reply