Graphics drawing primitives and other support functions wrapped up in an addon, C-based library for the Simple Direct Media (SDL) cross-platform API layer. SDL_gfx supports the original SDL1 library using software surfaces, and SDL2_gfx supports SDL2 using rendering functions.

SDL2_gfx Library

SDL2 graphics drawing primitives and other support functions

Latest Version (Ver 1.0.1 – Sun Jun 15 2014)

SDL2_gfx-1.0.1.tar.gz (.zip) (or on SourceForge)

Older versions



Doxygen generated API documentation

(C) A. Schiffler, aschiffler [at] 2012-2015, licensed under the zlib license

SDL_gfx Library

SDL graphics drawing primitives and other support functions

The SDL_gfx library evolved out of the SDL_gfxPrimitives code which provided basic drawing routines such as lines, circles or polygons and SDL_rotozoom which implemented a interpolating rotozoomer for SDL surfaces.

The current components of the SDL_gfx library are:

  • Graphic Primitives (SDL_gfxPrimitves.h)
  • Rotozoomer (SDL_rotozoom.h)
  • Framerate control (SDL_framerate.h)
  • MMX image filters (SDL_imageFilter.h)
  • Custom Blit functions (SDL_gfxBlitFunc.h)

The library is backwards compatible to the above mentioned code. Its is written in plain C and can be used in C++ code.

(C) A. Schiffler, aschiffler [at] 1999-2013, licensed under the zlib license




Overview and doxygen generated API documentation


Latest Version (Ver 2.0.25 – Sun Oct 28 2013)

SDL_gfx-2.0.25.tar.gz (or on SourceForge)

Current Development Version via SVN

Older Releases


Supported Platforms

The library compiles and is tested for a Linux target (gcc compiler) and a Win32 target (VisualC, xmingw32 cross-compiler) as well as BeOS and MacOS X PowerBuilder See README for VC and PowerBuilder compile information. When using the cross-compiler (available on the author’s homepage), the build process generates .DLLs. You can use the command line ‘LIB.EXE’ tool to generate VC6 compatible .LIB files for linking purposes.

Language Interfaces

SDL_gfx has been integrated with the following language interfaces:

  • Pascal:
  • Perl:
  • Python:
  • C#:
  • Lua:
Notes on Graphics Primitives

Care has been taken so that all routines are fully alpha-aware and can blend any primitive onto the target surface if ALPHA<255. Surface depths supported are 1,2,3 and 4 bytes per pixel. Surface locking is implemented in each routine and the library should work well with hardware accelerated surfaces. Currently, The following Anti-Aliased drawing primitives are available:

  • AA-line
  • AA-circle
  • AA-ellipse
  • AA-polygon (not filled)
Please check README in archive and .h files for up-to-date interface information.
SDL_gfx / SDL2_gfx
Tagged on:             

2 thoughts on “SDL_gfx / SDL2_gfx

Leave a Reply

Your email address will not be published. Required fields are marked *