From 124dbe9b93cfd8ab9cce52a82c367ca651f578e2 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 17 Feb 2010 23:21:57 +0000 Subject: [PATCH] added empty-scene svn: r18138 --- collects/2htdp/image.ss | 1 + collects/2htdp/private/image-more.ss | 5 +++++ collects/2htdp/tests/test-image.ss | 5 ++++- .../teachpack/2htdp/scribblings/image-toc.ss | 1 + collects/teachpack/2htdp/scribblings/image.scrbl | 12 +++++++++++- .../2htdp/scribblings/img/216addb7809.png | Bin 0 -> 306 bytes .../2htdp/scribblings/img/2bed4c99df8.png | Bin 0 -> 1079 bytes 7 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 collects/teachpack/2htdp/scribblings/img/216addb7809.png create mode 100644 collects/teachpack/2htdp/scribblings/img/2bed4c99df8.png diff --git a/collects/2htdp/image.ss b/collects/2htdp/image.ss index fb81e88b3a..4c96dcc3c5 100644 --- a/collects/2htdp/image.ss +++ b/collects/2htdp/image.ss @@ -76,6 +76,7 @@ and they all have good sample contracts. (It is amazing what we can do with kids circle ellipse rectangle + empty-scene square rhombus regular-polygon diff --git a/collects/2htdp/private/image-more.ss b/collects/2htdp/private/image-more.ss index 5068aa47e4..48d1fb1360 100644 --- a/collects/2htdp/private/image-more.ss +++ b/collects/2htdp/private/image-more.ss @@ -654,6 +654,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) + (overlay (rectangle width height 'outline 'black) + (rectangle width height 'solid 'white))) + (define/chk (rhombus side-length angle mode color) (check-mode/color-combination 'rhombus 3 mode color) (let* ([left-corner (make-polar side-length (+ (* pi 1/2) (/ (degrees->radians angle) 2)))] @@ -956,6 +960,7 @@ circle ellipse rectangle + empty-scene square rhombus diff --git a/collects/2htdp/tests/test-image.ss b/collects/2htdp/tests/test-image.ss index 604985cbbe..4b518e507c 100644 --- a/collects/2htdp/tests/test-image.ss +++ b/collects/2htdp/tests/test-image.ss @@ -630,7 +630,10 @@ (make-bb 100 100 100) #f)) - +(test (empty-scene 185 100) + => + (overlay (rectangle 185 100 'outline 'black) + (rectangle 185 100 'solid 'white))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; testing normalization diff --git a/collects/teachpack/2htdp/scribblings/image-toc.ss b/collects/teachpack/2htdp/scribblings/image-toc.ss index 1bba743787..3813f89609 100644 --- a/collects/teachpack/2htdp/scribblings/image-toc.ss +++ b/collects/teachpack/2htdp/scribblings/image-toc.ss @@ -244,6 +244,7 @@ (rectangle 48 48 "solid" "gray")) 'image "126418b230e.png") + (list '(empty-scene 160 90) 'image "216addb7809.png") (list '(above/align "left" diff --git a/collects/teachpack/2htdp/scribblings/image.scrbl b/collects/teachpack/2htdp/scribblings/image.scrbl index 048a48f175..1ff710b855 100644 --- a/collects/teachpack/2htdp/scribblings/image.scrbl +++ b/collects/teachpack/2htdp/scribblings/image.scrbl @@ -621,11 +621,21 @@ Unlike @scheme[scene+curve], if the line passes outside of @scheme[image], the i } -@section{Placing Images} +@section{Placing Images & Scenes} Placing images into scenes is particularly useful when building worlds and universes using @scheme[2htdp/universe]. +@defproc[(empty-scene [width (and/c real? (not/c negative?))] + [height (and/c real? (not/c negative?))]) + image?]{ + +Creates an empty scene, i.e., a rectangle with a black outline. + +@image-examples[(empty-scene 160 90)] + +} + @defproc[(place-image [image image?] [x real?] [y real?] [scene image?]) image?]{ Places @scheme[image] onto @scheme[scene] with its center at the coordinates diff --git a/collects/teachpack/2htdp/scribblings/img/216addb7809.png b/collects/teachpack/2htdp/scribblings/img/216addb7809.png new file mode 100644 index 0000000000000000000000000000000000000000..818a68efe7d184192ef57847e11439a7d0a2124b GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^3xPPAg9%7Zu_~Geq<(t3IEGZrd3*67C$l5NkqxuI z-2eP+qEsKN`>F#E(r-IouWLSUx!t?s^tSVF+2WoT&Ocr&_r3DY&}IB@%-t?radDeI Y`!?o%zKO3^0t11;)78&qol`;+01QE-KL7v# literal 0 HcmV?d00001 diff --git a/collects/teachpack/2htdp/scribblings/img/2bed4c99df8.png b/collects/teachpack/2htdp/scribblings/img/2bed4c99df8.png new file mode 100644 index 0000000000000000000000000000000000000000..3834f0423f4347b8aef58a6771b0e8df117c2c55 GIT binary patch literal 1079 zcmeAS@N?(olHy`uVBq!ia0y~yV4MiVx*SYE5jXEsd<+cC|2$nBLn`LHy|R&)$&um6 zf%sqVe{yIrbofn6(<*q9ew#U9!}$&8EVp|z?7RJK*IkAW?B|)hY`8T(>MS_2xj|@@ rGa3e?>0rp^g`jPB{TP0n+-9!b&YHBSbNggqfxzJD>gTe~DWM4fYihHa literal 0 HcmV?d00001