added empty-scene

svn: r18138
This commit is contained in:
Robby Findler 2010-02-17 23:21:57 +00:00
parent a7dbbc2fa6
commit 124dbe9b93
7 changed files with 22 additions and 2 deletions

View File

@ -76,6 +76,7 @@ and they all have good sample contracts. (It is amazing what we can do with kids
circle circle
ellipse ellipse
rectangle rectangle
empty-scene
square square
rhombus rhombus
regular-polygon regular-polygon

View File

@ -654,6 +654,10 @@
(check-mode/color-combination 'square 3 mode color) (check-mode/color-combination 'square 3 mode color)
(make-a-polygon (rectangle-points side-length side-length) 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) (define/chk (rhombus side-length angle mode color)
(check-mode/color-combination 'rhombus 3 mode color) (check-mode/color-combination 'rhombus 3 mode color)
(let* ([left-corner (make-polar side-length (+ (* pi 1/2) (/ (degrees->radians angle) 2)))] (let* ([left-corner (make-polar side-length (+ (* pi 1/2) (/ (degrees->radians angle) 2)))]
@ -956,6 +960,7 @@
circle circle
ellipse ellipse
rectangle rectangle
empty-scene
square square
rhombus rhombus

View File

@ -630,7 +630,10 @@
(make-bb 100 100 100) (make-bb 100 100 100)
#f)) #f))
(test (empty-scene 185 100)
=>
(overlay (rectangle 185 100 'outline 'black)
(rectangle 185 100 'solid 'white)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; testing normalization ;; testing normalization

View File

@ -244,6 +244,7 @@
(rectangle 48 48 "solid" "gray")) (rectangle 48 48 "solid" "gray"))
'image 'image
"126418b230e.png") "126418b230e.png")
(list '(empty-scene 160 90) 'image "216addb7809.png")
(list (list
'(above/align '(above/align
"left" "left"

View File

@ -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 Placing images into scenes is particularly useful when building worlds
and universes using @scheme[2htdp/universe]. 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?]{ @defproc[(place-image [image image?] [x real?] [y real?] [scene image?]) image?]{
Places @scheme[image] onto @scheme[scene] with its center at the coordinates Places @scheme[image] onto @scheme[scene] with its center at the coordinates

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB