Transparency and shaped windows
  • Moderator
    Kronos
    Posts: 2239 from 2003/2/24
    For some idea I recently had I would need a window similar to what tokai did with his elephant, read transparency with alpha-blending and windows shaped to any given polygon.

    Only thing I found sofar is "examples/intuition/transparency.c" which makes the window-border 100% invisible.

    Another question is wether the shape of a window can be changed on the fly (read without the flicker of closing and reopening it).
  • »29.01.10 - 12:36
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    r-tea
    Posts: 301 from 2005/3/27
    From: Poland, Zdzies...
    Can't advise you but I'm just curious if you need such a feature for SteamDraw project :)
    Mac mini G4@1,5GHz silent upgrade + Xerox Phaser 3140 + EPSON Perfection 1240U
    Commodore C64C + 2 x 1541II + Datasette + SD-Box

    I miss draggable screens... and do you? I know I'm in a minority unfortunately.
  • »29.01.10 - 21:43
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2974 from 2003/3/5
    From: Canada
    transparency.c was written when we didn't have Enhanced Display. Nowdays all you need to do is set a few WA_ attributes. See the intuition includes from the sdk update. I can patch up a quick example if needed later.

    The 'shape' is determined by the alpha channel and obviously is what you paint it to be. No flicker involved.

    [ Edited by jacadcaps on 2010/1/29 23:32 ]
  • »29.01.10 - 22:27
    Profile Visit Website
  • Moderator
    Kronos
    Posts: 2239 from 2003/2/24
    @r-tea

    Not directly for SteamDraw, but for a side-project for SteamDraw which may also be used in another context in which transparency might come in handy ..... Everything cleared up ? :-o

    @jacadcaps

    Doh, and there is even a similar tag in mui_window.doc (which doesn't seem to show up in mui.h).

    O.k. now what was that about shaped windows ? Has_Alpha is defined both in intuition and mui_window, but I'm not sure what it does ?

    The window shouldn't just disappear on fully invisible areas, but clicking there should also be send to the next window underneath it.

    A quick and dirty example might be helpfull.

    [ Edited by Kronos on 2010/1/29 23:53 ]
  • »29.01.10 - 22:48
    Profile
  • Moderator
    Kronos
    Posts: 2239 from 2003/2/24
    O.k. MUIA_Window_HasAlpha fails when the window contains "Dtpic.mui" ("incompatible source and destination bitmaps..." in RAMDebug), using just 1 SimpleButton() as WindowContents does work, and I can doubleclick Ambient-icons through the largly invisible border of my test-app.

    Seems I need to write my own alpha-enabled replacement for "Dtpic.mui", something that was planned anyways as I also need scaling 8-)
  • »30.01.10 - 00:29
    Profile
  • Moderator
    Kronos
    Posts: 2239 from 2003/2/24
    O.k. this is getting silly ....

    Seems that DTPic is alpha-enabled, and it does work as it should. I've sofar failed to reproduce the above error-message....
  • »30.01.10 - 00:47
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2974 from 2003/3/5
    From: Canada
    Well... MUI generally isn't "alpha enabled". You shouldn't set MUIA_Window_HasAlpha on normal windows, but rather only on windows whose content you will paint yourself in 100%.
  • »30.01.10 - 09:09
    Profile Visit Website
  • Moderator
    Kronos
    Posts: 2239 from 2003/2/24
    O.k. things are getting closer (and uglier ;) ).

    Currently I use ScalePixelArray() with RECTFMT_RGBA, which does just a vanilla (scaled) copy, what I would need is a function that simply leaves the background unchanged in placed where the PixelArray has alpha.

    Just asking before I start writing my own pixel_by_pixel routine.
  • »26.04.10 - 17:01
    Profile