Evan Martin (evan) wrote in evan_tech,
Evan Martin

window-level alpha is not enough

(By the way, there's now a movie up at the Ghosd home page.)

It turns out my computer at work has the fancy nVidia card necessary to run X + the compositing extension, so now all of my windows have gratuitous drop shadows. (It's no XGL/Compiz, though...)

I had originally intended for Ghosd to use this extension when it was available, for it allows hardware acceleration of "real" transparent windows. But now that I have hacked it up (surprisingly easy, by the way: XChangeProperty with _NET_WM_WINDOW_OPACITY), I realize it's not enough, for two reasons:
  1. The current Ghosd drawing model is that if you draw any shape with alpha < 1, the screen shows through. It's as if you're drawing to the screen directly. This is hard to rectify with a window-level alpha.
    This is fixable; it's not hard to change the API to have a window-level alpha in addition to the existing alpha support.
  2. But, even with that, when you do draw to the window with alpha < 1, Cairo wants to merge that color with whatever is underneath, so you need some color underneath. So I need to copy the screen anyway.
Another way of saying that is that this "transparent windows" feature gives me per-window alpha, while what I need is per-pixel alpha on the window. For the antialiased rounded edge of a font, the alpha varies all along, and so what I really need to draw into the window is RGBA, not RGB with a window-level A.

But now that I've written all that, it may be worth special-casing window-level alpha anyway, as it's likely I can fade the alpha much more quickly using the hardware than what I'm doing right now (rapidly redrawing/combining with different levels of alpha). This would allow rapid fade-ins and fade-outs.
Tags: ghosd, project

  • megaupload captcha

    Someone make a Javascript-based captcha cracker for megaupload. It's strange to see those captchas again because I idly myself wrote a…

  • zombie ghosd

    I was tickled to discover another IBM developerworks article on one of my abandoned hacks and that both it and its predecessor have been translated…

  • gat, a git clone in haskell

    I've been pretty busy with work lately, so I may as well dump this on the internet before it gets too dusty. Though I think I understand Git decently…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.