Data definition:
;; {(idx Mode)} is one of the following two symbols or strings:
;; -- 'solid
;; -- 'outline
;; -- "solid"
;; -- "outline"
;; Interpretation: 'solid
is used for creating solid basic
;; shapes; 'outline
is used for creating outlines of basic
;; shapes. Strings are used in an analogous manner.
Data definition:
(define-struct color (red blue green))
;; A CS is a structure: (make-color N N N)
;; where N is between 0 and 255.
;; {(idx Color)} is one of:
;; -- a color symbol, e.g., 'blue
;; -- a color string, e.g., "blue"
;; -- a CS, e.g., (make-color 0 0 255), which also denotes blue.
;; Interpretation: Color
arguments are used to paint the shapes
;; or their outlines. See below for more information about color structs.
The following predicate precisely specifies what a valid image color is:
The first group of functions creates basic shapes (Image
):
Images have many properties. To understand how functions manipulate and
create images, we need to understand one of these properties immediately:
pinholes. Each image, including primitive shapes, come with a
pinhole. Usually the pinhole is in the center of the shape except for those
created from line
and text
, which have pinholes
at the top left. When in doubt you can always find out where the pinhole is
and even place it somewhere else:
The next group of functions build images from images:
For composite images, it is always possible to determine whether one occurs
in the other and where:
Two more properties of images are useful for image manipulations: their
width and height. The two functions for extracting these properties are:
Data definition:
;; List-of-color is one of:
;; -- empty
;; -- (cons Color List-of-color)
Interpretation: represents a sequence of colors
It is possible to extract an image's colors and pixels and to create images
from a list of colors:
The shrink functions trim an image by eliminating extraneous pixels.
The last group of functions extracts the consitiuent colors from an image
and combine colors into an image, but the functions provide alpha-channel
information as well. Alpha channels are a measure of transparency; 0
indicates fully opaque and 255 indicates fully transparent.