Move <rgb-image> to images.testing, add randomize-image word

db4
Doug Coleman 2010-09-19 21:54:04 -05:00
parent 84942b5409
commit d97bf9f890
2 changed files with 12 additions and 9 deletions

View File

@ -66,11 +66,6 @@ TUPLE: image dim component-order component-type upside-down? bitmap ;
: <image> ( -- image ) image new ; inline : <image> ( -- image ) image new ; inline
: <rgb-image> ( -- image )
<image>
RGB >>component-order
ubyte-components >>component-type ; inline
: has-alpha? ( image -- ? ) component-order>> alpha-channel? ; : has-alpha? ( image -- ? ) component-order>> alpha-channel? ;
: bytes-per-component ( component-type -- n ) : bytes-per-component ( component-type -- n )

View File

@ -1,9 +1,9 @@
! Copyright (C) 2009 Keith Lazuka. ! Copyright (C) 2009 Keith Lazuka.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: fry images.loader images.normalization images.viewer io USING: accessors fry images images.loader images.normalization
io.directories io.encodings.binary io.files io.pathnames images.viewer io io.backend io.directories io.encodings.binary
io.streams.byte-array kernel locals namespaces quotations io.files io.pathnames io.streams.byte-array kernel locals
sequences serialize tools.test io.backend ; namespaces quotations random sequences serialize tools.test ;
IN: images.testing IN: images.testing
<PRIVATE <PRIVATE
@ -53,3 +53,11 @@ PRIVATE>
[ '[ _ load-reference-image ] ] bi [ '[ _ load-reference-image ] ] bi
unit-test unit-test
] with-variable ; ] with-variable ;
: <rgb-image> ( -- image )
<image>
RGB >>component-order
ubyte-components >>component-type ; inline
: randomize-image ( image -- image )
dup bytes-per-image random-bytes >>bitmap ;