Ok, here's the idea: I have a type representing a pixel, e.g.
Then I'll create my 'image':
(or something, maybe some more initializing, anyway, that's not the point here :P)
Anyway, I can access the pixel fields in a nested y,x FOR loop of course. But next to doing this I also want 1-dimensional access for both reading and writing. E.g. if I know the width and height (16 and 16) then I want to be able to run through the whole shebang in a for 256 loop. Oh.. and superstrict..!
How? :P I didn't find PTRs to be very cooperative, and going out of bounds (e.g. mypixel[255,0]) also wasn't much appreciated.
type pixel field r:float field g:float field b:float field i1:int field i2:int end type
Then I'll create my 'image':
local myimage:pixel=new pixel[16,16]
(or something, maybe some more initializing, anyway, that's not the point here :P)
Anyway, I can access the pixel fields in a nested y,x FOR loop of course. But next to doing this I also want 1-dimensional access for both reading and writing. E.g. if I know the width and height (16 and 16) then I want to be able to run through the whole shebang in a for 256 loop. Oh.. and superstrict..!
How? :P I didn't find PTRs to be very cooperative, and going out of bounds (e.g. mypixel[255,0]) also wasn't much appreciated.