• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[!REBOL3] General discussion about REBOL 3

Geomol
22-Jul-2013
[2708]
*scientific*
Cyphre
22-Jul-2013
[2709x2]
Geomol, some notest regarding alpha channel:

The alpha values seems to be left out.

I'ts not left out..that's only the way "mold" of image! datatype 
works. So I the image have "fully transparent" alphachannel it is 
just not shown by mold to make the output more readable.

But it seems, the alpha channel is separate from RGB values.

The alphachannel is always present in the image! datatype (ie. internally 
it's always 4 components = 32bit bitmap). Again it's just the way 
"molding" of the datatype displays the content.


AFAIK You can construct the image! with alphachannel in various ways 
for example:

separated alpha:

>> i: make image! [2x2 #{0102030405060708009A0B0C} #{11121314}]
== make image! [2x2 #{
0102030405060708009A0B0C
} #{
11121314
}]

same example but the RGBA compoments together:

>> i: to image! #{0102031104050612070809130A0B0C14}
== make image! [4x1 #{
0102030405060708090A0B0C
} #{
11121314
}]

>> i/size: 2x2
== 2x2

>> i
== make image! [2x2 #{
0102030405060708090A0B0C
} #{
11121314
}]

>>

Same way you can get the values in different form:

>> i/rgb
== #{0102030405060708090A0B0C}

>> i/alpha
== #{11121314}

>> to binary! i
== #{0102031104050612070809130A0B0C14}


For more I'd suggest you read the image! datatype docs here: http://www.rebol.com/docs/image.html

AFAIK The docs were written for R2 but should hold pretty much also 
for R3.
Regarding the "origin" of coordinates. IIRC this was discussed many 
times. In the end the decission was to have it the "non scientific" 
way. Also you can always apply transformation matrix in draw dialect 
to have your coordinates as needed.
Geomol
22-Jul-2013
[2711]
Thanks, C.!
Endo
31-Jul-2013
[2712x2]
f: does [2]
;on R3
>> reduce/only [a f] none
== [1 make function! [[][2]]]
;On R2
>> reduce/only [a f] none
** Script Error: Invalid argument: f

Is it a bug on R2?
a: 1 ;for sure..
Geomol
31-Jul-2013
[2714]
Looks like a bug in R2 to me.


It's interesting, that the word for the function is reduced to the 
function, but not evaluated. An alternative could be, that the word 
isn't touched, if it represents a function. I'm not familar with 
what practical challenges, that lead to this refinement for REDUCE. 
I've never used it myself.
Endo
31-Jul-2013
[2715:last]
An alternative could be, that the word isn't touched
You can do that like
>> reduce/only [a f] [ f ] ;this doesn't touch to F
== [1 f ]

But this is not only for functions of course.