[REBOL] Re: alpha image blending...
From: roland:hadinger:arcor at: 23-Jul-2003 3:10
Warning: actually I've STILL got no good grasp of how certain things
are done with REBOL view, but I couldn't resist answering :/
A simple test which just displays two overlapping 32 bit RGBA images
taken from the PNG web site (image download ~ 500 k):
view f: layout [
origin 0x0
backcolor white
at 0x0 image
http://www.libpng.org/pub/png/img_png/MagnoliaAlpha-0.5.png
at 0x0 image
http://www.libpng.org/pub/png/img_png/OwlAlpha-0.5.png
]
If this displays what it says on your system (a window with a bright
background, magnolias and an owl in the foreground), then there is
alpha channel support.
imageC: to-image f
converts f to an image. In doing this, you get an image without alpha
channel data , however (or at least I think so, correct me if I'm wrong
here).
So depending on what you want to do besides merging images, you might
have to manipulate the alpha channel data with 'pick and 'poke
(-> http://www.compkarori.com/vanilla/display/Image+and+Alpha+Channel)
For example, to clear the alpha channel of an image:
clear-alpha: func [i [image!] /local n] [
repeat n i/size/x * i/size/y [poke i n 1.1.1.0 * pick i n]
i
]