renamed */places to */align

svn: r16859
This commit is contained in:
Robby Findler 2009-11-18 12:11:44 +00:00
parent ea8ebcce6f
commit 5cea34ec49
14 changed files with 88 additions and 88 deletions

View File

@ -50,14 +50,14 @@ and they all have good sample contracts. (It is amazing what we can do with kids
"private/image-more.ss")
(provide overlay
overlay/places
overlay/align
overlay/xy
beside
beside/places
beside/align
above
above/places
above/align
rotate
frame

View File

@ -311,7 +311,7 @@
(define/chk (overlay image image2 . image3)
(overlay/internal 'left 'top image (cons image2 image3)))
;; overlay/places : string string image image image ... -> image
;; overlay/align : string string image image image ... -> image
;; the first string has to be one of "center" "middle" "left" or "right" (or symbols)
;; the second string has to be one of "center" "middle" "top" "bottom" or "baseline" (or symbols)
;; behaves like overlay, but lines up the images in the various places.
@ -319,7 +319,7 @@
;; for the two string arguments. Passing, eg, "center" "center" lines the
;; images up at their centers.
(define/chk (overlay/places x-place y-place image image2 . image3)
(define/chk (overlay/align x-place y-place image image2 . image3)
(overlay/internal x-place y-place image (cons image2 image3)))
(define (overlay/internal x-place y-place fst rst)
@ -382,10 +382,10 @@
(define/chk (beside image1 image2 . image3)
(beside/internal 'top image1 (cons image2 image3)))
;; beside/places : string image image image ... -> image
;; beside/align : string image image image ... -> image
;; places images in a horizontal row where the vertical alignment is
;; covered by the string argument
(define/chk (beside/places y-place image1 image2 . image3)
(define/chk (beside/align y-place image1 image2 . image3)
(beside/internal y-place image1 (cons image2 image3)))
(define (beside/internal y-place fst rst)
@ -411,10 +411,10 @@
(define/chk (above image1 image2 . image3)
(above/internal 'left image1 (cons image2 image3)))
;; beside/places : string image image image ... -> image
;; beside/align : string image image image ... -> image
;; places images in a horizontal row where the vertical alignment is
;; covered by the string argument
(define/chk (above/places x-place image1 image2 . image3)
(define/chk (above/align x-place image1 image2 . image3)
(above/internal x-place image1 (cons image2 image3)))
(define (above/internal x-place fst rst)
@ -931,12 +931,12 @@
#`(make-object image-snip% (make-object bitmap% #,path 'unknown/mask)))]))
(provide overlay
overlay/places
overlay/align
overlay/xy
beside
beside/places
beside/align
above
above/places
above/align
rotate

View File

@ -33,7 +33,7 @@
(cond
[(= n 7) image]
[else
(loop (overlay/places 'center 'center
(loop (overlay/align 'center 'center
image
(rotate (* 180 (/ 1 n)) image))
(+ n 1))])))
@ -283,7 +283,7 @@
(make-bb 140 140 140)
#f))
(test (overlay/places 'middle
(test (overlay/align 'middle
'middle
(ellipse 100 50 'solid 'green)
(ellipse 50 100 'solid 'red))
@ -295,7 +295,7 @@
(make-bb 100 100 100)
#f))
(test (overlay/places 'middle
(test (overlay/align 'middle
'middle
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'green))
@ -308,7 +308,7 @@
#f))
(test (overlay/places 'right
(test (overlay/align 'right
'bottom
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'green))
@ -320,7 +320,7 @@
(make-bb 100 100 100)
#f))
(test (overlay/places 'right
(test (overlay/align 'right
'baseline
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'green))
@ -332,7 +332,7 @@
(make-bb 100 100 100)
#f))
(test (beside/places 'top
(test (beside/align 'top
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
@ -344,7 +344,7 @@
(make-bb 150 100 100)
#f))
(test (beside/places 'center
(test (beside/align 'center
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
@ -356,7 +356,7 @@
(make-bb 150 100 100)
#f))
(test (beside/places 'baseline
(test (beside/align 'baseline
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
@ -371,11 +371,11 @@
(test (beside (ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
=>
(beside/places 'top
(beside/align 'top
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue)))
(test (above/places 'left
(test (above/align 'left
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
@ -387,7 +387,7 @@
(make-bb 100 150 150)
#f))
(test (above/places 'center
(test (above/align 'center
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
@ -399,7 +399,7 @@
(make-bb 100 150 100)
#f))
(test (above/places 'right
(test (above/align 'right
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
@ -414,7 +414,7 @@
(test (above (ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue))
=>
(above/places 'left
(above/align 'left
(ellipse 50 100 'solid 'red)
(ellipse 100 50 'solid 'blue)))
@ -645,7 +645,7 @@
;; text
;;
(check-equal? (beside/places "baseline"
(check-equal? (beside/align "baseline"
(text "a" 18 "black")
(text "b" 18 "black"))
(text "ab" 18 "black"))

View File

@ -25,14 +25,14 @@
(list '(image-width (circle 30 "solid" "orange")) 'val 60)
(list '(image-width (ellipse 30 40 "solid" "orange")) 'val 30)
(list
'(beside/places
'(beside/align
"bottom"
(ellipse 20 70 "solid" "lightsteelblue")
(frame (ellipse 20 50 "solid" "mediumslateblue"))
(ellipse 20 30 "solid" "slateblue")
(ellipse 20 10 "solid" "navy"))
'image
"5d9d7eb8c7.png")
"f7f1480d58.png")
(list '(frame (ellipse 20 20 "outline" "black")) 'image "6a5a617f28.png")
(list '(ellipse 60 60 "solid" "blue") 'image "d92d6a49f1.png")
(list
@ -44,12 +44,12 @@
(list
'(rotate
45
(beside/places
(beside/align
"center"
(rectangle 40 20 "solid" "darkseagreen")
(rectangle 20 100 "solid" "darkseagreen")))
'image
"292b77d2270.png")
"fdaad0760b.png")
(list
'(rotate 5 (rectangle 50 50 "outline" "black"))
'image
@ -59,23 +59,23 @@
'image
"28daec71a64.png")
(list
'(above/places
'(above/align
"center"
(ellipse 70 20 "solid" "yellowgreen")
(ellipse 50 20 "solid" "olivedrab")
(ellipse 30 20 "solid" "darkolivegreen")
(ellipse 10 20 "solid" "darkgreen"))
'image
"29c8557c53a.png")
"166bb7bc683.png")
(list
'(above/places
'(above/align
"right"
(ellipse 70 20 "solid" "gold")
(ellipse 50 20 "solid" "goldenrod")
(ellipse 30 20 "solid" "darkgoldenrod")
(ellipse 10 20 "solid" "sienna"))
'image
"2865c0c88d9.png")
"2758748ad7f.png")
(list
'(above
(ellipse 70 20 "solid" "gray")
@ -85,27 +85,27 @@
'image
"aac8b78b6e.png")
(list
'(beside/places "baseline" (text "ijy" 18 "black") (text "ijy" 24 "black"))
'(beside/align "baseline" (text "ijy" 18 "black") (text "ijy" 24 "black"))
'image
"11477a8292d.png")
"2187216ca96.png")
(list
'(beside/places
'(beside/align
"center"
(ellipse 20 70 "solid" "mediumorchid")
(ellipse 20 50 "solid" "darkorchid")
(ellipse 20 30 "solid" "purple")
(ellipse 20 10 "solid" "indigo"))
'image
"1dd3a9fcdbb.png")
"2dd0a2a4517.png")
(list
'(beside/places
'(beside/align
"bottom"
(ellipse 20 70 "solid" "lightsteelblue")
(ellipse 20 50 "solid" "mediumslateblue")
(ellipse 20 30 "solid" "slateblue")
(ellipse 20 10 "solid" "navy"))
'image
"fe15a0a20c.png")
"eb99639e31.png")
(list
'(beside
(ellipse 20 70 "solid" "gray")
@ -151,7 +151,7 @@
'image
"1f0b671ed7b.png")
(list
'(overlay/places
'(overlay/align
"right"
"bottom"
(rectangle 20 20 "solid" "silver")
@ -159,15 +159,15 @@
(rectangle 40 40 "solid" "silver")
(rectangle 50 50 "solid" "seagreen"))
'image
"201133dd679.png")
"969a9aa483.png")
(list
'(overlay/places
'(overlay/align
"middle"
"middle"
(rectangle 30 60 "solid" "orange")
(ellipse 60 30 "solid" "purple"))
'image
"13b365251d3.png")
"bf08c71801.png")
(list
'(overlay
(ellipse 10 10 "solid" "red")

View File

@ -277,20 +277,20 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ
}
@defproc[(overlay/places [x-place x-place?] [y-place y-place?] [i1 image?] [i2 image?] [is image?] ...) image?]{
@defproc[(overlay/align [x-place x-place?] [y-place y-place?] [i1 image?] [i2 image?] [is image?] ...) image?]{
Overlays all of its image arguments, much like the @scheme[overlay] function, but using
@scheme[x-place] and @scheme[y-place] to determine where the images are lined up. For example, if
@scheme[x-place] and @scheme[y-place] are both @scheme["middle"], then the images are lined up
on their centers.
@image-examples[(overlay/places "middle" "middle"
(rectangle 30 60 "solid" "orange")
(ellipse 60 30 "solid" "purple"))
(overlay/places "right" "bottom"
(rectangle 20 20 "solid" "silver")
(rectangle 30 30 "solid" "seagreen")
(rectangle 40 40 "solid" "silver")
(rectangle 50 50 "solid" "seagreen"))]
@image-examples[(overlay/align "middle" "middle"
(rectangle 30 60 "solid" "orange")
(ellipse 60 30 "solid" "purple"))
(overlay/align "right" "bottom"
(rectangle 20 20 "solid" "silver")
(rectangle 30 30 "solid" "seagreen")
(rectangle 40 40 "solid" "silver")
(rectangle 50 50 "solid" "seagreen"))]
}
@ -330,27 +330,27 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ
}
@defproc[(beside/places [y-place y-place?] [i1 image?] [i2 image?] [is image?] ...) image?]{
@defproc[(beside/align [y-place y-place?] [i1 image?] [i2 image?] [is image?] ...) image?]{
Constructs an image by placing all of the argument images in a horizontal row, lined
up as indicated by the @scheme[y-place] argument. For example, if @scheme[y-place]
is @scheme["middle"], then the images are placed side by side with their centers
lined up with each other.
@image-examples[(beside/places "bottom"
(ellipse 20 70 "solid" "lightsteelblue")
(ellipse 20 50 "solid" "mediumslateblue")
(ellipse 20 30 "solid" "slateblue")
(ellipse 20 10 "solid" "navy"))
@image-examples[(beside/align "bottom"
(ellipse 20 70 "solid" "lightsteelblue")
(ellipse 20 50 "solid" "mediumslateblue")
(ellipse 20 30 "solid" "slateblue")
(ellipse 20 10 "solid" "navy"))
(beside/places "center"
(ellipse 20 70 "solid" "mediumorchid")
(ellipse 20 50 "solid" "darkorchid")
(ellipse 20 30 "solid" "purple")
(ellipse 20 10 "solid" "indigo"))
(beside/places "baseline"
(text "ijy" 18 "black")
(text "ijy" 24 "black"))]
(beside/align "center"
(ellipse 20 70 "solid" "mediumorchid")
(ellipse 20 50 "solid" "darkorchid")
(ellipse 20 30 "solid" "purple")
(ellipse 20 10 "solid" "indigo"))
(beside/align "baseline"
(text "ijy" 18 "black")
(text "ijy" 24 "black"))]
}
@ -368,23 +368,23 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ
}
@defproc[(above/places [y-place y-place?] [i1 image?] [i2 image?] [is image?] ...) image?]{
@defproc[(above/align [y-place y-place?] [i1 image?] [i2 image?] [is image?] ...) image?]{
Constructs an image by placing all of the argument images in a vertical row, lined
up as indicated by the @scheme[x-place] argument. For example, if @scheme[x-place]
is @scheme["middle"], then the images are placed above each other with their centers
lined up.
@image-examples[(above/places "right"
(ellipse 70 20 "solid" "gold")
(ellipse 50 20 "solid" "goldenrod")
(ellipse 30 20 "solid" "darkgoldenrod")
(ellipse 10 20 "solid" "sienna"))
@image-examples[(above/align "right"
(ellipse 70 20 "solid" "gold")
(ellipse 50 20 "solid" "goldenrod")
(ellipse 30 20 "solid" "darkgoldenrod")
(ellipse 10 20 "solid" "sienna"))
(above/places "center"
(ellipse 70 20 "solid" "yellowgreen")
(ellipse 50 20 "solid" "olivedrab")
(ellipse 30 20 "solid" "darkolivegreen")
(ellipse 10 20 "solid" "darkgreen"))]
(above/align "center"
(ellipse 70 20 "solid" "yellowgreen")
(ellipse 50 20 "solid" "olivedrab")
(ellipse 30 20 "solid" "darkolivegreen")
(ellipse 10 20 "solid" "darkgreen"))]
}
@ -397,7 +397,7 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ
@image-examples[(rotate 45 (ellipse 60 20 "solid" "olivedrab"))
(rotate 5 (rectangle 50 50 "outline" "black"))
(rotate 45
(beside/places
(beside/align
"center"
(rectangle 40 20 "solid" "darkseagreen")
(rectangle 20 100 "solid" "darkseagreen")))]
@ -436,11 +436,11 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ
debug image constructions, i.e., to see where
certain sub-images appear within some larger image.
@image-examples[(beside/places "bottom"
(ellipse 20 70 "solid" "lightsteelblue")
(frame (ellipse 20 50 "solid" "mediumslateblue"))
(ellipse 20 30 "solid" "slateblue")
(ellipse 20 10 "solid" "navy"))]
@image-examples[(beside/align "bottom"
(ellipse 20 70 "solid" "lightsteelblue")
(frame (ellipse 20 50 "solid" "mediumslateblue"))
(ellipse 20 30 "solid" "slateblue")
(ellipse 20 10 "solid" "navy"))]
}
@section{Image Properties}
@ -598,9 +598,9 @@ Equality testing may contain a few nuances, though:
work well, each string passed to either of those functions results
in a number of horizontally aligned images, one for each letter in the
string. This means that, for example
@schemeblock[(equal? (beside/places "baseline"
(text "a" 18 "black")
(text "b" 18 "black"))
@schemeblock[(equal? (beside/align "baseline"
(text "a" 18 "black")
(text "b" 18 "black"))
(text "ab" 18 "black"))]
is true, but that subtle aspects of font drawing may be wrong, since
the underlying toolkit only gets a single letter at a time, instead

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1007 B

After

Width:  |  Height:  |  Size: 1007 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

View File

Before

Width:  |  Height:  |  Size: 893 B

After

Width:  |  Height:  |  Size: 893 B

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB