Common Lisp Package: IMAGO

README:

FUNCTION

Public

DRAW-BEZIER-CURVE (IMAGE X1 Y1 X2 Y2 X3 Y3 X4 Y4 COLOR)

Draws a cublic Bezier curve defined by a starting point, two control points, and an end point, in an image.

DRAW-CIRCLE (IMAGE CENTER-X CENTER-Y RADIUS COLOR)

Draws a circle in an image.

DRAW-LINE (IMAGE X1 Y1 X2 Y2 COLOR &KEY (DASH-LENGTH 1) (DASH-INTERVAL 0))

Draws a line between two points in an image.

DRAW-POLYGON (IMAGE COORD-LIST COLOR &KEY (CLOSED T) (DASH-LENGTH 1) (DASH-INTERVAL 0))

Draws a polygon in an image.

DRAW-RECTANGLE (IMAGE X1 Y1 WIDTH HEIGHT COLOR &KEY (DASH-LENGTH 1) (DASH-INTERVAL 0))

Draws a rectangle in an image.

READ-IMAGE (FILENAME &KEY (ERRORP T))

Reads an image from a file. If the file format is not recognized, depending on the value of :ERRORP, either throws an error or returns NIL.

READ-PNM (FILESPEC)

Reads data for an image in PNM format from a file, and returns a newly created image correponding to those data.

REGISTER-IMAGE-READER (EXTENSIONS FUNCTION)

Register a reader function for some file extensions. The FUNCTION must take a FILESPEC as argument, and return an IMAGE.

WRITE-PCX (IMAGE FILESPEC &KEY (MAX-RUN-LENGTH 63) EVEN-SCANLINE-LENGTHS-P)

Write the given IMAGE to a Z-Soft PCX 3.0 format file named by FILESPEC. MAX-RUN-LENGTH => The longest run the PCX encoder will output. This can be as large as 63 (the default), but to support old and broken decoders, it should be set to 15. I've never seen a decoder so broken that it won't read >15 byte runs, but they do exist, so the option is here. EVEN-SCANLINE-LENGTHS-P => When set, will pad scanlines so that they are an even length. Supposedly there are decoders that want this behavior, but it's not necessary for most decoders.

WRITE-PNM (IMAGE FILESPEC OUTPUT-FORMAT)

Writes the image data to a file in PNM format. OUTPUT-FORMAT can be either :ASCII or :BINARY.

Undocumented

BLUR (IMAGE)

COLOR-ALPHA (COLOR)

COLOR-ARGB (COLOR)

COLOR-BLUE (COLOR)

COLOR-GREEN (COLOR)

COLOR-INTENSITY (COLOR)

COLOR-RED (COLOR)

COLOR-RGB (COLOR)

EDGE-DETECT (IMAGE)

EMBOSS (IMAGE &KEY (ANGLE 0) (DEPTH 1))

GRAY-ALPHA (GRAY)

GRAY-INTENSITY (GRAY)

INVERT-COLOR (COLOR)

INVERT-GRAY (GRAY)

MAKE-COLOR (R G B &OPTIONAL (ALPHA 255))

MAKE-GRAY (INTENSITY &OPTIONAL (ALPHA 255))

READ-PCX (FILESPEC)

READ-PNG (FILESPEC)

READ-TGA (FILESPEC)

SHARPEN (IMAGE)

WRITE-PNG (IMAGE FILESPEC)

WRITE-TGA (IMAGE FILESPEC &KEY (TOP-DOWN-P NIL))

Private

DRAW-POINT (IMAGE X Y COLOR)

Draws a point in an image.

IN-IMAGE-P (X Y IMAGE)

Checks that the point with coordinates (X, Y) is inside IMAGE.

IN-REGION-P (X Y REGION-X REGION-Y REGION-WIDTH REGION-HEIGHT)

Checks that the point with coordinates (X, Y) is inside the given region.

PNG-DESCRIPTOR-COLOR-TYPE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PNG-DESCRIPTOR-COMPRESSION-METHOD (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PNG-DESCRIPTOR-DEPTH (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PNG-DESCRIPTOR-FILTER-METHOD (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PNG-DESCRIPTOR-HEIGHT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PNG-DESCRIPTOR-INTERLACE-METHOD (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PNG-DESCRIPTOR-WIDTH (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

READ-INTEGER-AS-TEXT (STREAM &KEY (BASE 10))

Reads the text representation of a number from a binary output stream.

WRITE-INTEGER-AS-TEXT (STREAM NUMBER &KEY (BASE 10))

Writes the text representation of a number to a binary output stream.

WRITE-LSB-INTEGER (NUMBER STREAM SIZE)

Writes SIZE bytes of the integer NUMBER to STREAM, in least-significant bit order.

WRITE-MSB-INTEGER (NUMBER STREAM SIZE)

Writes SIZE bytes of the integer NUMBER to STREAM, in most-significant bit order.

Undocumented

BEST-IN-ARRAY (F ARRAY &KEY (TEST #'>))

CLOSEST-COLORTABLE-ENTRY (COLOR TABLE)

COLORMAP->PCX-EGA-PALETTE (COLORMAP EGA-PALETTE)

COPY-PNG-DESCRIPTOR (INSTANCE)

CRC32 (BUFFER)

DECODE-PNG-COLORMAP (DATA)

DECODE-PNG-DESCRIPTOR (DATA)

DECODE-PNG-IMAGE (DESCRIPTOR DATA)

FILL-PCX-SCANLINE-BUFFER (IMAGE SCANLINE PLANE BUFFER)

IMAGES-SAME-DIMENSIONS-P (&REST IMAGES)

IMAGES-SAME-TYPE-P (&REST IMAGES)

LIMIT-VALUE (VALUE MIN MAX)

MAKE-PNG-DESCRIPTOR (&KEY ((WIDTH DUM0) NIL) ((HEIGHT DUM1) NIL) ((DEPTH DUM2) NIL) ((COLOR-TYPE DUM3) NIL) ((COMPRESSION-METHOD DUM4) NIL) ((FILTER-METHOD DUM5) NIL) ((INTERLACE-METHOD DUM6) NIL))

MAKE-SIMPLE-GRAY-COLORMAP

PCX-EGA-PALETTE->COLORMAP (EGA-PALETTE COLORMAP)

SETFPNG-DESCRIPTOR-COLOR-TYPE (NEW-VALUE INSTANCE)

SETFPNG-DESCRIPTOR-COMPRESSION-METHOD (NEW-VALUE INSTANCE)

SETFPNG-DESCRIPTOR-DEPTH (NEW-VALUE INSTANCE)

SETFPNG-DESCRIPTOR-FILTER-METHOD (NEW-VALUE INSTANCE)

SETFPNG-DESCRIPTOR-HEIGHT (NEW-VALUE INSTANCE)

SETFPNG-DESCRIPTOR-INTERLACE-METHOD (NEW-VALUE INSTANCE)

PNG-DESCRIPTOR-P (OBJECT)

SETFPNG-DESCRIPTOR-WIDTH (NEW-VALUE INSTANCE)

PNG-PAETH (A B C)

PNG-SAMPLES-PER-PIXEL (COLOR-TYPE)

READ-ASCII-RGB-PIXEL (STREAM)

READ-BIN-RGB-PIXEL (STREAM)

READ-BYTE-ARRAY (STREAM LENGTH)

READ-LSB-INTEGER (STREAM SIZE)

READ-MSB-INTEGER (STREAM SIZE)

READ-NUMBER (STREAM)

READ-NUMBER2 (STREAM)

READ-PCX-DATA (STREAM IMAGE COLOR-PLANES BYTES-PER-LINE)

READ-PCX-VGA-PALETTE (STREAM IMAGE)

READ-PNG-CHUNK (STREAM)

READ-PNG-SAMPLE (DATA BIT-INDEX DEPTH)

READ-PNG-SIGNATURE (STREAM)

READ-PNM-FROM-STREAM (STREAM)

READ-PNM-INFO (STREAM)

READ-TGA-COLOR (STREAM BPP)

READ-TGA-COLOR-INDEX (STREAM BPP)

READ-TGA-COLORMAP (STREAM ORIGIN LENGTH BPP)

READ-TGA-DATA (STREAM IMAGE WIDTH HEIGHT TOP-DOWN-P READER BPP)

SKIP-BYTES (STREAM COUNT)

SKIP-LINE (STREAM)

SKIP-WHITESPACE-AND-COMMENTS (STREAM &OPTIONAL (COMMENT-START #))

SQUARE (X)

UPDATE-CRC32 (CRC BUFFER)

WRITE-PCX-BODY (STREAM IMAGE COLOR-PLANES BYTES-PER-LINE MAX-RUN-LENGTH)

WRITE-PNG-CHUNK (DATA TYPE STREAM)

WRITE-PNG-DATA-CHUNK (STREAM IMAGE)

WRITE-PNG-END-CHUNK (STREAM)

WRITE-PNG-HEADER-CHUNK (STREAM IMAGE)

WRITE-PNG-SIGNATURE (STREAM)

WRITE-TGA-DATA (IMAGE TOP-DOWN-P PIXEL-WRITER)

MACRO

Public

DO-IMAGE-PIXELS ((IMAGE COLOR X Y) &BODY BODY)

Iterates through all pixels of an image. For each pixel, X and Y are bound to the pixel coordinates, and COLOR is a generalized variable corresponding to the pixel color.

DO-LINE-PIXELS ((IMAGE COLOR X Y X1 Y1 X2 Y2) &BODY BODY)

Iterates through all pixels of a line segment in an image, corresponding to the X1, Y1, X2 and Y2 parameters. For each pixel, X and Y are bound to the pixel coordinates, and COLOR is a generalized variable corresponding to the pixel color.

DO-REGION-PIXELS ((IMAGE COLOR X Y REGION-X REGION-Y REGION-WIDTH REGION-HEIGHT) &BODY BODY)

Iterates through all pixels of a rectangular region in an image. For each pixel, X and Y are bound to the pixel coordinates, and COLOR is a generalized variable corresponding to the pixel color.

WITH-IMAGE-DEFINITION ((IMAGE WIDTH HEIGHT PIXELS) &BODY BODY)

Binds the WIDTH, HEIGHT and PIXELS variables to the values corresponding to IMAGE, then evaluates the body.

Private

WITH-GENSYMS (VARS &BODY BODY)

Bind variables to gensyms and execute the BODY forms in an implicit PROGN.

Undocumented

READ-ARRAY-ELEMENT (ARRAY INDEX)

WITH-WRITE-PNM-LOOP ((STREAM X Y PIXELS MAGIC-NUMBER MAX-VALUE) &BODY BODY)

GENERIC-FUNCTION

Public

COMPOSE (DEST IMAGE1 IMAGE2 X Y OPERATOR)

Composes IMAGE1 and IMAGE2 at offset (X, Y), using OPERATOR to compose each pixel. OPERATOR must be a function of two colors, returning a color.

CONVOLVE (IMAGE MATRIX DIVISOR OFFSET)

Applies a 5x5 convolution kernel (a 5x5 real number matrix) to an image. Returns the resulting image.

COPY (DEST SRC &KEY DEST-X DEST-Y SRC-X SRC-Y WIDTH HEIGHT (SRC-Y 0) (SRC-X 0) (DEST-Y 0) (DEST-X 0))

Copies a rectangular region from image SRC to image DEST. Both images must be large enough to contain the specified region at the given positions. Both images must be of same type.

FLIP (DEST IMAGE AXIS)

Flips an image. AXIS may be either :HORIZONTAL or :VERTICAL. DEST must be either an image of same type and dimensions as IMAGE, or NIL. Returns the resulting image.

IMAGE-HEIGHT (IMAGE)

Returns the height of the image.

IMAGE-PIXEL (IMAGE X Y)

Returns the color of the pixel at specified coordinates in the image.

SETFIMAGE-PIXEL (PIXEL IMAGE X Y)

Sets the color of the pixel at specified coordinates in the image.

IMAGE-WIDTH (IMAGE)

Returns the width of the image.

RESIZE (IMAGE NEW-WIDTH NEW-HEIGHT)

Returns an newly created image corresponding to the IMAGE image, with given dimensions.

SCALE (IMAGE WIDTH-FACTOR HEIGHT-FACTOR)

Returns an newly created image corresponding to the IMAGE image, with its dimensions multiplied by the given factors.

SET-ALPHA (IMAGE ALPHA)

Sets the alpha channel value for all pixels/colors in an image.

Undocumented

CONVERT-TO-GRAYSCALE (IMAGE)

CONVERT-TO-INDEXED (IMAGE)

CONVERT-TO-PLANAR (IMAGE)

CONVERT-TO-RGB (IMAGE)

Private

DEFAULT-COMPOSE-OPERATOR (IMAGE)

Returns a compose operator that can be applied to images of the same type as IMAGE. The default operator mixes colors according to their respective alpha component.

MAKE-SIMILAR-IMAGE (IMAGE)

Returns a new image, with same type and dimensions as IMAGE.

PIXEL-SIZE (IMAGE)

Returns the number of bytes used to represent a pixel.

Undocumented

IMAGE-PNG-COLOR-TYPE (IMAGE)

WRITE-PNG-COLORMAP-CHUNK (STREAM IMAGE)

WRITE-PNG-PIXEL-BYTES (DEST IMAGE X Y INDEX)

WRITE-PNM-TO-STREAM (IMAGE STREAM OUTPUT-FORMAT)

WRITE-TGA-TO-STREAM (IMAGE STREAM TOP-DOWN-P)

SLOT-ACCESSOR

Public

IMAGE-PIXELS (IMAGE)

The Returns a rectangular array of the image pixels.

Undocumented

IMAGE-COLORMAP (OBJECT)

IMAGE-PLANE-COUNT (OBJECT)

VARIABLE

Public

Undocumented

+BLACK+

+BLUE+

+CYAN+

+GREEN+

+MAGENTA+

+RED+

+WHITE+

+YELLOW+

Private

Undocumented

*IMAGE-FILE-READERS*

+CRC32-TABLE+

+EMBOSS-MATRIX-CELL-ANGLES+

+PNG-IDAT-CHUNK-TYPE+

+PNG-IEND-CHUNK-TYPE+

+PNG-IHDR-CHUNK-TYPE+

+PNG-PLTE-CHUNK-TYPE+

+PNG-SIGNATURE+

+PNM-IMAGE-MAKERS+

+PNM-PIXEL-READERS+

CLASS

Public

GRAYSCALE-IMAGE

The class for grayscale images. Image dimensions must be provided to MAKE-INSTANCE, through the :WIDTH and :HEIGHT keyword parameters.

IMAGE

The protocol class for images.

INDEXED-IMAGE

The class for indexed images. Image dimensions must be provided to MAKE-INSTANCE, through the :WIDTH and :HEIGHT keyword parameters. Also accepts a :COLOR-COUNT keyword parameter, to specify the image color count (256 by default).

PLANAR-IMAGE

The class for planar images. Image dimensions and plane count must be provided to MAKE-INSTANCE, through the :WIDTH, :HEIGHT, and :PLANE-COUNT keyword parameters, respectively.

RGB-IMAGE

The class for RGB images. Image dimensions must be provided to MAKE-INSTANCE, through the :WIDTH and :HEIGHT keyword parameters.

Private

Undocumented

PNG-DESCRIPTOR