added documentation for the flipping functions

This commit is contained in:
Robby Findler 2010-06-18 16:37:58 -05:00
parent 0c0009465e
commit 37ae5a338b
9 changed files with 33 additions and 4 deletions

View File

@ -38,7 +38,7 @@
(with-handlers ([exn:fail?
(λ (x)
(printf "\nerror evaluating:\n")
(pretty-print exp)
(pretty-write exp)
(raise x))])
(parameterize ([current-namespace image-ns]) (eval exp)))])
(cond
@ -107,7 +107,7 @@
(λ (port)
(fprintf port "#lang racket/base\n(provide mapping)\n")
(fprintf port ";; this file is generated by image-gen.ss -- do not edit\n;; note that the file that creates this file depends on this file\n;; it is always safe to simply define (and provide) mapping as the empty list\n\n")
(pretty-print
(pretty-write
`(define mapping (list ,@mapping))
port))
#:exists 'truncate)])

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide mapping)
;; this file is generated by image-gen.ss -- do not edit
;; note that the file that creates this file depends on this file
@ -53,6 +53,18 @@
'(crop 0 0 40 40 (circle 40 "solid" "chocolate"))
'image
"8e7c1870c7.png")
(list
'(above
(star 40 "solid" "firebrick")
(scale/xy 1 1/2 (flip-vertical (star 40 "solid" "gray"))))
'image
"25bd9b1ac5a.png")
(list
'(beside
(rotate 30 (square 50 "solid" "red"))
(flip-horizontal (rotate 30 (square 50 "solid" "blue"))))
'image
"e58911226.png")
(list '(ellipse 60 60 "solid" "blue") 'image "d92d6a49f1.png")
(list
'(scale/xy 3 2 (ellipse 20 30 "solid" "blue"))

View File

@ -764,7 +764,7 @@ the parts that fit onto @racket[scene].
}
@section{Rotating, Scaling, Cropping, and Framing Images}
@section{Rotating, Scaling, Flipping, Cropping, and Framing Images}
@defproc[(rotate [angle angle?] [image image?]) image?]{
Rotates @racket[image] by @racket[angle] degrees in a counter-clockwise direction.
@ -809,6 +809,23 @@ the parts that fit onto @racket[scene].
(ellipse 60 60 "solid" "blue")]
}
@defproc[(flip-horizontal [image image?]) image?]{
Flips @scheme[image] left to right.
@image-examples[(beside
(rotate 30 (square 50 "solid" "red"))
(flip-horizontal
(rotate 30 (square 50 "solid" "blue"))))]
}
@defproc[(flip-vertical [image image?]) image?]{
Flips @scheme[image] top to bottom.
@image-examples[(above
(star 40 "solid" "firebrick")
(scale/xy 1 1/2 (flip-vertical (star 40 "solid" "gray"))))]
}
@defproc[(crop [x real?] [y real?]
[width (and/c real? (not/c negative?))]
[height (and/c real? (not/c negative?))]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 B

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB