Fixed an off-by-one bug in "myflip", an example for build-image. Now it passes its tests :-)
This commit is contained in:
parent
ab01d563ca
commit
9a24e66df0
|
@ -15,10 +15,13 @@
|
||||||
; myflip : image -> image
|
; myflip : image -> image
|
||||||
; vertical reflection defined by bitmap operations
|
; vertical reflection defined by bitmap operations
|
||||||
(define (myflip pic)
|
(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)
|
(build-image (image-width pic) (image-height pic)
|
||||||
other-pixel)))
|
other-pixel)))
|
||||||
|
|
||||||
|
|
||||||
|
(check-expect (myflip pic:bloch) (flip-vertical pic:bloch))
|
||||||
|
|
||||||
(define RADIUS 1)
|
(define RADIUS 1)
|
||||||
|
|
||||||
(define (clip-to n low high)
|
(define (clip-to n low high)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user