Library reference for (c211 image)


(color r g b)
=> a color

From (c211 color).

Create a new color with red, green, and blue values of r, g, and b respectively.

(color-equal? color color)
=> #t or #f

From (c211 color).

Test if two colors are equal.

(color-ref color band)
=> an integer in the range [0, 255]

From (c211 color).

band should be one of either the symbols red, green, or blue or the corresponding integers 0, 1, or 2. Access the color object, returning the amount of that specified color as an integer in the range [0, 255] where 0 is none of that color and 255 is the maximum amount.

(color-set! color band value)
=> unspecified

From (c211 color).

band should be one of either the symbols red, green, or blue or the corresponding integers 0, 1, or 2. Alter the color object setting the value (should be in the range [0, 255]) in that band.

(color? obj)
=> #t or #f

From (c211 color).

Test if obj is a color.

(draw-image image)
=> unspecified

Display the image to the screen.

(image-cols image)
=> a non-negative integer

Return how many columns are in image.

(image-equal? image image)
=> #t or #f

Test if two images are equal.

(image-map image procedure)
=> an image

Create a new image of the same size as image by mapping a procedure of the form (lambda (color) ...) over each pixel in the original.

(image-ref image row column)
(image-ref image row column band)
=> a color or an integer in the range [0, 255]

If band is not specified, access the pixel in image and row x column and return the corresponding color.

If band is specified and one of either the symbols red, green, or blue or the corresponding integers 0, 1, or 2, then access the pixel in image at row x column and return that given band from the pixel as an integer in the range [0, 255].

(image-rows image)
=> a non-negative integer

Return how many rows are in image.

(image-set! image row column color)
(image-set! image row column band value)
=> unspecified

Mutate the given image at the pixel specified by row x column.

If color is specified, store that color at that pixel.

If band and value are specified, band should be one of either the symbols red, green, or blue or the corresponding integers 0, 1, or 2 and value should be in the range [0, 255]. Change that band of that pixel to the given value.

(image? obj)
=> #t or #f

Test if obj is a colr

(make-image rows cols)
(make-image rows cols color)
(make-image rows cols generator)
=> an image

Create a new rows x cols image, defaulting to a black background.

If color is specified, fill with that color instead.

If generator is specified, it should be a function of the form (lambda (r c) ...) where r and c are the coordinates of a specific pixel.

(read-image)
(read-image file)
=> an image

If file is specified, load and return that file as an image. Otherwise, display a dialog to allow the user to choose a file.

Formats that can be read depend on the underlying Java Virtual Machine. At least JPG, PNG, GIF, and BMP will always be supported.

(write-image image)
(write-image image file)
=> unspecified

If file is specified, write the given image to that file. Otherwise, display a dialog to allow the user to choose a file.

Formats that can be written depend on the underlying Java Virtual Machine. At least JPG, PNG, GIF, and BMP will always be supported.