Alpha Blending and the Porter-Duff Blends

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Alpha Blending and the Porter-Duff Blends

Post by WaltBrown » Tue Oct 19, 2010 4:32 pm

Hi!
I can't seem to get any of the Porter Duff structural blends to function. Are they platform or graphic file format dependent? The (very sparse) documentation indicates they should function on any image type with an alpha channel. I have tried them in various layer combinations, etc, and can only get them to make an image visible or invisible, with no apparent math done on layered images - note that all the images I used had alpha channels, and I had manually transferred all three datatypes - image, alpha, and mask - over, before setting blend type. The non-Porter-Duff blends all appear to work as documented.

I also discovered what may or may not be a bug or feature. If I create a group with an image and a field, setting the structural blend of the image itself has no effect using the Porter-Duff blends, but it does using the other blends - when grouped it apears the group blend setting overrides the image blend setting, but only for the Porter-Duff blends. What was puzzling was that for those blends, I had to set the blend of the group (which is not what I wanted to do). When I did so, all it did was make images in those groups using the following blends completely transparent, regardless of the blendLevel setting or layer - blendClear, blendDst, blendSrcIn, blendDstIn, blendDstOut, and blendSrcAtop. What was even more interesting, the group blend setting had no effect on the grouped text field, which appears to lend credence to this as a bug rather than a feature.

Is there some documentation on the Porter-Duff blends beyond the Dictionary, User Guide, and Developer Web pages that I missed?

Thanks,
Walt
Walt Brown
Omnis traductor traditor

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Alpha Blending and the Porter-Duff Blends

Post by WaltBrown » Tue Oct 19, 2010 5:50 pm

Here's my BlenderExplorer stack with additions for:
1. Selecting whether to apply blend to image only, group only, or both.
2. Little convenience color squares for setting card background color.
3. The blend settings for the draggable test square can now be set as well.
4. There is a little window that shows the blend settings for each icon as you mouseOver it.
5. A draggable alien as a test - the alien image has interesting color topography at different blends.

Of note, the group blend settings do affect the grouped fields, again for all settings except the Porter Duff blends.

Walt
Attachments
BlendExplorer_2.zip
(125.61 KiB) Downloaded 277 times
Walt Brown
Omnis traductor traditor

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Alpha Blending and the Porter-Duff Blends

Post by bn » Tue Oct 19, 2010 11:37 pm

Walt,
thank you for updating the stack.
Unfortunately I get an error if I want to set the icons to a different icon than the default icon. The debugger stops at the following line of button "layout"
if not(the hilitedButton of grp "BlendGroup" = 2) then set the ink of img "iBall" of tNewGroup to tBlend
regards
Bernd

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Alpha Blending and the Porter-Duff Blends

Post by WaltBrown » Wed Oct 20, 2010 12:10 am

Oops, sorry about that. I fixed that just after I sent it.
Walt
Attachments
BlendExplorer_3.zip
(123.58 KiB) Downloaded 281 times
Walt Brown
Omnis traductor traditor

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Alpha Blending and the Porter-Duff Blends

Post by bn » Wed Oct 20, 2010 12:18 am

Walt,
thank you.
It is working now.
How are your baguettes?
regards
Bernd

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Alpha Blending and the Porter-Duff Blends

Post by WaltBrown » Wed Oct 20, 2010 12:23 am

It looks like some of the blends only work on the maskData and/or alphaData rather than the imageData, but I cannot determine what the rules are. Does anyone have a copy of the reqs and specs for the blend implementation?
Thx, Walt
Walt Brown
Omnis traductor traditor

Post Reply