Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] image! length?

From: garcia::a2::wanadoo::fr at: 19-Jun-2003 23:07

hello, (first thanks for all your answers about "sorting a series", it's very cool, I learn many things) I am still trying to understand how rebol works with image! wich is also a series ... if you create for example an image 50x50. img: make image! 50x50 Now, if you want to address the pixels, just do, poke img 1 255.255.255 for example . For the second pixel, you just go one step forward as usual with series: img: next img and you will see that you jump 4 bytes ! (3 bytes for the R V B and one more for " i don't remenber";-) What I don't understand it is that the length of this kind of series is not 50x50 but 50x50x4 try: print length? img 10000 wich mean that you will have 10000 indexes for moving you pointer !, which is not the case, you only have 50x50 index position. BUT in a serie with tuples you don't have this behavior:
>> a: [255.0.0 128.128.128 123.132.255]
== [255.0.0 128.128.128 123.132.255]
>> print length? a
3 and you effectively have 3 indexes position. if the behavior was the same as an image! the answer would have been 3x3= 9 any idea of this series! image! difference? my problem, it is that I try to create some pixels modification on an image, and I use img: next img to jump to the next pixel, and tail? img to stop processing the data. Of course, I've got an error because there is a difference between tail? image, and my image dimension. thanks arnaud