GETPIXEL

Purpose: Retrieve the value of a viewer image pixel.

Formats:  1)  GETPIXEL    variable      location
                   2)  GETPIXEL    variable      x     y

Notes:     The  GETPIXEL statement will retrieve the value of a pixel and place that value in the specified variable  parameter.  The first implementation will specify the point by the image address. To calculate the  location  point use the formula: (row * image width) + column.  The second implementation allows the use of x and y coordinates to specify the pixel address.

Example:

# Extract a 128x128 block from the center of the displayed image.
a = 0
y = 196
loop begin 128
 x = 196
 loop begin 128
  getpixel val x y
  memory(a) = val
  x = x + 1
  a = a + 1
 loop end
 y = y + 1
loop end

# Place the block on random locations
*main
 a = 0
 y = random(384)
 sx = random(384)
 loop begin 128
  x = sx
  loop begin 128
   val = memory(a)
   setpixel val x y
   a = a + 1
   x = x + 1
  loop end
  y = y + 1
 loop end

 viewer paint
 viewer notify
goto main

See Also:  SETPIXEL