From bc388368a777f14ed0a21f50dd2cb36606a6dbd9 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 3 Sep 2006 04:03:06 +0000 Subject: [PATCH] fixed bug in image library svn: r4230 --- collects/htdp/image.ss | 8 ++++---- collects/mrlib/cache-image-snip.ss | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/collects/htdp/image.ss b/collects/htdp/image.ss index d105d5bdee..89eb3c50f6 100644 --- a/collects/htdp/image.ss +++ b/collects/htdp/image.ss @@ -222,10 +222,10 @@ plt/collects/tests/mzscheme/image-test.ss [bottom (max (+ delta-y b-h) a-h)] [new-w (inexact->exact (ceiling (- right left)))] [new-h (inexact->exact (ceiling (- bottom top)))] - [a-dx (- left)] - [a-dy (- top)] - [b-dx (- delta-x left)] - [b-dy (- delta-y top)] + [a-dx (inexact->exact (round (- left)))] + [a-dy (inexact->exact (round (- top)))] + [b-dx (inexact->exact (round (- delta-x left)))] + [b-dy (inexact->exact (round (- delta-y top)))] [new-px (- a-px left)] [new-py (- a-py top)] [combine (lambda (a-f b-f) diff --git a/collects/mrlib/cache-image-snip.ss b/collects/mrlib/cache-image-snip.ss index 8197795080..ffcbf496d6 100644 --- a/collects/mrlib/cache-image-snip.ss +++ b/collects/mrlib/cache-image-snip.ss @@ -147,7 +147,9 @@ void (lambda (x) #f))]) (if data - (argb->cache-image-snip (make-argb (first data) (second data)) (third data) (fourth data)) + (argb->cache-image-snip (make-argb (first data) (second data)) + (third data) + (fourth data)) (make-null-cache-image-snip)))) (super-new))) @@ -634,9 +636,16 @@ for b3, we have: (* -255 m3)) (- 255 m3)))) + (define bitmap-size/c (and/c integer? exact? (between/c 1 10000))) + (provide/contract - [overlay-bitmap (argb? number? number? (is-a?/c bitmap%) (is-a?/c bitmap%) . -> . any)] - [build-bitmap (((is-a?/c dc<%>) . -> . any) number? number? . -> . (is-a?/c bitmap%))] + [overlay-bitmap (argb? (and/c integer? exact?) + (and/c integer? exact?) + (is-a?/c bitmap%) + (is-a?/c bitmap%) + . -> . + any)] + [build-bitmap (((is-a?/c dc<%>) . -> . any) bitmap-size/c bitmap-size/c . -> . (is-a?/c bitmap%))] [flatten-bitmap ((is-a?/c bitmap%) . -> . (is-a?/c bitmap%))] [argb->cache-image-snip (argb? number? number? . -> . (is-a?/c cache-image-snip%))]