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
ellipse
rectangle
empty-scene
square
rhombus
regular-polygon

View File

@ -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

View File

@ -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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB