Functional Problem Solving (CSC 151 2014F) : Reference
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Readings]
Reference: [Setup] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
drawing-blank
drawing-unit-circle
drawing-unit-square
(scale-drawing
factorg
drawing
)
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.
(hscale-drawing
factor
drawing
)
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.
(vscale-drawing
factor
drawing
)
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.
(hshift-drawing
amt
drawing
)
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
.
(vshift-drawing
amt
drawing
)
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
.
(recolor-drawing
color
drawing
)
drawing
in color
.
Note that even if drawing
contained
colors, the new drawing contains only a single color.
(drawing-compose
list-of-drawings
)
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-group
drawing1
drawing2
...
drawingn
)
drawing1
is at the bottom and
drawingn
is at the top.
(drawing-left
drawing
)
(drawing-top
drawing
)
(drawing-right
drawing
)
(drawing-bottom
drawing
)
(drawing-width
drawing
)
(drawing-height
drawing
)
(drawing-type
drawing
)
ellipse
for ellipses and circles,
rectangle
for rectangles and squares,
group
for grouped drawings, and
line
for lines (not yet supported).
(drawing-color
drawing
)
(drawing->image
drawing
width
height
)
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-render!
drawing
image
)
drawing
on the specified
image, thereby changing the image. Expects that at least
part of the drawing fits within the confines of the image.
(drawing?
value
)
value
can be interpreted
as a drawing.
(drawing-blank?
value
)
value
can be interpreted
as a blank drawing.
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-scale
drawing
factor
)
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
)
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
)
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
)
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
)
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
.
(drawing-recolor
drawing
color
)
drawing
in color
.
Note that even if drawing
contained
colors, the new drawing contains only a single color.