From 9a24e66df0e2f7c3a516ce3d3542aab099afaaa3 Mon Sep 17 00:00:00 2001 From: Stephen Bloch Date: Sun, 24 Jul 2011 18:39:40 -0400 Subject: [PATCH] Fixed an off-by-one bug in "myflip", an example for build-image. Now it passes its tests :-) --- collects/picturing-programs/tests/map-image-isl-tests.rkt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/collects/picturing-programs/tests/map-image-isl-tests.rkt b/collects/picturing-programs/tests/map-image-isl-tests.rkt index 2f35d137e2..62b62166c6 100644 --- a/collects/picturing-programs/tests/map-image-isl-tests.rkt +++ b/collects/picturing-programs/tests/map-image-isl-tests.rkt @@ -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)