From f5923dd7488b113a3efe6c73f6991188ad7dbb25 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Thu, 14 Jul 2011 12:02:40 -0400 Subject: [PATCH] sk requested empty scenes with optional background color (cherry picked from commit 40948ee653f99201dbd85b5633d1fbe0b09cc9b0) --- collects/2htdp/private/image-more.rkt | 4 ++-- collects/teachpack/2htdp/scribblings/image.scrbl | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/collects/2htdp/private/image-more.rkt b/collects/2htdp/private/image-more.rkt index 4e7fb86648..78bc2de002 100644 --- a/collects/2htdp/private/image-more.rkt +++ b/collects/2htdp/private/image-more.rkt @@ -882,10 +882,10 @@ (check-mode/color-combination 'square 3 mode color) (make-a-polygon (rectangle-points side-length side-length) mode color)) -(define/chk (empty-scene width height) +(define/chk (empty-scene width height [color 'white]) (crop 0 0 width height (overlay (rectangle width height 'outline (pen "black" 2 'solid 'round 'round)) - (rectangle width height 'solid 'white)))) + (rectangle width height 'solid color)))) (define/chk (rhombus side-length angle mode color) (check-mode/color-combination 'rhombus 3 mode color) diff --git a/collects/teachpack/2htdp/scribblings/image.scrbl b/collects/teachpack/2htdp/scribblings/image.scrbl index c3b5eaec3e..eb525bd515 100644 --- a/collects/teachpack/2htdp/scribblings/image.scrbl +++ b/collects/teachpack/2htdp/scribblings/image.scrbl @@ -936,14 +936,20 @@ the @racket[point-count] argument determines how many points the star has. Placing images into scenes is particularly useful when building worlds and universes using @racket[2htdp/universe]. -@defproc[(empty-scene [width (and/c real? (not/c negative?))] - [height (and/c real? (not/c negative?))]) - image?]{ +@defproc*[([(empty-scene [width (and/c real? (not/c negative?))] + [height (and/c real? (not/c negative?))]) + image?] + [(empty-scene [width (and/c real? (not/c negative?))] + [height (and/c real? (not/c negative?))] + [color image-color?]) + image?])]{ -Creates an empty scene, i.e., a rectangle with a black outline. +Creates an empty scene, i.e., a white rectangle with a black outline. @image-examples[(empty-scene 160 90)] - + +The three-argument version creates a rectangle of the specified color with +a black outline. } @defproc[(place-image [image image?] [x real?] [y real?] [scene image?]) image?]{