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
-
(scale-drawingfactorgdrawing) - MediaScheme Drawing Procedure.
Creates a new drawing by scaling
drawingbyfactor. 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. -
(hscale-drawingfactordrawing) - MediaScheme Drawing Procedure.
Creates a new drawing by horizontally scaling
drawingbyfactor. Note that every part of the drawing is scaled horizontally, including the horizontal distance of each component of the drawing from the origin. -
(vscale-drawingfactordrawing) - MediaScheme Drawing Procedure.
Creates a new drawing by vertically scaling
drawingbyfactor. Note that every part of the drawing is scaled vertically, including the vertical distance of each component of the drawing from the origin. -
(hshift-drawingamtdrawing) - MediaScheme Drawing Procedure.
Creates a new drawing by shifting
drawinghorizontally byfactor. Iffactoris positive, the drawing is shifted to the right. Iffactoris negative, the drawing is shifted left by the absolute value offactor. -
(vshift-drawingamtdrawing) - MediaScheme Drawing Procedure.
Creates a new drawing by shifting
drawingvertically byfactor. Iffactoris positive, the drawing is shifted downward. Iffactoris negative, the drawing is shifted upward by the absolute value offactor. -
(recolor-drawingcolordrawing) - MediaScheme Drawing Procedure.
Creates a new drawing by recoloring
drawingincolor. Note that even ifdrawingcontained colors, the new drawing contains only a single color.
Grouping Drawings
-
(drawing-composelist-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-groupdrawing1drawing2...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
drawing1is at the bottom anddrawingnis at the top.
Getting Information About Drawings
-
(drawing-leftdrawing) - MediaScheme Drawing Procedure. Determine the column of the left edge of a drawing.
-
(drawing-topdrawing) - MediaScheme Drawing Procedure. Determine the row of the top edge of a drawing.
-
(drawing-rightdrawing) - MediaScheme Drawing Procedure. Determine the column of the right edge of a drawing.
-
(drawing-bottomdrawing) - MediaScheme Drawing Procedure. Determine the row of the bottom edge of a drawing.
-
(drawing-widthdrawing) - MediaScheme Drawing Procedure. Determine the width of a drawing.
-
(drawing-heightdrawing) - MediaScheme Drawing Procedure. Determine the approximate height of a drawing.
-
(drawing-typedrawing) - MediaScheme Drawing Procedure.
Determine the type of drawing represented. Returns a symbol:
ellipsefor ellipses and circles,rectanglefor rectangles and squares,groupfor grouped drawings, andlinefor lines (not yet supported).
Getting Additional Information About Simple Drawings
-
(drawing-colordrawing) - MediaScheme Drawing Procedure. Determine the color of a simple drawing. (Does not work for compound drawings.)
Rendering Drawings
-
(drawing->imagedrawingwidthheight) - MediaScheme Drawing Procedure.
Create a new image of the specified width and height that
contains the portion of
drawingthat fits in the rectangular region bounded on the left by 0, on the top by 0, on the right bywidth-1 and on the bottom byheight-1. -
(drawing-render!drawingimage) - MediaScheme Drawing Procedure.
Render
drawingon the specified image, thereby changing the image. Expects that at least part of the drawing fits within the confines of the image.
Drawing Predicates
-
(drawing?value) - MediaScheme Drawing Procedure.
Determine if
valuecan be interpreted as a drawing. -
(drawing-blank?value) - MediaScheme Drawing Procedure.
Determine if
valuecan be interpreted as a blank drawing.
Alternate Versions of Transformations
These versions of the transformations reverse the order of the parameters. We originally developed these versions, but found that the versions above were clearer for most programmers, particularly novice programmers. The original versions are maintained to ensure that old code remains usable.
-
(drawing-scaledrawingfactor) - MediaScheme Drawing Procedure.
Creates a new drawing by scaling
drawingbyfactor. 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-hscaledrawingfactor) - MediaScheme Drawing Procedure.
Creates a new drawing by horizontally scaling
drawingbyfactor. Note that every part of the drawing is scaled horizontally, including the horizontal distance of each component of the drawing from the origin. -
(drawing-vscaledrawingfactor) - MediaScheme Drawing Procedure.
Creates a new drawing by vertically scaling
drawingbyfactor. Note that every part of the drawing is scaled vertically, including the vertical distance of each component of the drawing from the origin. -
(drawing-hshiftdrawingamt) - MediaScheme Drawing Procedure.
Creates a new drawing by shifting
drawinghorizontally byfactor. Iffactoris positive, the drawing is shifted to the right. Iffactoris negative, the drawing is shifted left by the absolute value offactor. -
(drawing-vshiftdrawingamt) - MediaScheme Drawing Procedure.
Creates a new drawing by shifting
drawingvertically byfactor. Iffactoris positive, the drawing is shifted downward. Iffactoris negative, the drawing is shifted upward by the absolute value offactor. -
(drawing-recolordrawingcolor) - MediaScheme Drawing Procedure.
Creates a new drawing by recoloring
drawingincolor. Note that even ifdrawingcontained colors, the new drawing contains only a single color.