diff --git a/basis/images/images.factor b/basis/images/images.factor index 359a19cae9..a8439e5113 100644 --- a/basis/images/images.factor +++ b/basis/images/images.factor @@ -167,3 +167,13 @@ PRIVATE> : set-pixel-at ( pixel x y image -- ) [ 1 ] dip set-pixel-row-at ; inline + +:: each-pixel ( ... image quot: ( ... x y pixel -- ... ) -- ... ) + image dim>> first2 :> ( width height ) + image bytes-per-pixel :> n + height width [ iota ] bi@ [| y x | + y width * x + :> start + start n * :> from + from n + :> to + x y from to image bitmap>> quot call + ] cartesian-each ; inline