rosetta-code.image-noise: fix vocab name.
parent
cc621ee5ee
commit
5ca6fb95a7
|
@ -3,17 +3,19 @@
|
||||||
USING: accessors calendar images images.viewer kernel math
|
USING: accessors calendar images images.viewer kernel math
|
||||||
math.parser models models.arrow random sequences threads timers
|
math.parser models models.arrow random sequences threads timers
|
||||||
ui ui.gadgets ui.gadgets.labels ui.gadgets.packs ;
|
ui ui.gadgets ui.gadgets.labels ui.gadgets.packs ;
|
||||||
IN: noise-ui
|
IN: rosetta-code.image-noise
|
||||||
|
|
||||||
: bits>pixels ( bits -- bits' pixels )
|
: bits>pixels ( bits -- bits' pixels )
|
||||||
[ -1 shift ] [ 1 bitand ] bi 255 * ; inline
|
[ -1 shift ] [ 1 bitand ] bi 255 * ; inline
|
||||||
|
|
||||||
: ?generate-more-bits ( a bits -- a bits' )
|
: ?generate-more-bits ( a bits -- a bits' )
|
||||||
over 32 mod zero? [ drop random-32 ] when ; inline
|
over 32 mod zero? [ drop random-32 ] when ; inline
|
||||||
|
|
||||||
: <random-images-bytes> ( dim -- bytes )
|
: <random-images-bytes> ( dim -- bytes )
|
||||||
[ 0 0 ] dip product [
|
[ 0 0 ] dip product [
|
||||||
?generate-more-bits
|
?generate-more-bits
|
||||||
[ 1 + ] [ bits>pixels ] bi*
|
[ 1 + ] [ bits>pixels ] bi*
|
||||||
] B{ } replicate-as 2nip ;
|
] B{ } replicate-as 2nip ;
|
||||||
|
|
||||||
: <random-bw-image> ( -- image )
|
: <random-bw-image> ( -- image )
|
||||||
<image>
|
<image>
|
||||||
|
|
Loading…
Reference in New Issue