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
OPTIONALorKEYword argumentFONT, the default action is to bind to*DEFAULT-FONT*.*DEFAULT-FONT*is set toNILinitially. 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
P1is 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
XandYspecify the center coordinate of the circle, of typeINTEGER.Ris the circle radius, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-aa-ellipse p1 rx ry &key surface color => result
See DRAW-AA-ELLIPSE-*.
Parameters
P1is 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
XandYspecify the center coordinate of the ellipse, of typeINTEGER.RXandRYspecify the ellipse radius, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-aa-line point1 point2 &key surface color => result
See DRAW-AA-LINE-*-*
Parameters
POINT1andPOINT2are 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
COLORto the surfaceSURFACE.Parameters
X1Y1are the start X/Y coordinates of the line, of typeINTEGER.X2Y2are the end X/Y coordinates of the line, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL: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
COLORto surface SURFACE using the vertices inPOINTS. The polygon is anti-aliased. Use DRAW-FILLED-POLYGON-* to draw a filled polygon.Parameters
POINTSis the list of vertices of typeSDL:POINT.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL: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
COLORto surfaceSURFACEusing anti-aliasing. Use DRAW-FILLED-TRIGON-* to draw a filled trigon.Parameters
POINT1,POINT2andPOINT3specify the vertices of the trigon, of typeSDL:POINT.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-bezier points steps &key surface color => result
Draw a bezier curve of color
COLORto 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
POINTSis the list of control points of typeSDL:POINT.STEPSis the number of segments used to draw the Bezier curve. The greater the number of segments, the smoother the Bezier curve.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL: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
RECTis the rectangle to fill, of typeSDL:RECTANGLE.
[Function]
draw-box-* x y w h &key surface color => result
Draws a filled rectangle of color
COLORto surfaceSURFACE.Parameters
XandYare theINTEGERcoordinates of the top-left corner of the rectangle.WandHare the width and height of the rectangle, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the fill color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-character-shaded c p1 fg-color bg-color &key font surface => result
Parameters
P1is 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
Cat locationXYusing fontFONTwith text colorFG-COLORand background colorBG-COLORonto surfaceSURFACE. The surface background is filled withBG-COLORso the surface cannot be keyed over other surfaces.
Cis the character to render.XandYare the x and y position coordinates, asINTEGERS.FG-COLORcolor is the character color, of type SDL:SDL-COLORBG-COLORcolor is the background color used to fill the surfaceSURFACE, of type SDL:SDL-COLORFONTis the font face used to render the character. Of typeFONT. Bound to*DEFAULT-FONT*if unspecified.SURFACEis 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
P1is 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
Cat locationXYusing fontFONTwith text colorCOLORonto surfaceSURFACE. The character is keyed onto SURFACE.Parameters
Cis the character to render.XandYare the x and y position coordinates, asINTEGERS.FONTis the font face used to render the character. Of typeFONT. Bound to*DEFAULT-FONT*if unspecified.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORcolor 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
P1is 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
COLORto the surfaceSURFACE. Use DRAW-FILLED-CIRCLE-* to draw a filled circle.Parameters
XandYspecify the center coordinate of the circle, of typeINTEGER.Ris the circle radius, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL: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
COLORto the surfaceSURFACE. The shape of the curve is defined by waypoints. A waypoint is a vertex containing an X and Y coordinate pair.Parameters
POINTSis a list of waypoints or vetices for the spline, of typeSDL:POINTTYPEdescribes the line style used to draw the curve and may be one of:LINE-STRIP,:LINES, or:POINTS. Use:LINE-STRIPto draw a single continuous line through the specified waypoints. Use:LINESto draw a line between alternate waypoint pairs. Use:POINTSto draw a single pixel at each waypoint.SEGMENTSis 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.SURFACEis the target surface, of typeSDL:SDL-SURFACE.COLORis the line color, of typeSDL:COLORorSDL: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
P1is 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
COLORto the surfaceSURFACE. Use DRAW-FILLED-ELLIPSE-* to draw a filled ellipse.Parameters
XandYspecify the center coordinate of the ellipse, of typeINTEGER.RXandRYspecify the ellipse radius, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-filled-circle p1 r &key surface color => result
See DRAW-FILLED-CIRCLE-*.
Parameters
P1is 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
COLORto the surfaceSURFACE.Parameters
XandYspecify the center coordinate of the circle, of typeINTEGER.Ris the circle radius, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the fill color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-filled-ellipse p1 rx ry &key surface color => result
Parameters
P1is 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
COLORto the surfaceSURFACE.Parameters
XandYspecify the center coordinate of the ellipse, of typeINTEGER.RXandRYspecify the ellipse radius, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the fill color, of typeSDL:COLORorSDL: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
P1is 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
COLORto the surfaceSURFACE.Parameters
XandYspecify the center coordinate of the pie, of typeINTEGER.RADis the pie radius, of typeINTEGER.STARTis the pie start, of typeINTEGER.ENDis the pie end, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the fill color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-filled-polygon points &key surface color => result
Draw a filled polygon, of color
COLORto surfaceSURFACE.Parameters
POINTSis the list of vertices of typeSDL:POINT.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the fill color, of typeSDL:COLORorSDL: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
COLORto surfaceSURFACE.Parameters
POINT1,POINT2andPOINT3specify the vertices of the trigon, of typeSDL:POINT.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the fill color, of typeSDL:COLORorSDL: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
COLORfromX1toX2throughYonto the surfaceSURFACE.Parameters
X1andX2are the horizontal start and end points of the line, of typeINTEGER.Yis the verticalINTEGERcoordinate that the horizontal line must intersect.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-line point1 point2 &key surface color => result
See DRAW-LINE-*.
Parameters
POINT1andPOINT2are 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
COLORto the surfaceSURFACE.Parameters
X1Y1are the start X/Y coordinates of the line, of typeINTEGER.X2Y2are the end X/Y coordinates of the line, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-pie p1 rad start end &key surface color => result
See DRAW-PIE-*.
Parameters
P1is 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
COLORto the surfaceSURFACE. Use DRAW-FILLED-PIE-* to draw a filled pie.Parameters
XandYspecify the center coordinate of the pie, of typeINTEGER.RADis the pie radius, of typeINTEGER.STARTis the pie start, of typeINTEGER.ENDis the pie end, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-pixel position &key surface color => result
See DRAW-PIXEL-*.
Parameters
POSITIONis 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
COLORto the surfaceSURFACEat the specifiedXandYcoordiates.Parameters
XandYspecify the coordinates of the pixel, and are of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the pixel color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-polygon points &key surface color => result
Draw the circumference of a polygon of color
COLORto surface SURFACE using the vertices inPOINTS. Use DRAW-FILLED-POLYGON-* to draw a filled polygon.Parameters
POINTSis the list of vertices for the polygon.POINTSis a list ofSDL:POINTs.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-rectangle rect &key surface color => result
See DRAW-RECTANGLE-*.
Parameters
RECTis the rectangle to draw, of typeSDL:RECTANGLE.
[Function]
draw-rectangle-* x y w h &key surface color => result
Draw a rectangle outline of color
COLORto the surfaceSURFACE.Parameters
XandYare theINTEGERcoordinates of the top-left corner of the rectangle.WandHare the width and height of the rectangle, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-shape points type &key surface color => result
Draw a polygon of color
COLORto the surfaceSURFACEusing the vertices inPOINTS.Parameters
POINTSis a list of vertices, of typeSDL:POINTTYPEdescribes the line style used to draw the polygon and may be one of:LINE-STRIP,:LINES, or:POINTS. Use:LINE-STRIPto draw a single continuous line through the specified waypoints. Use:LINESto draw a line between alternate waypoint pairs. Use:POINTSto draw a single pixel at each waypoint.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL: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
P1is 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
Cusing at locationXYusing fontFONTwith text colorFG-COLORand background colorBG-COLORonto surfaceSURFACE. The surface background is filled withBG-COLORso the surface cannot be keyed over other surfaces.
Cis the text to render.XandYare the x and y position coordinates, asINTEGERS.FG-COLORcolor is the text color, of type SDL:SDL-COLORBG-COLORcolor is the background color used to fill the surfaceSURFACE, of type SDL:SDL-COLORFONTis the font face used to render the text. Of typeFONT. Bound to*DEFAULT-FONT*if unspecified.SURFACEis 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
P1is 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
Cat locationXYusing fontFONTwith colorCOLORonto surfaceSURFACE. The text is keyed onto SURFACE.Parameters
Cis the text to render.XandYare the x and y position coordinates, asINTEGERS.FONTis the font face used to render the string. Of typeFONT. Bound to*DEFAULT-FONT*if unspecified.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORcolor 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
COLORto surfaceSURFACE. Use DRAW-FILLED-TRIGON-* to draw a filled trigon.Parameters
POINT1,POINT2andPOINT3specify the vertices of the trigon, of typeSDL:POINT.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the circumference color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Function]
draw-vline x y1 y2 &key surface color => result
Draw a vertical line of color
COLORfromY1toY2throughXonto the surfaceSURFACE.Parameters
Xis the horizontalINTEGERcoordinate that the vertical line must intersect.Y1andY2are the vertical start and end points of the line, of typeINTEGER.SURFACEis the target surface, of typeSDL:SDL-SURFACE. Bound toSDL:*DEFAULT-SURFACE*if unspecified.COLORis the line color, of typeSDL:COLORorSDL:COLOR-A. Bound toSDL:*DEFAULT-COLOR*if unspecified.
[Standard class]
font
A
FONTobject 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
FONTobject from the font definition inFONT-DEFINITION. Sets the fontFONTas the default font to be used for subsequent font rendering or drawing operations.Binds the symbol
*DEFAULT-FONT*to font. Functions that take aFONTargument use*DEFAULT-FONT*unless otherwise specified. Returns a newFONT, orNILif unsuccessful.
[Function]
initialise-font font-definition => result
Creates a new
FONTobject from the font data inFONT-DEFINITION. Returns a newFONT, orNILif unsuccessful.
[Function]
render-string-shaded string fg-color bg-color &key font free cache => result
Render the string
STRINGusing fontFONTwith text colorFG-COLORand background colorBG-COLORto a newSURFACE. The dimensions of the new surface are height ==FONTheight, and width ==FONTwidth *STRINGlength. The surface background is filled withBG-COLORso the surface cannot be keyed over other surfaces. Use:CACHE Tto cache the new surface in theFONTobject. When:FREE Tany exisiting cached surface inFONTis automatically freed. When:FREE NILthe caller is responsible for freeing any existing cached surface inFONT.Parameters
STRINGis the text to render.FONTis the font face used to render theSTRING. Of typeFONT. Bound to*DEFAULT-FONT*if unspecified.FG-COLORcolor is the text color, of type SDL:SDL-COLORBG-COLORcolor is the background color used to fill the surface, of type SDL:SDL-COLORFREEwhenTwill free any exisitng cached surface inFONT.CACHEwhenTwill 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
STRINGusing fontFONTwith text colorCOLORto a newSURFACE. The dimensions of the new surface are height ==FONTheight, and width ==FONTwidth *STRINGlength. The surface background is transparent and therefore can be keyed over other surfaces. Use:CACHE Tto cache the new surface in theFONTobject. When:FREE Tany exisiting cached surface inFONTis automatically freed. When:FREE NILthe caller is responsible for freeing any existing cached surface inFONT.Parameters
STRINGis the text to render.FONTis the font face used to render theSTRING. Of typeFONT. Bound to*DEFAULT-FONT*if unspecified.COLORcolor is the text color, of typeSDL:SDL-COLOR.FREEwhenTwill free any exisitng cached surface inFONT.CACHEwhenTwill 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
FONTas the default font to be used for subsequent font rendering or drawing operations. Binds the symbol*DEFAULT-FONT*to font. Functions that take aFONTargument use*DEFAULT-FONT*unless otherwise specified. Returns a newFONT, orNILif 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-VERTEXwhich accepts anSDL:POINT, orADD-VERTEX-*which is the x/y spread version
ADD-VERTEXandADD-VERTEX-*are valid only within the scop ofWITH-BEZIER.Parameters
SEGMENTSis 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-VERTEXwhich accepts anSDL:POINT, orADD-VERTEX-*which is the x/y spread version
ADD-VERTEXandADD-VERTEX-*are valid only within the scope ofWITH-CURVE.Parameters
SHAPE-TYPEdescribes the line style used to draw the curve and may be one of:LINE-STRIP,:LINES, or:POINTS. Use:LINE-STRIPto draw a single continuous line through the specified waypoints. Use:LINESto draw a line between alternate waypoint pairs. Use:POINTSto draw a single pixel at each waypoint.SEGMENTSis 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-VERTEXwhich 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-TYPEdescribes the line style used to draw the shape and may be one of:LINE-STRIP,:LINES, or:POINTS. Use:LINE-STRIPto draw a single continuous line through the specified waypoints. Use:LINESto draw a line between alternate waypoint pairs. Use:POINTSto 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