From cee45914f492fa6197f1d00e26450b3f4229cdb8 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 2 Jun 2010 20:02:28 -0600 Subject: [PATCH] add get-pixel method to bitmap-dc% --- collects/racket/draw/bitmap-dc.rkt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collects/racket/draw/bitmap-dc.rkt b/collects/racket/draw/bitmap-dc.rkt index f024268f8c..dcf509d356 100644 --- a/collects/racket/draw/bitmap-dc.rkt +++ b/collects/racket/draw/bitmap-dc.rkt @@ -44,6 +44,12 @@ (let ([s (bytes 255 (color-red c) (color-green c) (color-blue c))]) (set-argb-pixels x y 1 1 s))) + (def/public (get-pixel [real? x][real? y][color% c]) + (let ([b (make-bytes 4)]) + (get-argb-pixels x y 1 1) + (send c set (bytes-ref b 1) (bytes-ref b 2) (bytes-ref b 3)) + #t)) + (def/public (set-argb-pixels [exact-nonnegative-integer? x] [exact-nonnegative-integer? y] [exact-nonnegative-integer? w]