diff --git a/collects/2htdp/image.ss b/collects/2htdp/image.ss index 7176c2466a..4ac4443416 100644 --- a/collects/2htdp/image.ss +++ b/collects/2htdp/image.ss @@ -75,6 +75,7 @@ and they all have good sample contracts. (It is amazing what we can do with kids triangle isosceles-triangle right-triangle + line text text/font diff --git a/collects/2htdp/private/image-more.ss b/collects/2htdp/private/image-more.ss index 4b98439d00..7092f6cd5e 100644 --- a/collects/2htdp/private/image-more.ss +++ b/collects/2htdp/private/image-more.ss @@ -158,7 +158,7 @@ 'non-negative-real-number i arg) arg] - [(dx dy factor x-factor y-factor) + [(dx dy x1 y1 x2 y2 factor x-factor y-factor) (check-arg fn-name (real? arg) 'real\ number @@ -449,6 +449,15 @@ ;; (only called for rotated shapes, so bottom=baseline) (define (simple-bb simple-shape) (cond + [(line-segment? simple-shape) + (let ([x1 (point-x (line-segment-start simple-shape))] + [y1 (point-y (line-segment-start simple-shape))] + [x2 (point-x (line-segment-end simple-shape))] + [y2 (point-y (line-segment-end simple-shape))]) + (values (min x1 x2) + (min y1 y2) + (max x1 x2) + (max y1 y2)))] [(polygon? simple-shape) (let ([points (polygon-points simple-shape)]) (let* ([fx (point-x (car points))] @@ -492,10 +501,10 @@ (let*-values ([(w h a d) (send text-sizing-bm get-text-extent (text-string atomic-shape) (text->font atomic-shape))] - [(ax ay) (rotate-point (- (/ w 2)) (- (/ h 2)) (text-angle atomic-shape))] - [(bx by) (rotate-point (- (/ w 2)) (/ h 2) (text-angle atomic-shape))] - [(cx cy) (rotate-point (/ w 2) (- (/ h 2)) (text-angle atomic-shape))] - [(dx dy) (rotate-point (/ w 2) (/ h 2) (text-angle atomic-shape))]) + [(ax ay) (rotate-xy (- (/ w 2)) (- (/ h 2)) (text-angle atomic-shape))] + [(bx by) (rotate-xy (- (/ w 2)) (/ h 2) (text-angle atomic-shape))] + [(cx cy) (rotate-xy (/ w 2) (- (/ h 2)) (text-angle atomic-shape))] + [(dx dy) (rotate-xy (/ w 2) (/ h 2) (text-angle atomic-shape))]) (values (min ax bx cx dx) (min ay by cy dy) (max ax bx cx dx) @@ -507,10 +516,14 @@ ;; rotate-simple : angle simple-shape -> simple-shape (define (rotate-simple θ simple-shape) (cond + [(line-segment? simple-shape) + (make-line-segment (rotate-point (line-segment-start simple-shape) + θ) + (rotate-point (line-segment-end simple-shape) + θ) + (line-segment-color simple-shape))] [(polygon? simple-shape) - (make-polygon (map (λ (p) - (let-values ([(xn yn) (rotate-point (point-x p) (point-y p) θ)]) - (make-point xn yn))) + (make-polygon (map (λ (p) (rotate-point p θ)) (polygon-points simple-shape)) (polygon-mode simple-shape) (polygon-color simple-shape))] @@ -569,8 +582,13 @@ (bitmap-scale atomic-shape) #f)])) -;; rotate-point : x,y angle -> x,y -(define (rotate-point x y θ) +;; rotate-point : point angle -> point +(define (rotate-point p θ) + (let-values ([(x y) (rotate-xy (point-x p) (point-y p) θ)]) + (make-point x y))) + +;; rotate-xy : x,y angle -> x,y +(define (rotate-xy x y θ) (c->xy (* (make-polar 1 (degrees->radians θ)) (xy->c x y)))) @@ -634,8 +652,35 @@ (make-point 0 height))) +(define/chk (line x1 y1 color) + (let-values ([(shape w h) (line-shape x1 y1 color)]) + (make-image shape + (make-bb w h h) + #f))) + +(define (line-shape x1 y1 color) + (let ([dx (- (min x1 0))] + [dy (- (min y1 0))] + [w (+ (abs x1) 1)] + [h (+ (abs y1) 1)]) + (values (make-translate + dx dy + (make-line-segment (make-point 0 0) + (make-point x1 y1) + color)) + w h))) + #| +(define/chk (add-line image x1 y1 x2 y2 color) + (make-image (make-overlay + (make-translate + x1 y1 + (make-line-segment (make-point 0 0) + (make-point x2 y2) + color)) + (make-bb w h h) + #f)) +|# ;; line -;; text ;; this is just so that 'text' objects can be sized. (define text-sizing-bm (make-object bitmap-dc% (make-object bitmap% 1 1))) @@ -829,12 +874,14 @@ star star-polygon + line + text text/font swizzle - rotate-point) + rotate-xy) (provide/contract [atomic-bb (-> atomic-shape? (values real? real? real? real?))] diff --git a/collects/mrlib/image-core.ss b/collects/mrlib/image-core.ss index 737323c900..a1c6ab9f5b 100644 --- a/collects/mrlib/image-core.ss +++ b/collects/mrlib/image-core.ss @@ -118,6 +118,7 @@ has been moved out). ;; an atomic-shape is either: ;; - polygon +;; - line-segment ;; - np-atomic-shape ;; a np-atomic-shape is: @@ -142,6 +143,18 @@ has been moved out). #:property prop:equal+hash (list (λ (a b rec) (polygon-equal? a b rec)) (λ (x y) 42) (λ (x y) 3))) +;; a line-segment is +;; +;; - (make-line-segment point point color) +(define-struct/reg-mk line-segment (start end color) #:transparent #:omit-define-syntaxes + #:property prop:equal+hash + (list (λ (a b rec) (and (or (and (rec (line-segment-start a) (line-segment-start b)) + (rec (line-segment-end a) (line-segment-end b))) + (and (rec (line-segment-start a) (line-segment-end b)) + (rec (line-segment-end a) (line-segment-start b)))) + (rec (line-segment-color a) (line-segment-color b)))) + (λ (x y) 42) + (λ (x y) 3))) ;; a normalized-shape (subtype of shape) is either ;; - (make-overlay normalized-shape simple-shape) ;; - simple-shape @@ -149,6 +162,7 @@ has been moved out). ;; a simple-shape (subtype of shape) is ;; - (make-translate dx dy np-atomic-shape) ;; - polygon +;; - line-segment ;; an angle is a number between 0 and 360 (degrees) @@ -317,6 +331,9 @@ has been moved out). [x-scale 1] [y-scale 1] [bottom #f]) + (define (scale-point p) + (make-point (+ dx (* x-scale (point-x p))) + (+ dy (* y-scale (point-y p))))) (cond [(translate? shape) (loop (translate-shape shape) @@ -338,18 +355,21 @@ has been moved out). (loop (overlay-top shape) dx dy x-scale y-scale bottom))] [(polygon? shape) - (let* ([scaled-points - (map (λ (p) - (make-point (+ dx (* x-scale (point-x p))) - (+ dy (* y-scale (point-y p))))) - (polygon-points shape))] - [this-one - (make-polygon scaled-points + (let* ([this-one + (make-polygon (map scale-point (polygon-points shape)) (polygon-mode shape) (polygon-color shape))]) (if bottom (make-overlay bottom (f this-one)) (f this-one)))] + [(line-segment? shape) + (let ([this-one + (make-line-segment (scale-point (line-segment-start shape)) + (scale-point (line-segment-end shape)) + (line-segment-color shape))]) + (if bottom + (make-overlay bottom (f this-one)) + (f this-one)))] [(np-atomic-shape? shape) (let ([this-one (make-translate dx dy (scale-np-atomic x-scale y-scale shape))]) (if bottom @@ -361,10 +381,12 @@ has been moved out). (define (simple-shape? shape) (or (and (translate? shape) (np-atomic-shape? (translate-shape shape))) - (polygon? shape))) + (polygon? shape) + (line-segment? shape))) (define (atomic-shape? shape) (or (polygon? shape) + (line-segment? shape) (np-atomic-shape? shape))) (define (np-atomic-shape? shape) @@ -460,6 +482,15 @@ has been moved out). (send dc set-pen (mode-color->pen (polygon-mode simple-shape) (polygon-color simple-shape))) (send dc set-brush (mode-color->brush (polygon-mode simple-shape) (polygon-color simple-shape))) (send dc draw-path path dx dy 'winding))] + [(line-segment? simple-shape) + (let ([path (new dc-path%)] + [start (line-segment-start simple-shape)] + [end (line-segment-end simple-shape)]) + (send dc set-pen (line-segment-color simple-shape) 1 'solid) + (send dc set-brush "black" 'transparent) + (send dc draw-line + (+ dx (point-x start)) (+ dy (point-y start)) + (+ dx (point-x end)) (+ dy (point-y end))))] [else (let ([dx (+ dx (translate-dx simple-shape))] [dy (+ dy (translate-dy simple-shape))] @@ -566,6 +597,8 @@ has been moved out). make-text text? text-string text-angle text-y-scale text-color text-angle text-size text-face text-family text-style text-weight text-underline make-polygon polygon? polygon-points polygon-mode polygon-color + make-line-segment line-segment? line-segment-start line-segment-end line-segment-color + make-bitmap bitmap? bitmap-raw-bitmap bitmap-raw-mask bitmap-angle bitmap-scale bitmap-rendered-bitmap degrees->radians diff --git a/collects/teachpack/2htdp/scribblings/image-gen.ss b/collects/teachpack/2htdp/scribblings/image-gen.ss index 6265a958af..e8ea3805d9 100644 --- a/collects/teachpack/2htdp/scribblings/image-gen.ss +++ b/collects/teachpack/2htdp/scribblings/image-gen.ss @@ -46,7 +46,11 @@ (read in))) (for-each handle-image expressions) -(printf "\n") +(cond + [(null? mapping) + (error 'image-gen "didn't find any images; probably this means that you need to delete .zo files and try again")] + [else + (printf "\n")]) (call-with-output-file "image-toc.ss" (λ (port) diff --git a/collects/teachpack/2htdp/scribblings/image-toc.ss b/collects/teachpack/2htdp/scribblings/image-toc.ss index a8f01bed27..e2151c083d 100644 --- a/collects/teachpack/2htdp/scribblings/image-toc.ss +++ b/collects/teachpack/2htdp/scribblings/image-toc.ss @@ -28,18 +28,18 @@ (ellipse 20 30 "solid" "slateblue") (ellipse 20 10 "solid" "navy")) 'image - "46.png") - (list '(frame (ellipse 20 20 "outline" "black")) 'image "45.png") - (list '(ellipse 60 60 "solid" "blue") 'image "44.png") - (list '(scale/xy 3 2 (ellipse 20 30 "solid" "blue")) 'image "43.png") - (list '(ellipse 40 60 "solid" "blue") 'image "42.png") - (list '(scale 2 (ellipse 20 30 "solid" "blue")) 'image "41.png") - (list '(rotate 5 (rectangle 50 50 "outline" "black")) 'image "40.png") - (list '(rotate 45 (ellipse 60 20 "solid" "olivedrab")) 'image "39.png") + "49.png") + (list '(frame (ellipse 20 20 "outline" "black")) 'image "48.png") + (list '(ellipse 60 60 "solid" "blue") 'image "47.png") + (list '(scale/xy 3 2 (ellipse 20 30 "solid" "blue")) 'image "46.png") + (list '(ellipse 40 60 "solid" "blue") 'image "45.png") + (list '(scale 2 (ellipse 20 30 "solid" "blue")) 'image "44.png") + (list '(rotate 5 (rectangle 50 50 "outline" "black")) 'image "43.png") + (list '(rotate 45 (ellipse 60 20 "solid" "olivedrab")) 'image "42.png") (list '(beside/places "baseline" (text "ijy" 18 "black") (text "ijy" 24 "black")) 'image - "38.png") + "41.png") (list '(beside/places "center" @@ -48,7 +48,7 @@ (ellipse 20 30 "solid" "purple") (ellipse 20 10 "solid" "indigo")) 'image - "37.png") + "40.png") (list '(beside/places "bottom" @@ -57,7 +57,7 @@ (ellipse 20 30 "solid" "slateblue") (ellipse 20 10 "solid" "navy")) 'image - "36.png") + "39.png") (list '(beside (ellipse 20 70 "solid" "gray") @@ -65,7 +65,7 @@ (ellipse 20 30 "solid" "dimgray") (ellipse 20 10 "solid" "black")) 'image - "35.png") + "38.png") (list '(overlay/xy (rectangle 10 10 "solid" "red") @@ -73,7 +73,7 @@ -10 (rectangle 10 10 "solid" "black")) 'image - "34.png") + "37.png") (list '(overlay/xy (rectangle 10 10 "solid" "red") @@ -81,7 +81,7 @@ 10 (rectangle 10 10 "solid" "black")) 'image - "33.png") + "36.png") (list '(overlay/xy (rectangle 10 10 "outline" "red") @@ -89,7 +89,7 @@ 0 (rectangle 10 10 "outline" "black")) 'image - "32.png") + "35.png") (list '(overlay/xy (ellipse 40 40 "outline" "black") @@ -97,7 +97,7 @@ 25 (ellipse 10 10 "solid" "forestgreen")) 'image - "31.png") + "34.png") (list '(overlay/places "right" @@ -107,7 +107,7 @@ (rectangle 40 40 "solid" "red") (rectangle 50 50 "solid" "black")) 'image - "30.png") + "33.png") (list '(overlay/places "middle" @@ -115,7 +115,7 @@ (rectangle 30 60 "solid" "orange") (ellipse 60 30 "solid" "purple")) 'image - "29.png") + "32.png") (list '(overlay (ellipse 10 10 "solid" "red") @@ -125,32 +125,35 @@ (ellipse 50 50 "solid" "red") (ellipse 60 60 "solid" "black")) 'image - "28.png") + "31.png") (list '(overlay (ellipse 60 30 "solid" "purple") (rectangle 30 60 "solid" "orange")) 'image - "27.png") + "30.png") (list '(text/font "not really a link" 18 "blue" #f 'roman 'normal 'normal #t) 'image - "26.png") + "29.png") (list '(text/font "Goodbye" 18 "indigo" #f 'modern 'italic 'normal #f) 'image - "25.png") + "28.png") (list '(text/font "Hello" 24 "olive" "Gill Sans" 'swiss 'normal 'bold #f) 'image - "24.png") - (list '(text "Goodbye" 36 "indigo") 'image "23.png") - (list '(text "Hello" 24 "olive") 'image "22.png") + "27.png") + (list '(text "Goodbye" 36 "indigo") 'image "26.png") + (list '(text "Hello" 24 "olive") 'image "25.png") + (list '(line 30 -20 "red") 'image "24.png") + (list '(line -30 20 "red") 'image "23.png") + (list '(line 30 30 "black") 'image "22.png") (list '(star-polygon 20 10 3 "solid" "cornflowerblue") 'image "21.png") (list '(star-polygon 40 7 3 "outline" "darkred") 'image "20.png") (list '(star-polygon 40 5 2 "solid" "seagreen") 'image "19.png") (list '(star 40 "solid" "gray") 'image "18.png") - (list '(regular-polygon 20 6 "solid" "red") 'image "17.png") + (list '(regular-polygon 20 8 "solid" "red") 'image "17.png") (list '(regular-polygon 20 4 "outline" "blue") 'image "16.png") (list '(regular-polygon 30 3 "outline" "red") 'image "15.png") (list '(rhombus 80 150 "solid" "mediumpurple") 'image "14.png") diff --git a/collects/teachpack/2htdp/scribblings/image.scrbl b/collects/teachpack/2htdp/scribblings/image.scrbl index c19c5d50aa..0c9c7db446 100644 --- a/collects/teachpack/2htdp/scribblings/image.scrbl +++ b/collects/teachpack/2htdp/scribblings/image.scrbl @@ -128,7 +128,7 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ @image-examples[(regular-polygon 30 3 "outline" "red") (regular-polygon 20 4 "outline" "blue") - (regular-polygon 20 6 "solid" "red")] + (regular-polygon 20 8 "solid" "red")] } @defproc[(star [side-length (and/c real? (not/c negative?))] @@ -163,6 +163,15 @@ other. The top and bottom pair of angles is @scheme[angle] and the left and righ } +@defproc[(line [x1 real?] [y1 real?] [color (or/c symbol? string?)]) image?]{ + Constructs an image representing a line segment that connects the points + (0,0) to (x1,y1). + + @image-examples[(line 30 30 "black") + (line -30 20 "red") + (line 30 -20 "red")] +} + @defproc[(text [string string?] [font-size (and/c integer? (<=/c 1 255))] [color (or/c symbol? string?)]) image?]{ @@ -459,6 +468,10 @@ Equality testing may contain a few nuances, though: To combat this problem, use @scheme[equal~?] to compare the images, or @scheme[check-within] for test suites involving images.} + + @item{Combining a series of line segments to form a polygon produces + an image that is different than the polygon.} + @item{In order to make equality on images created with @scheme[text] and @scheme[text/font] work well, each string passed to either of those functions results @@ -476,7 +489,7 @@ Equality testing may contain a few nuances, though: For example, the letter combinations ``ff'' and ``fi'' and ``fl'' are generally drawn intertwined when they appear together, and thus an ``f'' drawn separately from an ``i'' looks different than the ligature ``fi''. - For example, here is how 24 point Times font looks when the word ``difficult'' + For example, here is how 24 point Times font looks when the word ``refill'' is drawn, first with ligatures and then without: @centerline{@image["2htdp/scribblings/ligature.png"]}. } diff --git a/collects/teachpack/2htdp/scribblings/img/17.png b/collects/teachpack/2htdp/scribblings/img/17.png index ee6308d544..27c7c2cec9 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/17.png and b/collects/teachpack/2htdp/scribblings/img/17.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/22.png b/collects/teachpack/2htdp/scribblings/img/22.png index cd170b1c51..9cd644b314 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/22.png and b/collects/teachpack/2htdp/scribblings/img/22.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/23.png b/collects/teachpack/2htdp/scribblings/img/23.png index b2593ebe1a..df5da613c9 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/23.png and b/collects/teachpack/2htdp/scribblings/img/23.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/24.png b/collects/teachpack/2htdp/scribblings/img/24.png index d4b7ede7b8..df5da613c9 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/24.png and b/collects/teachpack/2htdp/scribblings/img/24.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/25.png b/collects/teachpack/2htdp/scribblings/img/25.png index 43659d6e16..cd170b1c51 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/25.png and b/collects/teachpack/2htdp/scribblings/img/25.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/26.png b/collects/teachpack/2htdp/scribblings/img/26.png index ffe47dc980..b2593ebe1a 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/26.png and b/collects/teachpack/2htdp/scribblings/img/26.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/27.png b/collects/teachpack/2htdp/scribblings/img/27.png index e5bec8f1d1..d4b7ede7b8 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/27.png and b/collects/teachpack/2htdp/scribblings/img/27.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/28.png b/collects/teachpack/2htdp/scribblings/img/28.png index c7a53e79ba..43659d6e16 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/28.png and b/collects/teachpack/2htdp/scribblings/img/28.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/29.png b/collects/teachpack/2htdp/scribblings/img/29.png index aab464a076..f1985bc035 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/29.png and b/collects/teachpack/2htdp/scribblings/img/29.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/30.png b/collects/teachpack/2htdp/scribblings/img/30.png index 755b55bf26..e5bec8f1d1 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/30.png and b/collects/teachpack/2htdp/scribblings/img/30.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/31.png b/collects/teachpack/2htdp/scribblings/img/31.png index 841284164b..c7a53e79ba 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/31.png and b/collects/teachpack/2htdp/scribblings/img/31.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/32.png b/collects/teachpack/2htdp/scribblings/img/32.png index 60a97a2408..aab464a076 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/32.png and b/collects/teachpack/2htdp/scribblings/img/32.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/33.png b/collects/teachpack/2htdp/scribblings/img/33.png index 79bb91c201..755b55bf26 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/33.png and b/collects/teachpack/2htdp/scribblings/img/33.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/34.png b/collects/teachpack/2htdp/scribblings/img/34.png index 2b68c09f35..841284164b 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/34.png and b/collects/teachpack/2htdp/scribblings/img/34.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/35.png b/collects/teachpack/2htdp/scribblings/img/35.png index 08e8736666..60a97a2408 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/35.png and b/collects/teachpack/2htdp/scribblings/img/35.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/36.png b/collects/teachpack/2htdp/scribblings/img/36.png index 99a2eca320..79bb91c201 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/36.png and b/collects/teachpack/2htdp/scribblings/img/36.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/37.png b/collects/teachpack/2htdp/scribblings/img/37.png index 9c4330165b..2b68c09f35 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/37.png and b/collects/teachpack/2htdp/scribblings/img/37.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/38.png b/collects/teachpack/2htdp/scribblings/img/38.png index 36949fd2ba..08e8736666 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/38.png and b/collects/teachpack/2htdp/scribblings/img/38.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/39.png b/collects/teachpack/2htdp/scribblings/img/39.png index 5cc44ce573..99a2eca320 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/39.png and b/collects/teachpack/2htdp/scribblings/img/39.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/40.png b/collects/teachpack/2htdp/scribblings/img/40.png index 7322f66859..9c4330165b 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/40.png and b/collects/teachpack/2htdp/scribblings/img/40.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/41.png b/collects/teachpack/2htdp/scribblings/img/41.png index 26ebdc8f87..8e2f621748 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/41.png and b/collects/teachpack/2htdp/scribblings/img/41.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/42.png b/collects/teachpack/2htdp/scribblings/img/42.png index 26ebdc8f87..5cc44ce573 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/42.png and b/collects/teachpack/2htdp/scribblings/img/42.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/43.png b/collects/teachpack/2htdp/scribblings/img/43.png index 5051608ba5..7322f66859 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/43.png and b/collects/teachpack/2htdp/scribblings/img/43.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/44.png b/collects/teachpack/2htdp/scribblings/img/44.png index 5051608ba5..26ebdc8f87 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/44.png and b/collects/teachpack/2htdp/scribblings/img/44.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/45.png b/collects/teachpack/2htdp/scribblings/img/45.png index 96584002be..26ebdc8f87 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/45.png and b/collects/teachpack/2htdp/scribblings/img/45.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/46.png b/collects/teachpack/2htdp/scribblings/img/46.png index 12adfdabfc..5051608ba5 100644 Binary files a/collects/teachpack/2htdp/scribblings/img/46.png and b/collects/teachpack/2htdp/scribblings/img/46.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/47.png b/collects/teachpack/2htdp/scribblings/img/47.png new file mode 100644 index 0000000000..5051608ba5 Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/47.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/48.png b/collects/teachpack/2htdp/scribblings/img/48.png new file mode 100644 index 0000000000..96584002be Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/48.png differ diff --git a/collects/teachpack/2htdp/scribblings/img/49.png b/collects/teachpack/2htdp/scribblings/img/49.png new file mode 100644 index 0000000000..12adfdabfc Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/img/49.png differ diff --git a/collects/tests/2htdp/test-image.ss b/collects/tests/2htdp/test-image.ss index b70779e316..b5bf42f5d7 100644 --- a/collects/tests/2htdp/test-image.ss +++ b/collects/tests/2htdp/test-image.ss @@ -633,3 +633,21 @@ 0.01) #t) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; lines +;; + +(check-equal? (image-width (line 10 20 'black)) + 11) +(check-equal? (image-height (line 10 20 'black)) + 21) + +(check-equal? (round-numbers (rotate 90 (line 10 20 'black))) + (round-numbers (line 20 -10 'black))) + +(check-equal? (round-numbers (line 20 30 "red")) + (round-numbers (rotate 180 (line 20 30 "red")))) + +(check-equal? (round-numbers (line -30 20 "red")) + (round-numbers (line 30 -20 "red")))