I'm not convinced that this solution meets the spec given for the RosettaCode 
problem "Basic bitmap storage"
http://rosettacode.org/wiki/Basic_bitmap_storage

   allocimg=:  0 $~ 3 ,~ ]
   fillimg=: ]`(a:"_)`[}
   setpix=: (1&{::@])`([: <@;/ <:@(0&{::@]))`[}
   getpix=: <@;/@:<:@] { [

   myimg=: allocimg 10 7           NB. 10 by 7 pixel image
   myimg=: myimg fillimg 0 255 0   NB. fill with green
   myimg getpix 4 5                NB. get color of pixel from 4th row and 5th 
col
0 255 0
   myimg=: myimg setpix 4 5; 255 0 255  NB. set pixel to magenta
   myimg getpix 4 5                NB. verify
255 0 255

I'm thinking that I probably need to pass the name rather than the value of the 
image object?

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to