CSC151.02 2010S Functional Problem Solving : Reference

Drawings


Constants

drawing-blank
MediaScheme Drawing Constant. An empty drawing. Included for the sake of completeness. Also provides a useful base case for recursion over grouped drawings.
drawing-unit-circle
MediaScheme Drawing Constant. A unit circle. That is, a circle with diameter 1, filled in black, centered at (0,0).
drawing-unit-square
MediaScheme Drawing Constant. A unit square. That is, a square with edge-length 1, filled in black, centered at (0,0).

Basic Transformations

(drawing-scale drawing factor)
MediaScheme Drawing Procedure. Creates a new drawing by scaling drawing by factor. Note that every part of the drawing is scaled, including both the horizontal and vertical distance of each component of the drawing from the origin.
(drawing-hscale drawing factor)
MediaScheme Drawing Procedure. Creates a new drawing by horizontally scaling drawing by factor. Note that every part of the drawing is scaled horizontally, including the horizontal distance of each component of the drawing from the origin.
(drawing-vscale drawing factor)
MediaScheme Drawing Procedure. Creates a new drawing by vertically scaling drawing by factor. Note that every part of the drawing is scaled vertically, including the vertical distance of each component of the drawing from the origin.
(drawing-hshift drawing amt)
MediaScheme Drawing Procedure. Creates a new drawing by shifting drawing horizontally by factor. If factor is positive, the drawing is shifted to the right. If factor is negative, the drawing is shifted left by the absolute value of factor.
(drawing-vshift drawing amt)
MediaScheme Drawing Procedure. Creates a new drawing by shifting drawing vertically by factor. If factor is positive, the drawing is shifted downward. If factor is negative, the drawing is shifted upward by the absolute value of factor.

Additional Transformations

(drawing-recolor drawing color)
MediaScheme Drawing Procedure. Creates a new drawing by recoloring drawing in color. Note that even if drawing contained colors, the new drawing contains only a single color.
(drawing-fill drawing)
MediaScheme Drawing Procedure. Creates a new drawing by filling each element of drawing. Element colors are preserved. After filling, no elements of the resulting drawing are outlined.

Grouping Drawings

(drawing-compose list-of-drawings)
MediaScheme Drawing Procedure. Create a new drawing by overlaying all of individual drawings in list-of-drawings. Note that the drawings are stacked first to last, so the first drawing in the list is at the bottom and the last in the list is at the top.
(drawing-join drawing1 drawing2)
MediaScheme Drawing Procedure. Create a new drawing by overlaying drawing2 on top of drawing1.
(drawing-group drawing1 drawing2 ... drawingn)
MediaScheme Drawing Procedure. Create a new drawing by overlaying all of the individual drawings. Note that the drawings are stacked first to last, so drawing1 is at the bottom and drawingn is at the top.

Getting Information About Drawings

(drawing-left drawing)
MediaScheme Drawing Procedure. Determine the column of the left edge of a drawing.
(drawing-top drawing)
MediaScheme Drawing Procedure. Determine the row of the top edge of a drawing.
(drawing-right drawing)
MediaScheme Drawing Procedure. Determine the column of the right edge of a drawing.
(drawing-bottom drawing)
MediaScheme Drawing Procedure. Determine the row of the bottom edge of a drawing.
(drawing-width drawing)
MediaScheme Drawing Procedure. Determine the width of a drawing.
(drawing-height drawing)
MediaScheme Drawing Procedure. Determine the approximate height of a drawing.
(drawing-type drawing)
MediaScheme Drawing Procedure. Determine the type of drawing represented. Returns a symbol: ellipse for ellipses and circles, rectangle for rectangles and squares, group for grouped drawings, and line for lines (not yet support).

Getting Additional Information About Simple Drawings

(drawing-color drawing)
MediaScheme Drawing Procedure. Determine the color of a simple drawing. (Does not work for compound drawings.)

Rendering Drawings

(drawing->image drawing width height)
MediaScheme Drawing Procedure. Create a new image of the specified width and height that contains the portion of drawing that fits in the rectangular region bounded on the left by 0, on the top by 0, on the right by width-1 and on the bottom by height-1.

Drawing Predicates

(drawing? value)
MediaScheme Drawing Procedure. Determine if value can be interpreted as a drawing.
(drawing-blank? value)
MediaScheme Drawing Procedure. Determine if value can be interpreted as a blank drawing.

Creative Commons License

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-10 Janet Davis, Matthew Kluber, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials copyright by John David Stone and Henry Walker and used by permission.)

This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.