[REBOL] Re: Masking, Keying and Image Composition ideas.
From: antonr:iinet:au at: 24-May-2003 21:03
I noticed a bug when making pixel-boy.r where
the alpha channel wouldn't appear until the
top-left pixel of the image had its alpha
channel value set.
You set the top-left pixel, and magically the
alpha channel appears. I've already sent a
bug report for that.
Maybe that will help you.
Here's code which demonstrates the bug:
img: make image! 2x1
poke img 1 255.255.255.192
poke img 2 255.255.255.0
img2: make image! 2x1
poke img2 1 255.255.255.0
poke img2 2 255.255.255.192
view center-face layout [
image 64 * img/size img ; as expected
image 64 * img2/size img2 ; where's the alpha ?
I don't understand what the problem is with 'repeat
in your comment at the bottom.
I am sure if you replace:
for v 1 (img/size/x * img/size/y) 1 [...]
repeat v (img/size/x * img/size/y) [...]
that it will work identically, faster, and you
won't have to declare 'v as local to the function,
Also, for a bit extra speed, use:
equal? c pick mask v
(pick mask v) = c
The parens and the '= cause the interpreter to do more work.
not-equal? c pick mask v
is also faster than:
not (pick mask v) = c