diff --git a/collects/teachpack/2htdp/scribblings/image-gen.rkt b/collects/teachpack/2htdp/scribblings/image-gen.rkt index 54dc9d3510..5bb08c5f4b 100644 --- a/collects/teachpack/2htdp/scribblings/image-gen.rkt +++ b/collects/teachpack/2htdp/scribblings/image-gen.rkt @@ -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)]) diff --git a/collects/teachpack/2htdp/scribblings/image-toc.rkt b/collects/teachpack/2htdp/scribblings/image-toc.rkt index 17c067ad53..c836eec9b4 100644 --- a/collects/teachpack/2htdp/scribblings/image-toc.rkt +++ b/collects/teachpack/2htdp/scribblings/image-toc.rkt @@ -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")) diff --git a/collects/teachpack/2htdp/scribblings/image.scrbl b/collects/teachpack/2htdp/scribblings/image.scrbl index 57584c287f..fa875efa9d 100644 --- a/collects/teachpack/2htdp/scribblings/image.scrbl +++ b/collects/teachpack/2htdp/scribblings/image.scrbl @@ -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?))] diff --git a/collects/teachpack/2htdp/scribblings/img/2187216ca96.png b/collects/teachpack/2htdp/scribblings/img/2187216ca96.png index 36949fd2ba..8e2f621748 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/2187216ca96.png and b/collects/teachpack/2htdp/scribblings/img/2187216ca96.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/25bd9b1ac5a.png b/collects/teachpack/2htdp/scribblings/img/25bd9b1ac5a.png new file mode 100644 index 0000000000..413f7b4e1c Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/25bd9b1ac5a.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/27bbbb6fd64.png b/collects/teachpack/2htdp/scribblings/img/27bbbb6fd64.png index ffe47dc980..f1985bc035 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/27bbbb6fd64.png and b/collects/teachpack/2htdp/scribblings/img/27bbbb6fd64.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/2a03b18c0c.png b/collects/teachpack/2htdp/scribblings/img/2a03b18c0c.png new file mode 100644 index 0000000000..d69970974b Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/2a03b18c0c.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/8aebbc110e.png b/collects/teachpack/2htdp/scribblings/img/8aebbc110e.png new file mode 100644 index 0000000000..8da3e5e657 Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/8aebbc110e.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/e58911226.png b/collects/teachpack/2htdp/scribblings/img/e58911226.png new file mode 100644 index 0000000000..2881e8c06a Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/e58911226.png differ