Fixed an off-by-one bug in "myflip", an example for build-image. Now it passes its tests :-)

This commit is contained in:
Stephen Bloch 2011-07-24 18:39:40 -04:00
parent ab01d563ca
commit 9a24e66df0

View File

@ -15,10 +15,13 @@
; myflip : image -> image
; vertical reflection defined by bitmap operations
(define (myflip pic)
(local [(define (other-pixel x y) (get-pixel-color x (- (image-height pic) y) pic))]
(local [(define (other-pixel x y) (get-pixel-color x (- (image-height pic) y 1) pic))]
(build-image (image-width pic) (image-height pic)
other-pixel)))
(check-expect (myflip pic:bloch) (flip-vertical pic:bloch))
(define RADIUS 1)
(define (clip-to n low high)