LispWorks CAPI Reference Manual > 2 GP Reference Entries

NextPrevUpTopContentsIndex

read-external-image

Function
Summary

Returns an external image read from a file.

Package

graphics-ports

Signature

read-external-image file &key transparent-color-index type
=> image

Arguments

file

A pathname designator.

transparent-color-index

An integer or nil .

type

A keyword, or nil .

Values

image

An external image.

Description

The read-external-image function returns an external image read from file .

transparent-color-index specifies the index of the transparent color in the color map. transparent-color-index works only for images with a color map, that is, those with 256 colors or less. The default value is nil , meaning that there is no transparent color.

type tells read-external-image that the image is in a particular graphics format. Currently the only recognised value is :bmp , which means the image is read as a Bitmap. Other values of type cause read-external-image to read the image according to the file type of file . "bmp" or "dib" mean that the image is read as a Bitmap. Other file types are handled in Operating System-specific ways. See the Graphics Ports chapter in the LispWorks CAPI User Guide for details. The default value of type is nil .

Example

To see the effect of transparent-color-index , edit
examples/capi/graphics/images.lisp .

Specify a non-white :background for the viewer pane. Use an image editing tool to find the transparent color index (183 in this image) and change the call to read-external-image like this:

(gp:read-external-image file :transparent-color-index 183)

Then compile and run the example, click the Change... button and select the Setup.bmp file.

See also

external-image


LispWorks CAPI Reference Manual - 21 Dec 2009

NextPrevUpTopContentsIndex