images: adding an "each-pixel" that iterates over pixels by row.
parent
f8bf42bce8
commit
04c0fdc39e
|
@ -167,3 +167,13 @@ PRIVATE>
|
||||||
|
|
||||||
: set-pixel-at ( pixel x y image -- )
|
: set-pixel-at ( pixel x y image -- )
|
||||||
[ 1 ] dip set-pixel-row-at ; inline
|
[ 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>> <slice> quot call
|
||||||
|
] cartesian-each ; inline
|
||||||
|
|
Loading…
Reference in New Issue