From 441b6f6dfd92123dc409de693856eb1ba797a080 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 27 Dec 2010 19:34:59 -0700 Subject: [PATCH] add missing test case for premultiply-alpha fix original commit: 0b1f1a4f4ef3a7be224343f4cbac55e3aa728fc2 --- collects/tests/gracket/dc.rktl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/collects/tests/gracket/dc.rktl b/collects/tests/gracket/dc.rktl index de0a8ebc..b1893968 100644 --- a/collects/tests/gracket/dc.rktl +++ b/collects/tests/gracket/dc.rktl @@ -300,6 +300,31 @@ (send dc set-bitmap #f)) (try-draw (make-object color%) 'color usual-expect)) +;; ---------------------------------------- +;; 0 alpha should make the RGB components irrelevant + +(let () + (define bm1 (make-bitmap 1 2)) + (define bm2 (make-bitmap 1 2)) + + (send bm1 set-argb-pixels 0 0 1 2 (bytes 0 0 0 0 + 255 0 0 255)) + (send bm2 set-argb-pixels 0 0 1 2 (bytes 255 255 0 0 + 0 0 0 0)) + + (define the-bytes (make-bytes 8 0)) + + (define bm3 (make-bitmap 1 2)) + (define bdc (make-object bitmap-dc% bm3)) + (void (send bdc draw-bitmap bm1 0 0)) + (void (send bdc draw-bitmap bm2 0 0)) + + (send bdc get-argb-pixels 0 0 1 2 the-bytes) + (test (bytes 255 255 0 0 + 255 0 0 255) + values + the-bytes)) + ;; ---------------------------------------- (report-errs)