Common Lisp Package: CL-GD

README:

FUNCTION

Public

ALLOCATE-COLOR (RED GREEN BLUE &KEY ALPHA (ERRORP T) (IMAGE *DEFAULT-IMAGE*))

Finds the first available color index in the image IMAGE specified, sets its RGB values to those requested (255 is the maximum for each), and returns the index of the new color table entry, or an RGBA value in the case of a true color image. In either case you can then use the returned value as a COLOR parameter to drawing functions. When creating a new palette-based image, the first time you invoke this function you are setting the background color for that image. If ALPHA (not greater than 127) is provided, an RGBA color will always be allocated. If all +GD-MAX-COLORS+ have already been allocated this function will, depending on the value of ERRORP, either raise an error or return NIL.

ALPHA-BLENDING-P (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns whether pixels drawn on IMAGE will be copied literally including alpha channel information (return value is false) or if their alpha channel information will determine how much of the underlying color will shine through (return value is true). This is only meaningful for true color images.

SETFALPHA-BLENDING-P (BLENDING &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Determines whether pixels drawn on IMAGE will be copied literally including alpha channel information (if BLENDING is false) or if their alpha channel information will determine how much of the underlying color will shine through (if BLENDING is true). This is only meaningful for true color images.

CLIPPING-RECTANGLE (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns the clipping rectangle of IMAGE as a list of four elements.

SETFCLIPPING-RECTANGLE (RECTANGLE &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Sets the clipping rectangle of IMAGE where rectangle should be a list (X1 Y1 X2 Y2).

CLIPPING-RECTANGLE* (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns the clipping rectangle of IMAGE as four values.

COLOR-COMPONENT (COMPONENT COLOR &KEY (IMAGE *DEFAULT-IMAGE*))

Returns the specified color component of COLOR. COMPONENT can be one of :RED, :GREEN, :BLUE, and :ALPHA.

COLOR-COMPONENTS (COLOR &KEY (IMAGE *DEFAULT-IMAGE*))

Returns a list of the color components of COLOR. The components are in the order red, green, blue, alpha.

COPY-IMAGE (SOURCE DESTINATION SOURCE-X SOURCE-Y DEST-X DEST-Y WIDTH HEIGHT &KEY RESAMPLE ROTATE ANGLE RESIZE DEST-WIDTH DEST-HEIGHT MERGE MERGE-GRAY)

Copies (a part of) image SOURCE into image DESTINATION. Copies the rectangle with the upper left corner (SOURCE-X,SOURCE-Y) and size WIDTH x HEIGHT to the rectangle with the upper left corner (DEST-X,DEST-Y). If RESAMPLE is true pixel colors will be smoothly interpolated. If RESIZE is true the copied rectangle will be strechted or shrinked so that its size is DEST-WIDTH x DEST-HEIGHT. If ROTATE is true the image will be rotated by ANGLE. In this particular case DEST-X and DEST-Y specify the CENTER of the copied image rather than its upper left corner! If MERGE is true it has to be an integer in the range 0-100 and the two images will be 'merged' by the amount specified. If MERGE is 100 then the source image will simply be copied. If instead MERGE-GRAY is true the hue of the source image is preserved by converting the destination area to gray pixels before merging. The keyword options RESAMPLE, ROTATE, RESIZE, MERGE, and MERGE-GRAY are mutually exclusive (with the exception of RESAMPLE and RESIZE). ANGLE is assumed to be specified in degrees if it's an integer, and in radians otherwise.

COPY-PALETTE (SOURCE DESTINATION)

Copies palette of image SOURCE to image DESTINATION attempting to match the colors in the target image to the colors in the source palette.

CREATE-IMAGE (WIDTH HEIGHT &OPTIONAL TRUE-COLOR)

Allocates and returns a GD image structure with size WIDTH x HEIGHT. Creates a true color image if TRUE-COLOR is true. You are responsible for destroying the image after you're done with it. It is advisable to use WITH-IMAGE instead.

CREATE-IMAGE-FROM-FILE (FILE-NAME &OPTIONAL TYPE)

Creates an image from the file specified by FILE-NAME (which is either a pathname or a string). The type of the image can be provided as TYPE or otherwise it will be guessed from the PATHNAME-TYPE of FILE-NAME. You are responsible for destroying the image after you're done with it. It is advisable to use WITH-IMAGE-FROM-FILE instead.

CREATE-IMAGE-FROM-GD2-PART (FILE-NAME SRC-X SRC-Y WIDTH HEIGHT)

Creates an image from the part of the GD2 file FILE-NAME (which is either a pathname or a string) specified by SRC-X, SRC-Y, WIDTH, and HEIGHT. You are responsible for destroying the image after you're done with it. It is advisable to use WITH-IMAGE-FROM-GD2-PART instead.

DEALLOCATE-COLOR (COLOR &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Marks the specified color COLOR as being available for reuse. No attempt will be made to determine whether the color index is still in use in the image IMAGE.

DESTROY-IMAGE (IMAGE)

Destroys (deallocates) IMAGE which has been created by CREATE-IMAGE, CREATE-IMAGE-FROM-FILE, or CREATE-IMAGE-FROM-GD2-PART.

DIFFERENTP (IMAGE1 IMAGE2)

Returns false if the two images won't appear different when displayed. Otherwise the return value is a list of keywords describing the differences between the images.

DRAW-ARC (CENTER-X CENTER-Y WIDTH HEIGHT START END &KEY STRAIGHT-LINE CENTER-CONNECT FILLED (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a partial ellipse centered at (CENTER-X, CENTER-Y) with width WIDTH and height HEIGHT. The arc begins at angle START and ends at angle END. If STRAIGHT-LINE is true the start and end points are just connected with a straight line. If CENTER-CONNECT is true, they are connected to the center (which is useful to create 'pie slices'). If FILLED is true the arc will be filled with COLOR, otherwise it will be outlined.

DRAW-CHARACTER (X Y CHAR &KEY UP (FONT *DEFAULT-FONT*) (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws the character CHAR from font FONT in color COLOR at position (X,Y). If UP is true the character will be drawn from bottom to top (rotated 90 degrees). FONT must be one of :TINY, :SMALL, :MEDIUM, :LARGE, :GIANT.

DRAW-FILLED-CIRCLE (CENTER-X CENTER-Y RADIUS &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a filled circle centered at (CENTER-X, CENTER-Y) with radius RADIUS.

DRAW-FILLED-ELLIPSE (CENTER-X CENTER-Y WIDTH HEIGHT &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a filled ellipse centered at (CENTER-X, CENTER-Y) with width WIDTH and height HEIGHT.

DRAW-FREETYPE-STRING (X Y STRING &KEY (ANTI-ALIASED T) (POINT-SIZE 12.0d0) (ANGLE 0.0d0) (CONVERT-CHARS T) LINE-SPACING (FONT-NAME *DEFAULT-FONT*) DO-NOT-DRAW (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws the string STRING in color COLOR at position (X,Y) using the FreeType library. FONT-NAME is the full path (a pathname or a string) to a TrueType font file, or a font face name if the GDFONTPATH environment variable or FreeType's DEFAULT_FONTPATH variable have been set intelligently. The string may be arbitrarily scaled (POINT-SIZE) and rotated (ANGLE in radians). The direction of rotation is counter-clockwise, with 0 radians (0 degrees) at 3 o'clock and PI/2 radians (90 degrees) at 12 o'clock. Note that the ANGLE argument is purposefully _not_ affected by WITH-TRANSFORMATION. If ANTI-ALIASED if false, anti-aliasing is disabled. It is enabled by default. To output multiline text with a specific line spacing, provide a value for LINE-SPACING, expressed as a multiple of the font height. The default is to use 1.05. The string may contain XML character entity references like "À". If CONVERT-CHARS is true (which is the default) characters of STRING with CHAR-CODE greater than 127 are converted accordingly. This of course pre-supposes that your Lisp's CHAR-CODE function returns ISO/IEC 10646 (Unicode) character codes. The return value is an array containing 8 elements representing the 4 corner coordinates (lower left, lower right, upper right, upper left) of the bounding rectangle around the string that was drawn. The points are relative to the text regardless of the angle, so "upper left" means in the top left-hand corner seeing the text horizontally. Set DO-NOT-DRAW to true to get the bounding rectangle without rendering. This is a relatively cheap operation if followed by a rendering of the same string, because of the caching of the partial rendering during bounding rectangle calculation.

DRAW-LINE (X1 Y1 X2 Y2 &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a line with color COLOR from point (X1,Y1) to point (X2,Y2).

DRAW-RECTANGLE (RECTANGLE &KEY FILLED (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a rectangle with upper left corner (X1,Y1) and lower right corner (X2,Y2) where RECTANGLE is the list (X1 Y1 X2 Y2). If FILLED is true the rectangle will be filled with COLOR, otherwise it will be outlined.

DRAW-RECTANGLE* (X1 Y1 X2 Y2 &KEY FILLED (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a rectangle with upper left corner (X1,Y1) and lower right corner (X2,Y2). If FILLED is true the rectangle will be filled with COLOR, otherwise it will be outlined.

DRAW-STRING (X Y STRING &KEY UP (FONT *DEFAULT-FONT*) (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws the string STRING in color COLOR at position (X,Y). If UP is true the character will be drawn from bottom to top (rotated 90 degrees). FONT must be one of :TINY, :SMALL, :MEDIUM, :LARGE, :GIANT.

FILL-IMAGE (X Y &KEY BORDER (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Floods a portion of the image IMAGE with the color COLOR beginning at point (X, Y) and extending into the surrounding region. If BORDER is true it must be a color and the filling will stop at the specified border color. Otherwise only points with the same color as the starting point will be colored.

FIND-COLOR (RED GREEN BLUE &KEY ALPHA EXACT HWB RESOLVE (IMAGE *DEFAULT-IMAGE*))

Tries to find and/or allocate a color from IMAGE's color palette. If EXACT is true, the color will only be returned if it is already allocated. If EXACT is NIL, a color which is 'close' to the color specified by RED, GREEN, and BLUE (and probably ALPHA) might be returned (unless there aren't any colors allocated in the image yet). If HWB is true, the 'closeness' will be determined by hue, whiteness, and blackness, otherwise by the Euclidian distance of the RGB values. If RESOLVE is true a color (probably a new one) will always be returned, otherwise the result of this function might be NIL. If ALPHA (not greater than 127) is provided, an RGBA color (or NIL) will be returned. ALPHA, EXACT, and HWB are mutually exclusive. RESOLVE can't be used together with EXACT or HWB.

FIND-COLOR-FROM-IMAGE (COLOR SOURCE-IMAGE &KEY ALPHA EXACT HWB RESOLVE (IMAGE *DEFAULT-IMAGE*))

Returns the color in IMAGE corresponding to COLOR in SOURCE-IMAGE. The keyword parameters are passed to FIND-COLOR.

GET-PIXEL (X Y &KEY (IMAGE *DEFAULT-IMAGE*))

Gets the color associated with point (X,Y).

IMAGE-WIDTH (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns width of IMAGE.

INTERLACEDP (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns whether IMAGE will be stored in an interlaced fashion.

SETFINTERLACEDP (INTERLACED &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Sets whether IMAGE will be stored in an interlaced fashion.

NUMBER-OF-COLORS (&KEY (IMAGE *DEFAULT-IMAGE*))

Returns the number of color allocated in IMAGE. Returns NIL if IMAGE is a true color image.

SAVE-ALPHA-P (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns whether PNG images will be saved with full alpha channel information.

SETFSAVE-ALPHA-P (SAVE &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Determines whether PNG images will be saved with full alpha channel information.

SET-CLIPPING-RECTANGLE* (X1 Y1 X2 Y2 &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Sets the clipping rectangle of IMAGE to be the rectangle with upper left corner (X1, Y1) and lower right corner (X2, Y2).

SET-PIXEL (X Y &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Draws a pixel with color COLOR at point (X,Y).

THICKNESS (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Gets the width of lines drawn by the drawing functions. Note that this is measured in pixels and is NOT affected by WITH-TRANSFORMATION.

SETFTHICKNESS (THICKNESS &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Sets the width of lines drawn by the drawing functions. Note that THICKNESS is measured in pixels and is NOT affected by WITH-TRANSFORMATION.

TRANSPARENT-COLOR (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns the transparent color of IMAGE (or NIL if there is none).

SETFTRANSPARENT-COLOR (COLOR &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Makes COLOR the transparent color of IMAGE. If COLOR is NIL the image won't have a transparent color. Note that JPEG images don't support transparency.

TRUE-COLOR-P (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns true iff IMAGE is a true color image.

TRUE-COLOR-TO-PALETTE (&KEY DITHER (COLORS-WANTED 256) (IMAGE *DEFAULT-IMAGE*))

Converts the true color image IMAGE to a palette-based image using a high-quality two-pass quantization routine. If DITHER is true, the image will be dithered to approximate colors better, at the expense of some obvious "speckling." COLORS-WANTED can be any positive integer up to 256 (which is the default). If the original source image includes photographic information or anything that came out of a JPEG, 256 is strongly recommended. 100% transparency of a single transparent color in the original true color image will be preserved. There is no other support for preservation of alpha channel or transparency in the destination image.

WRITE-GD-TO-STREAM (STREAM &KEY (IMAGE *DEFAULT-IMAGE*))

Writes image IMAGE to stream STREAM as GD. STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format yields faithful output of all 8-bit characters.

WRITE-GD2-TO-STREAM (STREAM &KEY (IMAGE *DEFAULT-IMAGE*))

Writes image IMAGE to stream STREAM as GD2. STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format yields faithful output of all 8-bit characters.

WRITE-GIF-TO-STREAM (STREAM &KEY (IMAGE *DEFAULT-IMAGE*))

Writes image IMAGE to stream STREAM as GIF. STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format yields faithful output of all 8-bit characters.

WRITE-IMAGE-TO-FILE (FILE-NAME &REST REST &KEY TYPE (IF-EXISTS ERROR) &ALLOW-OTHER-KEYS)

Writes image to the file specified by FILE-NAME (a pathname or a string). The TYPE argument is interpreted as in WRITE-IMAGE-TO-STREAM. If it is not provided it is guessed from the PATHNAME-TYPE of FILE-NAME. The IF-EXISTS keyword argument is given to OPEN. Other keyword argument like QUALITY or COMPRESSION-LEVEL can be provided depending on the images's type.

WRITE-IMAGE-TO-STREAM (STREAM TYPE &REST REST &KEY &ALLOW-OTHER-KEYS)

Writes image to STREAM. The type of the image is determined by TYPE which must be one of :JPG, :JPEG, :PNG, :WBMP, :GD, or :GD2. STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format yields faithful output of all 8-bit characters.

WRITE-JPEG-TO-STREAM (STREAM &KEY (QUALITY -1) (IMAGE *DEFAULT-IMAGE*))

Writes image IMAGE to stream STREAM as JPEG. If QUALITY is not specified, the default IJG JPEG quality value is used. Otherwise, for practical purposes, quality should be a value in the range 0-95. STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format is yields faithful output of all 8-bit characters.

WRITE-PNG-TO-STREAM (STREAM &KEY COMPRESSION-LEVEL (IMAGE *DEFAULT-IMAGE*))

Writes image IMAGE to stream STREAM as PNG. If COMPRESSION-LEVEL is not specified, the default compression level at the time zlib was compiled on your system will be used. Otherwise, a compression level of 0 means 'no compression', a compression level of 1 means 'compressed, but as quickly as possible', a compression level of 9 means 'compressed as much as possible to produce the smallest possible file.' STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format yields faithful output of all 8-bit characters.

WRITE-WBMP-TO-STREAM (STREAM &KEY FOREGROUND (IMAGE *DEFAULT-IMAGE*))

Writes image IMAGE to stream STREAM as WBMP. STREAM must be a character stream or a binary stream of element type (UNSIGNED-BYTE 8). If STREAM is a character stream, the user of this function has to make sure the external format yields faithful output of all 8-bit characters. WBMP file support is black and white only. The color index specified by the FOREGOUND argument is the "foreground," and only pixels of this color will be set in the WBMP file

Undocumented

IMAGE-HEIGHT (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

IMAGE-SIZE (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

MAKE-ANTI-ALIASED (COLOR &OPTIONAL DO-NOT-BLEND)

MAKE-BRUSH (IMAGE)

MAKE-TILE (IMAGE)

Private

BRUSH-IMG (INSTANCE)

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

COLOR (INSTANCE)

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

CONVERT-TO-CHAR-REFERENCES (STRING)

Returns a string where all characters of STRING with CHAR-CODE greater than 127 are converted to XML character entities.

CURRENT-BRUSH (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns the GD image which is the current brush of IMAGE (or NIL if there is no current brush).

SETFCURRENT-BRUSH (BRUSH &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Sets BRUSH (which must be a GD image) to be the current brush for IMAGE.

CURRENT-STYLE (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns the current style of IMAGE as a list.

CURRENT-STYLE* (&KEY (IMAGE *DEFAULT-IMAGE*))

Returns the current style of IMAGE as an array.

CURRENT-TILE (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Returns the GD image which is the current tile of IMAGE (or NIL if there is no current tile).

SETFCURRENT-TILE (TILE &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Sets TILE (which must be a GD image) to be the current tile for IMAGE.

DO-NOT-BLEND (INSTANCE)

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

IMG (INSTANCE)

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

LOAD-GD-GLUE

Load the little glue library we have to create for the image input functions.

RESOLVE-C-COLOR (COLOR IMAGE)

Accepts a CL-GD 'color' COLOR and returns the corresponding argument for GD, modifying internal slots of IMAGE if needed.

ROUND-TO-SIGNED-BYTE-32 (X)

Like ROUND but make sure result isn't longer than 32 bits.

SANS (PLIST &REST KEYS)

Returns PLIST with keyword arguments from KEYS removed.

SET-ANTI-ALIASED (COLOR DO-NOT-BLEND &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Set COLOR to be the current anti-aliased color of IMAGE. DO-NOT-BLEND (if provided) is the background color anti-aliased lines stand out against clearly.

TILE-IMG (INSTANCE)

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

Undocumented

%MAKE-ANTI-ALIASED (COLOR DO-NOT-BLEND)

%MAKE-BRUSH (IMG)

%MAKE-TILE (IMG)

ADD-IMAGE-TO-ANIMATION (IMAGE &KEY (LOCAL-COLOR-MAP-P NIL LOCAL-COLOR-MAP-PROVIDED-P) (LEFT-OFFSET 0) (TOP-OFFSET 0) (DELAY NIL DELAY-PROVIDED-P) (DISPOSAL NONE) LAST-IMAGE (ANIMATION *CURRENT-ANIMATION*))

ANTI-ALIASED-COLOR-P (OBJECT)

SETFBRUSH-IMG (NEW-VALUE INSTANCE)

BRUSH-P (OBJECT)

SETFCOLOR (NEW-VALUE INSTANCE)

SETFDO-NOT-BLEND (NEW-VALUE INSTANCE)

GD-FREE (PTR)

GD-IMAGE-ALPHA-BLENDING (IM BLENDING)

GD-IMAGE-ARC (IM CX CY W H S E COLOR)

GD-IMAGE-BOUNDS-SAFE (IM X Y)

GD-IMAGE-CHAR (IM F X Y C COLOR)

GD-IMAGE-CHAR-UP (IM F X Y C COLOR)

GD-IMAGE-COLOR-ALLOCATE (IM R G B)

GD-IMAGE-COLOR-ALLOCATE-ALPHA (IM R G B A)

GD-IMAGE-COLOR-CLOSEST (IM R G B)

GD-IMAGE-COLOR-CLOSEST-ALPHA (IM R G B A)

GD-IMAGE-COLOR-CLOSEST-HWB (IM R G B)

GD-IMAGE-COLOR-DEALLOCATE (IM COLOR)

GD-IMAGE-COLOR-EXACT (IM R G B)

GD-IMAGE-COLOR-RESOLVE (IM R G B)

GD-IMAGE-COLOR-RESOLVE-ALPHA (IM R G B A)

GD-IMAGE-COLOR-TRANSPARENT (IM COLOR)

GD-IMAGE-COMPARE (IM1 IM2)

GD-IMAGE-COPY (DST SRC DEST-X DEST-Y SRC-X SRC-Y W H)

GD-IMAGE-COPY-MERGE (DST SRC DEST-X DEST-Y SRC-X SRC-Y W H PERCENT)

GD-IMAGE-COPY-MERGE-GRAY (DST SRC DEST-X DEST-Y SRC-X SRC-Y W H PERCENT)

GD-IMAGE-COPY-RESAMPLED (DST SRC DST-X DST-Y SRC-X SRC-Y DEST-W DEST-H SRC-W SRC-H)

GD-IMAGE-COPY-RESIZED (DST SRC DST-X DST-Y SRC-X SRC-Y DEST-W DEST-H SRC-W SRC-H)

GD-IMAGE-COPY-ROTATED (DST SRC DST-X DST-Y SRC-X SRC-Y SRC-W SRC-H ANGLE)

GD-IMAGE-CREATE (SX SY)

GD-IMAGE-CREATE-FROM-GD-FILE (FILENAME ERR)

GD-IMAGE-CREATE-FROM-GD2-FILE (FILENAME ERR)

GD-IMAGE-CREATE-FROM-GD2-PART-FILE (FILENAME ERR SRC-X SRC-Y W H)

GD-IMAGE-CREATE-FROM-GIF-FILE (FILENAME ERR)

GD-IMAGE-CREATE-FROM-JPEG-FILE (FILENAME ERR)

GD-IMAGE-CREATE-FROM-PNG-FILE (FILENAME ERR)

GD-IMAGE-CREATE-FROM-XBM-FILE (FILENAME ERR)

GD-IMAGE-CREATE-FROM-XPM (FILENAME)

GD-IMAGE-CREATE-TRUE-COLOR (SX SY)

GD-IMAGE-DESTROY (IM)

GD-IMAGE-FILL (IM X Y COLOR)

GD-IMAGE-FILL-TO-BORDER (IM X Y BORDER COLOR)

GD-IMAGE-FILLED-ARC (IM CX CY W H S E COLOR STYLE)

GD-IMAGE-FILLED-ELLIPSE (IM CX CY W H COLOR)

GD-IMAGE-FILLED-POLYGON (IM POINTS POINTS-TOTAL COLOR)

GD-IMAGE-FILLED-RECTANGLE (IM X1 Y1 X2 Y2 COLOR)

GD-IMAGE-GD-PTR (IM SIZE)

GD-IMAGE-GD2-PTR (IM SIZE)

GD-IMAGE-GET-ALPHA (IM COLOR)

GD-IMAGE-GET-BLUE (IM COLOR)

GD-IMAGE-GET-CLIP (IM X1P Y1P X2P Y2P)

GD-IMAGE-GET-COLORS-TOTAL (IM)

GD-IMAGE-GET-GREEN (IM COLOR)

GD-IMAGE-GET-INTERLACED (IM)

GD-IMAGE-GET-PIXEL (IM X Y)

GD-IMAGE-GET-RED (IM COLOR)

GD-IMAGE-GET-SX (IM)

GD-IMAGE-GET-SY (IM)

GD-IMAGE-GET-TRANSPARENT (IM)

GD-IMAGE-GIF-ANIM-ADD (IM OUT LOCAL-CM LEFT-OFS TOP-OFS DELAY DISPOSAL PREVIM)

GD-IMAGE-GIF-ANIM-BEGIN-WRAP (IM FILENAME GLOBAL-CM LOOPS)

GD-IMAGE-GIF-ANIM-END-WRAP (OUT)

GD-IMAGE-GIF-PTR (IM SIZE)

GD-IMAGE-INTERLACE (IM INTERLACE)

GD-IMAGE-JPEG-PTR (IM SIZE QUALITY)

GD-IMAGE-LINE (IM X1 Y1 X2 Y2 COLOR)

GD-IMAGE-PALETTE-COPY (DST SRC)

GD-IMAGE-PNG-PTR (IM SIZE)

GD-IMAGE-PNG-PTR-EX (IM SIZE LEVEL)

GD-IMAGE-POLYGON (IM POINTS POINTS-TOTAL COLOR)

GD-IMAGE-RECTANGLE (IM X1 Y1 X2 Y2 COLOR)

GD-IMAGE-SAVE-ALPHA (IM SAVE-FLAG)

GD-IMAGE-SET-ANTI-ALIASED (IM C)

GD-IMAGE-SET-ANTI-ALIASED-DO-NOT-BLEND (IM C DONT-BLEND)

GD-IMAGE-SET-BRUSH (IM BRUSH)

GD-IMAGE-SET-CLIP (IM X1 Y1 X2 Y2)

GD-IMAGE-SET-PIXEL (IM X Y COLOR)

GD-IMAGE-SET-STYLE (IM STYLE STYLE-LENGTH)

GD-IMAGE-SET-THICKNESS (IM THICKNESS)

GD-IMAGE-SET-TILE (IM TILE)

GD-IMAGE-STRING (IM F X Y S COLOR)

GD-IMAGE-STRING-FT (IM BRECT FG FONTNAME PTSIZE ANGLE X Y STRING)

GD-IMAGE-STRING-FT-EX (IM BRECT FG FONTNAME PTSIZE ANGLE X Y STRING STREX)

GD-IMAGE-STRING-UP (IM F X Y S COLOR)

GD-IMAGE-TRUE-COLOR-TO-PALETTE (IM DITHER COLORS-WANTED)

GD-IMAGE-WBMP-PTR (IM SIZE FG)

HYPERDOC-LOOKUP (SYMBOL TYPE)

IMAGE-P (OBJECT)

SETFIMG (NEW-VALUE INSTANCE)

MAKE-IMAGE (IMG)

SETFTILE-IMG (NEW-VALUE INSTANCE)

TILE-P (OBJECT)

MACRO

Public

WITH-CLIPPING-RECTANGLE ((RECTANGLE &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Executes BODY with the clipping rectangle of IMAGE set to RECTANGLE which should be a list (X1 Y1 X2 Y2). The previous clipping rectangle is guaranteed to be restored before the macro exits.

WITH-CLIPPING-RECTANGLE* ((X1 Y1 X2 Y2 &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Executes BODY with the clipping rectangle of IMAGE set to the rectangle with upper left corner (X1, Y1) and lower right corner (X2, Y2). The previous clipping rectangle is guaranteed to be restored before the macro exits.

WITH-DEFAULT-COLOR ((COLOR) &BODY BODY)

Executes BODY with *DEFAULT-COLOR* bound to COLOR so that you don't have to provide the COLOR keyword/optional argument to drawing functions.

WITH-DEFAULT-FONT ((FONT) &BODY BODY)

Execute BODY with *DEFAULT-FONT* bound to FONT so that you don't have to provide the FONT keyword/optional argument to string functions. But note that the fonts used for DRAW-STRING/DRAW-CHARACTER and DRAW-FREETYPE-STRING are incompatible.

WITH-DEFAULT-IMAGE ((IMAGE) &BODY BODY)

Executes BODY with *DEFAULT-IMAGE* bound to IMAGE so that you don't have to provide the IMAGE keyword/optional argument to CL-GD functions.

WITH-IMAGE ((NAME WIDTH HEIGHT &OPTIONAL TRUE-COLOR) &BODY BODY)

Creates an image with size WIDTH x HEIGHT, and executes BODY with the image bound to NAME. If TRUE-COLOR is true, creates a true color image. The image is guaranteed to be destroyed before this macro exits.

WITH-IMAGE* ((WIDTH HEIGHT &OPTIONAL TRUE-COLOR) &BODY BODY)

Creates an image with size WIDTH x HEIGHT and executes BODY with the image bound to *DEFAULT-IMAGE*. If TRUE-COLOR is true, creates a true color image. The image is guaranteed to be destroyed before this macro exits.

WITH-IMAGE-FROM-FILE ((NAME FILE-NAME &OPTIONAL TYPE) &BODY BODY)

Creates an image from the file specified by FILE-NAME (which is either a pathname or a string) and executes BODY with the image bound to NAME. The type of the image can be provied as TYPE or otherwise it will be guessed from the PATHNAME-TYPE of FILE-NAME. The image is guaranteed to be destroyed before this macro exits.

WITH-IMAGE-FROM-FILE* ((FILE-NAME &OPTIONAL TYPE) &BODY BODY)

Creates an image from the file specified by FILE-NAME (which is either a pathname or a string) and executes BODY with the image bound to *DEFAULT-IMAGE*. The type of the image can be provied as TYPE or otherwise it will be guessed from the PATHNAME-TYPE of FILE-NAME. The image is guaranteed to be destroyed before this macro exits.

WITH-IMAGE-FROM-GD2-PART ((NAME FILE-NAME SRC-X SRC-Y WIDTH HEIGHT) &BODY BODY)

Creates an image from the part of the GD2 file FILE-NAME (which is either a pathname or a string) specified SRC-X, SRC-Y, WIDTH, and HEIGHT and executes BODY with the image bound to NAME. The type of the image can be provied as TYPE or otherwise it will be guessed from the PATHNAME-TYPE of FILE-NAME. The image is guaranteed to be destroyed before this macro exits.

WITH-IMAGE-FROM-GD2-PART* ((FILE-NAME SRC-X SRC-Y WIDTH HEIGHT) &BODY BODY)

Creates an image from the part of the GD2 file FILE-NAME (which is either a pathname or a string) specified SRC-X, SRC-Y, WIDTH, and HEIGHT and executes BODY with the image bound to *DEFAULT-IMAGE*. The type of the image can be provied as TYPE or otherwise it will be guessed from the PATHNAME-TYPE of FILE-NAME. The image is guaranteed to be destroyed before this macro exits.

WITH-THICKNESS ((THICKNESS &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Executes BODY with the current line width of IMAGE set to THICKNESS. The image's previous line width is guaranteed to be restored before the macro exits. Note that the line width is measured in pixels and is not affected by WITH-TRANSFORMATION.

WITH-TRANSFORMATION ((&KEY (X1 0 X1SET) (X2 0 X2SET) (WIDTH 0 WSET) (Y1 0 Y1SET) (Y2 0 Y2SET) (HEIGHT 0 HSET) REVERSE-X REVERSE-Y (RADIANS T) (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Executes BODY such that all points and width/height data are subject to a simple affine transformation defined by the keyword parameters. The new x-axis of IMAGE will start at X1 and end at X2 and have length WIDTH. The new y-axis of IMAGE will start at Y1 and end at Y2 and have length HEIGHT. In both cases it suffices to provide two of the three values - if you provide all three they have to match. If REVERSE-X is false the x-axis will be oriented as usual in Cartesian coordinates, otherwise its direction will be reversed. The same applies to REVERSE-Y, of course. If RADIANS is true angles inside of BODY will be assumed to be provided in radians, otherwise in degrees.

WITHOUT-TRANSFORMATIONS (&BODY BODY)

Executes BODY without any transformations applied.

Undocumented

DO-PIXELS ((&OPTIONAL (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

DO-ROWS ((Y-VAR &OPTIONAL (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Private

MAKE-STREAM-FN (NAME SIGNATURE GD-CALL TYPE-CHECKS DOCSTRING)

Internal macro used to generate WRITE-JPEG-TO-STREAM and friends.

WITH-COLOR-ARGUMENT (&BODY BODY)

Internal macro used to give correct color arguments to enclosed foreign functions. Assumes fixed names COLOR and IMAGE.

WITH-REBINDING (BINDINGS &BODY BODY)

REBINDING ( { var | (var prefix) }* ) form* Evaluates a series of forms in the lexical environment that is formed by adding the binding of each VAR to a fresh, uninterned symbol, and the binding of that fresh, uninterned symbol to VAR's original value, i.e., its value in the current lexical environment. The uninterned symbol is created as if by a call to GENSYM with the string denoted by PREFIX - or, if PREFIX is not supplied, the string denoted by VAR - as argument. The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).

WITH-TRANSFORMED-ALTERNATIVE ((&REST TRANSFORMATIONS) &BODY BODY)

Internal macro used to make functions transformation-aware. TRANSFORMATION is a list of (EXPR TRANSFORMATION) pairs where each EXPR will be replaced by the transformation denoted by TRANSFORMATION.

WITH-UNIQUE-NAMES ((&REST BINDINGS) &BODY BODY)

Syntax: WITH-UNIQUE-NAMES ( { var | (var x) }* ) declaration* form* Executes a series of forms with each VAR bound to a fresh, uninterned symbol. The uninterned symbol is as if returned by a call to GENSYM with the string denoted by X - or, if X is not supplied, the string denoted by VAR - as argument. The variable bindings created are lexical unless special declarations are specified. The scopes of the name bindings and declarations do not include the Xs. The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).

Undocumented

WITH-ANIMATED-GIF ((FILENAME &KEY (BACKGROUND-IMAGE '*DEFAULT-IMAGE*) GLOBAL-COLOR-MAP-P (LOOP-COUNT -1) (ANIMATION '*CURRENT-ANIMATION*) DEFAULT-DELAY) &BODY BODY)

WITH-SAFE-ALLOC ((VAR ALLOC FREE) &REST BODY)

GENERIC-FUNCTION

Public

DRAW-POLYGON (VERTICES &KEY FILLED START END COLOR IMAGE (IMAGE *DEFAULT-IMAGE*) (COLOR *DEFAULT-COLOR*) (END (LENGTH VERTICES)) (START 0))

Draws a polygon with the VERTICES (at least three) specified as a list (x1 y1 x2 y2 ...) or as a vector #(x1 y1 x2 y2 ...). If FILLED is true the polygon will be filled with COLOR, otherwise it will be outlined. If START and/or END are specified then only the corresponding part of VERTICES is used as input.

SET-PIXELS (POINTS &KEY COLOR IMAGE (IMAGE *DEFAULT-IMAGE*) (COLOR *DEFAULT-COLOR*))

Draws a list (X1 Y1 X2 Y2 ...) or vector #(X1 Y1 X2 Y2 ...) of pixels.

Private

SETFCURRENT-STYLE (STYLE &OPTIONAL IMAGE)

Sets STYLE to be the current drawing style for IMAGE. STYLE can be a LIST or a VECTOR. Each element of STYLE is either a color or NIL (for transparent pixels).

SLOT-ACCESSOR

Private

Undocumented

ANGLE-TRANSFORMER (OBJECT)

H-INV-TRANSFORMER (OBJECT)

H-TRANSFORMER (OBJECT)

IMAGE (OBJECT)

W-INV-TRANSFORMER (OBJECT)

W-TRANSFORMER (OBJECT)

X-INV-TRANSFORMER (OBJECT)

X-TRANSFORMER (OBJECT)

Y-INV-TRANSFORMER (OBJECT)

Y-TRANSFORMER (OBJECT)

VARIABLE

Public

*DEFAULT-COLOR*

The default color. This special variable is usually bound by WITH-COLOR.

*DEFAULT-FONT*

The default font. This special variable is usually bound by WITH-FONT.

*DEFAULT-IMAGE*

The default image. This special variable is usually bound by WITH-IMAGE or WITH-IMAGE-FROM-FILE.

Private

*GD-SUPPORTING-LIBRARIES*

The libraries which are needed by cl-gd-glues.so (and GD itself). Only needed for Python-based Lisps like CMUCL, SBCL, or SCL.

*NULL-IMAGE*

A 'null' image which might be useful for DRAW-FREETYPE-STRING.

*SHARED-LIBRARY-DIRECTORIES*

A list of directories where UFFI tries to find cl-gd-glue.so

*SHARED-LIBRARY-DRIVE-LETTERS*

The list of drive letters (used by Wintendo) used when looking for cl-gd-glue.dll.

*SHARED-LIBRARY-TYPES*

The list of types a shared library can have. Used when looking for cl-gd-glue.so

*TRANSFORMERS*

Stack of currently active transformer objects.

Undocumented

*HYPERDOC-BASE-URI*

CLASS

Private

TRANSFORMER

Class used internally for WITH-TRANSFORMATION macro.

Undocumented

ANTI-ALIASED-COLOR

BRUSH

IMAGE (OBJECT)

TILE

CONSTANT

Public

+MAX-COLORS+

Maximum number of colors for palette-based images.

Private

+ANTI-ALIASED+

Special 'color' for anti-aliased lines.

+BRUSHED+

Special 'color' for lines drawn with brush.

+GD-CHORD+

Used internally by GD-FILLED-ARC

+GD-CMP-BACKGROUND+

Background color is different.

+GD-CMP-COLOR+

Image colors differ.

+GD-CMP-IMAGE+

Images will appear different when displayed.

+GD-CMP-INTERLACE+

Interlace settings are different.

+GD-CMP-NUM-COLORS+

Number of colors in palette differ.

+GD-CMP-SIZE-X+

Image widths differ.

+GD-CMP-SIZE-Y+

Image heights differ.

+GD-CMP-TRANSPARENT+

Transparent color is different.

+GD-CMP-TRUE-COLOR+

One image is a true-color image, the other one is palette-based.

+GD-EDGED+

Used internally by GD-FILLED-ARC

+GD-FTEX-LINESPACE+

Indicate line-spacing for FreeType library.

+GD-NO-FILL+

Used internally by GD-FILLED-ARC

+MOST-POSITIVE-UNSIGNED-BYTE-32+

Name says it all...

+RADIANS-TO-DEGREE-FACTOR+

Factor to convert from radians to degrees.

+STYLED+

Special 'color' for styled lines.

+STYLED-BRUSHED+

Special 'color' for lines drawn with styled brush.

+TILED+

Special fill 'color' used for tiles.

+TRANSPARENT+

Special 'color' used in GD function 'gdImageSetStyle' for transparent color.

Undocumented

+GD-DISPOSAL-NONE+

+GD-DISPOSAL-RESTORE-BACKGROUND+

+GD-DISPOSAL-RESTORE-PREVIOUS+

+GD-DISPOSAL-UNKNOWN+