Opened 5 years ago

Last modified 5 years ago

#14940 assigned enhancement

Support non-rectangular (shaped) windows

Reported by: mmu_man Owned by: looncraz
Priority: low Milestone: Unscheduled
Component: Servers/app_server Version: R1/Development
Keywords: clipping, BPicture Cc:
Blocked By: Blocking:
Platform: All

Description

(Just so we can track things)

Possible usage, apart from #7924 :

  • BeOClock
  • a CL-Amp plugin mmu_man wrote that shapes the winamp skin according to the provided mask (must publish this someday).

Change History (4)

comment:1 by looncraz, 5 years ago

I have progress on this front, in a few weeks I should be posting a BAlphaMask implementation for comments as well as the BWindow API changes (SetAlphaMask, GetAlphaMask). I have a test application I'm building into the tree as well.

The mask is implemented as an 8-bit bitmap and BAlphaMask provides numerous methods to manipulate the mask (masking, unmasking, appending, subtracting, etc..).

The 8-bit values represent the alpha level that will be applied to the window as a whole. Zero values will cut the window. For now, only window shaping will be implemented.

Decorators will also use BAlphaMask, but I'm not certain exactly how at this moment, since we don't want a BAlphaMask that has to be the same size as the window just for the decorator - so a fixed-size BAlphaMask which is mapped to window regions (tab left, tab right, corners, etc..) seems the way to go.

Applications can keep the masks as resources (just an image) and BAlphaMask can be created or modified using the alpha values from a bitmap or a mask color.

Comments are welcome.

comment:2 by jackburton, 5 years ago

Can't we reuse the alphamask already implemented in the App server? I see that dano had a Clipwindowtopicture method, se could implement that, too.

in reply to:  2 comment:3 by looncraz, 5 years ago

Replying to jackburton:

Can't we reuse the alphamask already implemented in the App server? I see that dano had a Clipwindowtopicture method, se could implement that, too.

On the app_server side the existing AlphaMask will be adapted to serve the purpose, yes. We also need to use the mask to handle pointer pass through and draw clipping. Once that's done, the last step is to order the window drawing - then you can even have some transparency without full compositing, though that's not my goal.

Clipping to picture just renders a bitmap from the picture, IIRC, so we're cutting out the middle man, but the method could be added very easily.

comment:4 by looncraz, 5 years ago

Update:

I think I want to go another route for shaped windows that ties in better with compositing without the need to manage an alpha mask, BPicture, BShape, or any other object.

The idea is simply to treat alpha 0 in the canvas buffer as click-through (thereby shaping the window).

This comes at very low cost with client-side rendering and the BCanvas idea I have (where BCanvas takes over drawing and belongs to a window, view, or bitmap). I have something of a detailed write-up about it, actually, a live document you'll find here:

https://github.com/looncraz/haiku/blob/compositing/CSR_Worklist_Proposal.txt

Note: See TracTickets for help on using tickets.