Abstract
LISPBUILDER-SDL-GFX provides a Lisp wrapper for the SDL_gfx library, and provides support for renering several graphics primitives directly to SDL surfaces. LISPBUILDER-SDL-GFX has a dependency on the LISPBUILDER-SDL package. LISPBUILDER-SDL-GFX is distributed under the MIT-style license.
Current Version: The current version of LISPBUILDER-SDL-GFX is version 0.2.
Functions and symbols exported from the LISPBUILDER-SDL-GFX package are
accessible from the LISPBUILDER-SDL-GFX:
prefix or the
shorter form SDL-GFX:
nickname.
This example was created with the following code:
(defun width-height () (let ((width 200) (height 200)) (sdl:with-init () (sdl:window width height :title-caption "Width and Height, from Processing.org") (sdl:clear-display (sdl:color :r 127 :g 127 :b 127)) (loop for i from 0 to height by 20 do (progn (sdl-gfx:draw-box (sdl:rectangle :x 0 :y i :w 200 :h 10) :color sdl:*black*) (sdl-gfx:draw-box (sdl:rectangle :x i :y 0 :w 10 :h 200) :color sdl:*white*))) (sdl:with-events () (:quit-event () t) (:video-expose-event () (sdl:update-display))))))
*default-font*
*font-10x20*
*font-5x7*
*font-5x8*
*font-6x10*
*font-6x12*
*font-6x13*
*font-6x13b*
*font-6x13o*
*font-6x9*
*font-7x13*
*font-7x13b*
*font-7x13o*
*font-7x14*
*font-7x14b*
*font-8x13*
*font-8x13b*
*font-8x13o*
*font-8x8*
*font-9x15*
*font-9x15b*
*font-9x18*
*font-9x18b*
draw-aa-circle
draw-aa-circle-*
draw-aa-ellipse
draw-aa-ellipse-*
draw-aa-line
draw-aa-line-*
draw-aa-polygon
draw-aa-trigon
draw-bezier
draw-box
draw-box-*
draw-character-shaded
draw-character-shaded-*
draw-character-solid
draw-character-solid-*
draw-circle
draw-circle-*
draw-curve
draw-ellipse
draw-ellipse-*
draw-filled-circle
draw-filled-circle-*
draw-filled-ellipse
draw-filled-ellipse-*
draw-filled-pie
draw-filled-pie-*
draw-filled-polygon
draw-filled-trigon
draw-font
draw-font
draw-font-at
draw-font-at-*
draw-hline
draw-line
draw-line-*
draw-pie
draw-pie-*
draw-pixel
draw-pixel-*
draw-polygon
draw-rectangle
draw-rectangle-*
draw-shape
draw-string-shaded
draw-string-shaded-*
draw-string-solid
draw-string-solid-*
draw-trigon
draw-vline
font
font-height
font-width
free-font
initialise-default-font
initialise-font
render-string-shaded
render-string-solid
roto-zoom-size
roto-zoom-size-xy
roto-zoom-xy
set-default-font
with-bezier
with-curve
with-shape
zoom-surface
zoom-surface-size
The following table describes the status of the Lisp implementations that have been tested with LISPBUILDER-SDL-GFX:
Lisp Implementation | LISPBUILDER-SDL-GFX Status | Comments | ||
---|---|---|---|---|
Win32 | Linux | MacOS | ||
CLISP v2.38 | Working | Working | No | |
Lispworks v4.4.6 Personal | Working | Working | No | |
Allegro Express 8.0 | Unknown | Unknown | No | |
OpenMCL | NA | NA | Unknown | |
SBCL | Working | Working | No |
svn co https://lispbuilder.svn.sourceforge.net/svnroot/lispbuilder lispbuilder
See the LISPBUILDER documentation for installation instructions.
See the LISPBUILDER documentation for Usage instructions.
Enter the following at the REPL to load the examples included in the LISPBUILDER-SDL-GFX-EXAMPLES package:
(asdf:operate 'asdf:load-op :lispbuilder-sdl-gfx-examples)
Run the examples by entering any of the following at the REPL:
LISPBUILDER-SDL-GFX has a dependency on LISPBUILDER-SDL.
LISPBUILDER-SDL-GFX is distributed under the MIT-style license.
[Special variable]
*default-font*
When a LISPBUILDER-SDL-GFX function or macro has an
OPTIONAL
orKEY
word argumentFONT
, the default action is to bind to*DEFAULT-FONT*
.*DEFAULT-FONT*
is set toNIL
initially. A font must be initialized by calling INITIALISE-DEFAULT-FONT prior to use.
[Special variable]
*font-10x20*
Contains the font data for an 10x20 bitmap font.
[Special variable]
*font-5x7*
Contains the font data for an 5x7 bitmap font.
[Special variable]
*font-5x8*
Contains the font data for an 5x8 bitmap font.
[Special variable]
*font-6x10*
Contains the font data for an 6x10 bitmap font.
[Special variable]
*font-6x12*
Contains the font data for an 6x12 bitmap font.
[Special variable]
*font-6x13*
Contains the font data for an 6x13 bitmap font.
[Special variable]
*font-6x13b*
Contains the font data for an 6x13 bitmap font.
[Special variable]
*font-6x13o*
Contains the font data for an 6x13 bitmap font.
[Special variable]
*font-6x9*
Contains the font data for an 6x9 bitmap font.
[Special variable]
*font-7x13*
Contains the font data for an 7x13 bitmap font.
[Special variable]
*font-7x13b*
Contains the font data for an 7x13 bitmap font.
[Special variable]
*font-7x13o*
Contains the font data for an 7x13 bitmap font.
[Special variable]
*font-7x14*
Contains the font data for an 7x14 bitmap font.
[Special variable]
*font-7x14b*
Contains the font data for an 7x14 bitmap font.
[Special variable]
*font-8x13*
Contains the font data for an 8x13 bitmap font.
[Special variable]
*font-8x13b*
Contains the font data for an 8x13 bitmap font.
[Special variable]
*font-8x13o*
Contains the font data for an 8x13 bitmap font.
[Special variable]
*font-8x8*
Contains the font data for an 8x8 bitmap font.
[Special variable]
*font-9x15*
Contains the font data for an 9x15 bitmap font.
[Special variable]
*font-9x15b*
Contains the font data for an 9x15 bitmap font.
[Special variable]
*font-9x18*
Contains the font data for an 9x18 bitmap font.
[Special variable]
*font-9x18b*
Contains the font data for an 9x18 bitmap font.
[Function]
draw-aa-circle p1 r &key surface color => result
See DRAW-AA-CIRCLE-*.
Parameters
P1
is the X/Y coordinate of the center of the antialiased circle, of typeSDL:POINT
.
[Function]
draw-aa-circle-* x y r &key surface color => result
Draws the circumference of a circle of color COLOR to the surface SURFACE using anti-aliasing. Use DRAW-FILLED-CIRCLE-* to draw a filled circle.
Parameters
X
andY
specify the center coordinate of the circle, of typeINTEGER
.R
is the circle radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-aa-ellipse p1 rx ry &key surface color => result
See DRAW-AA-ELLIPSE-*.
Parameters
P1
is the X/Y coordinate of the center of the ellipse, of typeSDL:POINT
.
[Function]
draw-aa-ellipse-* x y rx ry &key surface color => result
Draws the circumference of an ellipse of color COLOR to the surface SURFACE using anti-aliasing. Use DRAW-FILLED-ELLIPSE-* to draw a filled ellipse.
Parameters
X
andY
specify the center coordinate of the ellipse, of typeINTEGER
.RX
andRY
specify the ellipse radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-aa-line point1 point2 &key surface color => result
See DRAW-AA-LINE-*-*
Parameters
POINT1
andPOINT2
are the start and end x/y co-ordinates of the line, of typeSDL:POINT
.
[Function]
draw-aa-line-* x1 y1 x2 y2 &key surface color => result
Draws an antialiased line of color
COLOR
to the surfaceSURFACE
.Parameters
X1
Y1
are the start X/Y coordinates of the line, of typeINTEGER
.X2
Y2
are the end X/Y coordinates of the line, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-aa-polygon points &key surface color => result
Draw the circumference of a polygon of color
COLOR
to surface SURFACE using the vertices inPOINTS
. The polygon is anti-aliased. Use DRAW-FILLED-POLYGON-* to draw a filled polygon.Parameters
POINTS
is the list of vertices of typeSDL:POINT
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-aa-trigon point1 point2 point3 &key surface color => result
Draw the outline of a trigon or triangle, of color
COLOR
to surfaceSURFACE
using anti-aliasing. Use DRAW-FILLED-TRIGON-* to draw a filled trigon.Parameters
POINT1
,POINT2
andPOINT3
specify the vertices of the trigon, of typeSDL:POINT
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-bezier points steps &key surface color => result
Draw a bezier curve of color
COLOR
to the surfaceSURFACE
. The shape of the Bezier curve is defined by several control points. A control point is a vertex containing an X and Y coordinate pair.Parameters
POINTS
is the list of control points of typeSDL:POINT
.STEPS
is the number of segments used to draw the Bezier curve. The greater the number of segments, the smoother the Bezier curve.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.Example
(DRAW-BEZIER (LIST (SDL:POINT :X 60 :Y 40) (SDL:POINT :X 160 :Y 10) (SDL:POINT :X 170 :Y 150) (SDL:POINT :X 60 :Y 150)) 10)
[Function]
draw-box rect &key surface color => result
See DRAW-BOX-*.
Parameters
RECT
is the rectangle to fill, of typeSDL:RECTANGLE
.
[Function]
draw-box-* x y w h &key surface color => result
Draws a filled rectangle of color
COLOR
to surfaceSURFACE
.Parameters
X
andY
are theINTEGER
coordinates of the top-left corner of the rectangle.W
andH
are the width and height of the rectangle, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-character-shaded c p1 fg-color bg-color &key font surface => result
Parameters
P1
is the x and y position to render the character, of typeSDL:POINT
.
[Function]
draw-character-shaded-* c x y fg-color bg-color &key font surface => result
Draw the character
C
at locationX
Y
using fontFONT
with text colorFG-COLOR
and background colorBG-COLOR
onto surfaceSURFACE
. The surface background is filled withBG-COLOR
so the surface cannot be keyed over other surfaces.
C
is the character to render.X
andY
are the x and y position coordinates, asINTEGERS
.FG-COLOR
color is the character color, of type SDL:SDL-COLORBG-COLOR
color is the background color used to fill the surfaceSURFACE
, of type SDL:SDL-COLORFONT
is the font face used to render the character. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.Returns
- Returns the font
FONT
.Example
(DRAW-CHARACTER-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR :SURFACE A-SURFACE)
[Function]
draw-character-solid c p1 &key font surface color => result
Parameters
P1
is the x and y position to render the character, of typeSDL:POINT
.
[Function]
draw-character-solid-* c x y &key font surface color => result
Draw character
C
at locationX
Y
using fontFONT
with text colorCOLOR
onto surfaceSURFACE
. The character is keyed onto SURFACE.Parameters
C
is the character to render.X
andY
are the x and y position coordinates, asINTEGERS
.FONT
is the font face used to render the character. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
color is the character color, of typeSDL:SDL-COLOR
.Returns
- Returns the font
FONT
.Example
(DRAW-CHARACTER-SOLID-* "Hello World!" 0 0 :SURFACE A-SURFACE :COLOR A-COLOR)
[Function]
draw-circle p1 r &key surface color => result
See DRAW-CIRCLE-*.
Parameters
P1
is the X/Y coordinate of the center of the circle, of typeSDL:POINT
.
[Function]
draw-circle-* x y r &key surface color => result
Draws a circle circumference of color
COLOR
to the surfaceSURFACE
. Use DRAW-FILLED-CIRCLE-* to draw a filled circle.Parameters
X
andY
specify the center coordinate of the circle, of typeINTEGER
.R
is the circle radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-curve points type segments &key surface color => result
Draw a Cattmul-Rom spline using color
COLOR
to the surfaceSURFACE
. The shape of the curve is defined by waypoints. A waypoint is a vertex containing an X and Y coordinate pair.Parameters
POINTS
is a list of waypoints or vetices for the spline, of typeSDL:POINT
TYPE
describes the line style used to draw the curve and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SEGMENTS
is the number of segments used to draw the Catmull-Rom spline. Default is 10 segments if unspecified. The greater the number of segments, the smoother the spline.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.Example
(DRAW-CURVE (LIST (SDL:POINT :X 60 :Y 40) (SDL:POINT :X 160 :Y 10) (SDL:POINT :X 170 :Y 150) (SDL:POINT :X 60 :Y 150)) :LINE-STRIP 10)
[Function]
draw-ellipse p1 rx ry &key surface color => result
See DRAW-ELLIPSE-*.
Parameters
P1
is the X/Y coordinate of the center of the ellipse, of typeSDL:POINT
.
[Function]
draw-ellipse-* x y rx ry &key surface color => result
Draws an ellipse circumference of color
COLOR
to the surfaceSURFACE
. Use DRAW-FILLED-ELLIPSE-* to draw a filled ellipse.Parameters
X
andY
specify the center coordinate of the ellipse, of typeINTEGER
.RX
andRY
specify the ellipse radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-filled-circle p1 r &key surface color => result
See DRAW-FILLED-CIRCLE-*.
Parameters
P1
is the X/Y coordinate of the center of the filled circle, of typeSDL:POINT
.
[Function]
draw-filled-circle-* x y r &key surface color => result
Draws a filled circle of color
COLOR
to the surfaceSURFACE
.Parameters
X
andY
specify the center coordinate of the circle, of typeINTEGER
.R
is the circle radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-filled-ellipse p1 rx ry &key surface color => result
Parameters
P1
is the X/Y coordinate of the center of the filled ellipse, of typeSDL:POINT
.
[Function]
draw-filled-ellipse-* x y rx ry &key surface color => result
Draws a filled ellipse of color
COLOR
to the surfaceSURFACE
.Parameters
X
andY
specify the center coordinate of the ellipse, of typeINTEGER
.RX
andRY
specify the ellipse radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-filled-pie p1 rad start end &key surface color => result
See DRAW-FILLED-PIE-*.
Parameters
P1
is the X/Y coordinate of the center of the filled pie, of typeSDL:POINT
.
[Function]
draw-filled-pie-* x y rad start end &key surface color => result
Draws a filled pie of color
COLOR
to the surfaceSURFACE
.Parameters
X
andY
specify the center coordinate of the pie, of typeINTEGER
.RAD
is the pie radius, of typeINTEGER
.START
is the pie start, of typeINTEGER
.END
is the pie end, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-filled-polygon points &key surface color => result
Draw a filled polygon, of color
COLOR
to surfaceSURFACE
.Parameters
POINTS
is the list of vertices of typeSDL:POINT
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-filled-trigon point1 point2 point3 &key surface color => result
Draw a filled trigon, of color
COLOR
to surfaceSURFACE
.Parameters
POINT1
,POINT2
andPOINT3
specify the vertices of the trigon, of typeSDL:POINT
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Generic function]
draw-font &key font surface => result
Blit the cached SURFACE in FONT to the destination surface SURFACE. The cached surface is created during a previous call to any of the DRAW-STRING* functions. Uses POSITION in the cached SURFACE to render to the X/Y coordinates on the destination SURFACE.
This function can speed up blitting when the text remains unchanged between screen updates.
[Function]
draw-font &key font surface => result
[Generic function]
draw-font-at position &key font surface => result
See DRAW-FONT. POINT is used to position the cached SURFACE, where POINT is of type SDL:POINT.
[Method]
draw-font-at position &key font surface => result
[Generic function]
draw-font-at-* x y &key font surface => result
See DRAW-FONT. X and Y are used to position the cached SURFACE, where X and Y are INTEGERS.
[Method]
draw-font-at-* x y &key font surface => result
[Function]
draw-hline x1 x2 y &key surface color => result
Draw a horizontal line of color
COLOR
fromX1
toX2
throughY
onto the surfaceSURFACE
.Parameters
X1
andX2
are the horizontal start and end points of the line, of typeINTEGER
.Y
is the verticalINTEGER
coordinate that the horizontal line must intersect.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-line point1 point2 &key surface color => result
See DRAW-LINE-*.
Parameters
POINT1
andPOINT2
are the start and end x/y co-ordinates of the line, of typeSDL:POINT
.
[Function]
draw-line-* x1 y1 x2 y2 &key surface color => result
Draws a line of color
COLOR
to the surfaceSURFACE
.Parameters
X1
Y1
are the start X/Y coordinates of the line, of typeINTEGER
.X2
Y2
are the end X/Y coordinates of the line, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-pie p1 rad start end &key surface color => result
See DRAW-PIE-*.
Parameters
P1
is the X/Y coordinate of the center of the pie, of typeSDL:POINT
.
[Function]
draw-pie-* x y rad start end &key surface color => result
Draws a pie of color
COLOR
to the surfaceSURFACE
. Use DRAW-FILLED-PIE-* to draw a filled pie.Parameters
X
andY
specify the center coordinate of the pie, of typeINTEGER
.RAD
is the pie radius, of typeINTEGER
.START
is the pie start, of typeINTEGER
.END
is the pie end, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-pixel position &key surface color => result
See DRAW-PIXEL-*.
Parameters
POSITION
is the X/Y coordinate of the pixel, of typeSDL:POINT
.
[Function]
draw-pixel-* x y &key surface color => result
Draw a single pixel of color
COLOR
to the surfaceSURFACE
at the specifiedX
andY
coordiates.Parameters
X
andY
specify the coordinates of the pixel, and are of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the pixel color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-polygon points &key surface color => result
Draw the circumference of a polygon of color
COLOR
to surface SURFACE using the vertices inPOINTS
. Use DRAW-FILLED-POLYGON-* to draw a filled polygon.Parameters
POINTS
is the list of vertices for the polygon.POINTS
is a list ofSDL:POINT
s.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-rectangle rect &key surface color => result
See DRAW-RECTANGLE-*.
Parameters
RECT
is the rectangle to draw, of typeSDL:RECTANGLE
.
[Function]
draw-rectangle-* x y w h &key surface color => result
Draw a rectangle outline of color
COLOR
to the surfaceSURFACE
.Parameters
X
andY
are theINTEGER
coordinates of the top-left corner of the rectangle.W
andH
are the width and height of the rectangle, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-shape points type &key surface color => result
Draw a polygon of color
COLOR
to the surfaceSURFACE
using the vertices inPOINTS
.Parameters
POINTS
is a list of vertices, of typeSDL:POINT
TYPE
describes the line style used to draw the polygon and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.Example
(DRAW-SHAPE (LIST (SDL:POINT :X 60 :Y 40) (SDL:POINT :X 160 :Y 10) (SDL:POINT :X 170 :Y 150) (SDL:POINT :X 60 :Y 150)) :LINE-STRIP)
[Function]
draw-string-shaded c p1 fg-color bg-color &key font surface => result
See DRAW-STRING-SHADED-*.
Parameters
P1
is the x and y position to render the text, of typeSDL:POINT
.
[Function]
draw-string-shaded-* c x y fg-color bg-color &key font surface => result
Draw text
C
using at locationX
Y
using fontFONT
with text colorFG-COLOR
and background colorBG-COLOR
onto surfaceSURFACE
. The surface background is filled withBG-COLOR
so the surface cannot be keyed over other surfaces.
C
is the text to render.X
andY
are the x and y position coordinates, asINTEGERS
.FG-COLOR
color is the text color, of type SDL:SDL-COLORBG-COLOR
color is the background color used to fill the surfaceSURFACE
, of type SDL:SDL-COLORFONT
is the font face used to render the text. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.Returns
- Returns the font
FONT
.Example
(DRAW-STRING-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR :SURFACE A-SURFACE)
[Function]
draw-string-solid c p1 &key font surface color => result
See DRAW-STRING-SOLID-*.
Parameters
P1
is the x and y position to render the text, of typeSDL:POINT
.
[Function]
draw-string-solid-* c x y &key font surface color => result
Draw text
C
at locationX
Y
using fontFONT
with colorCOLOR
onto surfaceSURFACE
. The text is keyed onto SURFACE.Parameters
C
is the text to render.X
andY
are the x and y position coordinates, asINTEGERS
.FONT
is the font face used to render the string. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
color is the text color, of typeSDL:SDL-COLOR
.Returns
- Returns the font
FONT
.Example
(DRAW-STRING-SOLID-* "Hello World!" 0 0 :SURFACE A-SURFACE :COLOR A-COLOR)
[Function]
draw-trigon point1 point2 point3 &key surface color => result
Draw the outline of a trigon or triangle, of color
COLOR
to surfaceSURFACE
. Use DRAW-FILLED-TRIGON-* to draw a filled trigon.Parameters
POINT1
,POINT2
andPOINT3
specify the vertices of the trigon, of typeSDL:POINT
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
draw-vline x y1 y2 &key surface color => result
Draw a vertical line of color
COLOR
fromY1
toY2
throughX
onto the surfaceSURFACE
.Parameters
X
is the horizontalINTEGER
coordinate that the vertical line must intersect.Y1
andY2
are the vertical start and end points of the line, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Standard class]
font
A
FONT
object manages the resources for the font. These resources include any cached surface as well as the foreign array containing the font data.The cached surface is created by a call to any of the RENDER-STRING* functions. Use DRAW-FONT, DRAW-FONT-AT or DRAW-FONT-AT-* to draw the cached surface.
Prior to the first call to a RENDER-STRING* function, the cached surface is
NIL
.
[Generic function]
font-height font => result
[Method]
font-height (font font) => result
[Generic function]
font-width font => result
[Method]
font-width (font font) => result
[Generic function]
free-font font => result
[Method]
free-font (font font) => result
Free resources associated with the font
FONT
. This includes freeing the cached surface and the foreign array containing the font data.
[Function]
initialise-default-font &optional font-definition => result
Creates a new
FONT
object from the font definition inFONT-DEFINITION
. Sets the fontFONT
as the default font to be used for subsequent font rendering or drawing operations.Binds the symbol
*DEFAULT-FONT*
to font. Functions that take aFONT
argument use*DEFAULT-FONT*
unless otherwise specified. Returns a newFONT
, orNIL
if unsuccessful.
[Function]
initialise-font font-definition => result
Creates a new
FONT
object from the font data inFONT-DEFINITION
. Returns a newFONT
, orNIL
if unsuccessful.
[Function]
render-string-shaded string fg-color bg-color &key font free cache => result
Render the string
STRING
using fontFONT
with text colorFG-COLOR
and background colorBG-COLOR
to a newSURFACE
. The dimensions of the new surface are height ==FONT
height, and width ==FONT
width *STRING
length. The surface background is filled withBG-COLOR
so the surface cannot be keyed over other surfaces. Use:CACHE T
to cache the new surface in theFONT
object. When:FREE T
any exisiting cached surface inFONT
is automatically freed. When:FREE NIL
the caller is responsible for freeing any existing cached surface inFONT
.Parameters
STRING
is the text to render.FONT
is the font face used to render theSTRING
. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.FG-COLOR
color is the text color, of type SDL:SDL-COLORBG-COLOR
color is the background color used to fill the surface, of type SDL:SDL-COLORFREE
whenT
will free any exisitng cached surface inFONT
.CACHE
whenT
will cache the newly created SURFACE inFONT
.Returns
- Returns a new cached surface
SDL:SDL-SURFACE
.Example
(DRAW-STRING-SHADED "Hello World!" F-COLOR B-COLOR)
[Function]
render-string-solid string &key font color free cache => result
Render the string
STRING
using fontFONT
with text colorCOLOR
to a newSURFACE
. The dimensions of the new surface are height ==FONT
height, and width ==FONT
width *STRING
length. The surface background is transparent and therefore can be keyed over other surfaces. Use:CACHE T
to cache the new surface in theFONT
object. When:FREE T
any exisiting cached surface inFONT
is automatically freed. When:FREE NIL
the caller is responsible for freeing any existing cached surface inFONT
.Parameters
STRING
is the text to render.FONT
is the font face used to render theSTRING
. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.COLOR
color is the text color, of typeSDL:SDL-COLOR
.FREE
whenT
will free any exisitng cached surface inFONT
.CACHE
whenT
will cache the newly created SURFACE inFONT
.Returns
- Returns a new cached surface
SDL:SDL-SURFACE
.Example
(DRAW-STRING-SOLID "Hello World!" :COLOR A-COLOR)
[Function]
roto-zoom-size width height angle zoom => result
[Function]
roto-zoom-size-xy width height angle zoomx zoomy => result
[Function]
roto-zoom-xy angle zoomx zoomy smooth &key surface => result
[Function]
set-default-font font => result
Sets the font
FONT
as the default font to be used for subsequent font rendering or drawing operations. Binds the symbol*DEFAULT-FONT*
to font. Functions that take aFONT
argument use*DEFAULT-FONT*
unless otherwise specified. Returns a newFONT
, orNIL
if unsuccessful.
[Macro]
with-bezier (&optional segments) declaration* statement* => result
Draw a bezier curve of color
*DEFAULT-COLOR*
to the surface*DEFAULT-SURFACE*
. The shape of the Bezier curve is defined by control points. A control point is a vertex containing an X and Y coordinate pair.Local Methods
A vertex may be added using:
ADD-VERTEX
which accepts anSDL:POINT
, orADD-VERTEX-*
which is the x/y spread version
ADD-VERTEX
andADD-VERTEX-*
are valid only within the scop ofWITH-BEZIER
.Parameters
SEGMENTS
is the number of segments used to draw the Bezier curve. Default is 10 segments if unspecified. The greater the number of segments, the smoother the curve.Example
(SDL:WITH-COLOR (COL (SDL:COLOR)) (WITH-BEZIER (30) (ADD-VERTEX-* 60 40) (ADD-VERTEX-* 160 10) (ADD-VERTEX-* 170 150) (ADD-VERTEX-* 60 150)))
[Macro]
with-curve (shape-type &optional segments) declaration* statement* => result
Draw a Cattmul-Rom spline of color
*DEFAULT-COLOR*
to the surface*DEFAULT-SURFACE*
. The shape of the curve is defined by waypoints. A waypoint is a vertex containing an X and Y coordinate pair.Local Methods
A vertex may be added using:
ADD-VERTEX
which accepts anSDL:POINT
, orADD-VERTEX-*
which is the x/y spread version
ADD-VERTEX
andADD-VERTEX-*
are valid only within the scope ofWITH-CURVE
.Parameters
SHAPE-TYPE
describes the line style used to draw the curve and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SEGMENTS
is the number of segments used to draw the Catmull-Rom spline. Default is 10 segments if unspecified. The greater the number of segments, the smoother the spline.Example
(SDL:WITH-COLOR (COL (SDL:COLOR)) (WITH-CURVE (:LINE-STRIP 30) (ADD-VERTEX-* 60 40) (ADD-VERTEX-* 160 10) (ADD-VERTEX-* 170 150) (ADD-VERTEX-* 60 150)))
[Macro]
with-shape (shape-type) declaration* statement* => result
Draw a polygon of color
*DEFAULT-COLOR*
to the surface*DEFAULT-SURFACE*
.Local Methods
A vertex may be added using:
ADD-VERTEX
which accepts anSDL:POINT
, orADD-VERTEX-*
which is the x/y spread versionADD-VERTEX and ADD-VERTEX-* are valid only within the scop of WITH-SHAPE.
Parameters
SHAPE-TYPE
describes the line style used to draw the shape and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.Example
(SDL:WITH-COLOR (COL (SDL:COLOR)) (WITH-SHAPE (:POINTS) (ADD-VERTEX-* 60 40) (ADD-VERTEX-* 160 10) (ADD-VERTEX-* 170 150) (ADD-VERTEX-* 60 150)))
[Function]
zoom-surface zoomx zoomy smooth &key surface => result
[Function]
zoom-surface-size width height zoomx zoomy => result