Functional Problem Solving (CSC 151 2013F) : Reference
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning] [Grading]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Setup] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2010F)] [Weinman (2012F)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)]
(image-new
width
height)
(image-load
filename)
(image-save
image
fname)
image in the specified file
(which should provide the full path to the file). The type
of the image (JPEG, GIF, PNG, etc.) is determined by the suffix
of the file name.
(image-show
image)
(image-height
image)
(image-width
image)
(image-blot!
image
col
row)
(image-draw-line!
image
col1
row1
col2
row2)
(image-get-pixel
image
column
row)
(image-set-pixel!
image
column
row
rgb-color)
(image-transform-pixel!
image
column
row
func)
col,row)
in image by applying
func to its old color and setting that
pixel to the resulting color.
(image-calculate-pixels!
image
fun
fun to
the column and row.
fun should have the
form (lambda (col row) color).
Unlike image-compute-pixels!, which can compute
pixels in any order, image-calculate-pixels! is
guaranteed to do a row-by-row, left-to-right scan through
the image. However, image-calculate-pixels!
is likely to be slower than image-compute-pixels!
(although faster than coding the iteration yourself).
(image-compute
pos2color
width
height)
pos2color
(a function of the form (lambda (col row) color))
to compute the color at each position in the image. compute
(image-compute-pixels!
image
pos2color)
function to the position of the pixel.
function must have
the form (lambda (col row) expression-to-compute-color).
(image-scan
image
proc!)
proc! the the
column, row, and color at each position. proc!
should have the form (lambda (col row color) ...).
In contrast to many of the other image iteration procedures,
image-scan is guaranteed to scan row-by-row
from top-to-bottom, scanning each row from left to right.
(image-transform!
image
fun)
image in place by setting
each pixel to the result of applying fun to
that current pixel color.
(image-variant
image
fun)
image, each of whose pixels is computed
by applying fun to the color of the
corresponding pixel in image.
(region-calculate-pixels!
image
left
top
width
height
fun
fun at
each position in the region.
fun should have the
form (lambda (col row) color).
Unlike region-compute-pixels!, which can compute
pixels in any order, region-calculate-pixels! is
guaranteed to do a row-by-row, left-to-right scan through
the image. However, region-calculate-pixels!
is likely to be slower than region-compute-pixels!
(although faster than coding the iteration yourself).
(region-compute-pixels!
image
left
top
width
height
pos2color)
function to the position of the pixel.
function must be a function of
the form (lambda (col row) expression-to-compute-color).
(region-scan
image
left
top
width
height
proc!)
proc! at
each position in the region. proc! should have the
form (lambda (col row color) ...). In contrast to
many of the other region procedures, region-scan is
guaranteed to scan row-by-row from top-to-bottom, scanning each
row from left to right.
(image-select-all!
image)
(image-select-ellipse!
image
selection-type
left
top
width
height)
left, top margin is
top, width is width
and height is height.
If selection-type is
REPLACE, the ellipse replaces the
current selection. If selection-type
is ADD, the ellipse is added to the
current selection. If selection-type
is SUBTRACT, the ellipse is subtracted from
the current selection. If selection-type
is INTERSECT, the ellipse is intersected
with the current selection (that is, only points that are in
both the current selection and the ellipse remain selected).
(image-select-inverse!
image)
(image-select-nothing!
image)
(image-select-polygon!
image
selection-type
positions)
position-new).
If selection-type is
REPLACE, the polygon replaces the
current selection. If selection-type
is ADD, the polygon is added to the
current selection. If selection-type
is SUBTRACT, the polygon is subtracted from
the current selection. If selection-type
is INTERSECT, the polygon is intersected
with the current selection (that is, only points that are in
both the current selection and the polygon remain selected).
(image-select-rectangle!
image
selection-type
left
top
width
height)
left, top margin is
top, width is width
and height is height.
If selection-type is
REPLACE, the rectangle replaces the
current selection. If selection-type
is ADD, the rectangle is added to the
current selection. If selection-type
is SUBTRACT, the rectangle is subtracted from
the current selection. If selection-type
is INTERSECT, the rectangle is intersected
with the current selection (that is, only points that are in
both the current selection and the rectangle remain selected).
(image-fill-selection!
image)
(image-stroke-selection!
image)
(image-airbrush-line!
image
pressure
col1
row1
col2
row2)
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning] [Grading]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Setup] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2010F)] [Weinman (2012F)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)]
Samuel A. Rebelsky, rebelsky@grinnell.edu
Copyright (c) 2007-2013 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

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