chickadee » macaw » rgb-array-for-each

rgb-array-for-each proc rgb-array ...procedure

Calls proc once for each color in the given rgb-array(s). If the arrays are different sizes, it iterates over the overlapping area (i.e. the smallest width and smallest height).

The iteration proceeds in row-major order. proc is called with the x coordinate, y coordinate, and the corresponding rgb color from each given array. Modifying the color(s) will modify the array data. The color's parent will be automatically set to the array, so that the array will not be garbage collected while the color is using its memory.

(rgb-array-for-each
  (lambda (x y rgb_1 rgb_2)
    (rgb-lerp! rgb_1 rgb_2 (/ x 100.0)))
  rgb-array_1 rgb-array_2)