Jonny D's Projects
News
GigaSun Jet
Tutorials
C++ Projects
   -Beginners
SDL Projects
   -SPriG
      -Docs
   -NFont
Other Projects

Contact

Outside Projects

  Why?

SPriG


The SDL Primitive Generator, SPriG, is a free and open source C/C++ library that does three main things:

* Draws graphics primitives (pixels, lines, circles, polygons, etc.) with optional anti-aliasing, alpha-blending, and arbitrary thickness.
* Rotates, scales, and mirrors SDL surfaces with optional anti-aliasing and alpha-blending.
*

Makes working with SDL surfaces quicker and easier.


If you like SPriG, check out the parallel page for NFont, an excellent bitmap font library (C/C++).

Features

Screenshots

Download

Using SPriG

Documentation

Improving SPriG


SPriG Features:

Graphics primitives
Anti-aliased primitives
Line thickness control
Built-in 'Dirty rect' system
Shapes and polygons
Several alpha-blending modes
Rotation and scaling
Flood-fill
Palette functions

You can find a full list of functions here.


Unimplemented Features:

SPG_EllipseArb
SPG_TSLOW
SPG_TBLEND
SPG_TSURFACE_ALPHA

Known Bugs

The surface transform functions have minor bugs like missing the bottom row of pixels.
Gouraud shading is direction-biased.
Alpha-blended beziers overdraw pixels.
Alpha-blending and anti-aliasing need special treatment in thick primitives.

Improving SPriG

If you'd like to get involved with making SPriG better, whether you have feature requests, suggestions, bug reports, or code to submit, check out the Google Code page:

SPriG on Google Code


  

Screenshots

Sprig Screenshot1 Sprig Screenshot2
A SPriG test program (excuse the scaling) GigaSun Jet, a game using SPriG that is currently under development

Sprig Polygon Demo

Sprig Dirty Rect Demo

Sprig Polygon Demo Sprig Dirty Rect Demo




Development Notes 11-8-08:

The official release of v1.0.0 is now available!  

Speed notes (Dirty Rect Demo):  On Debian Linux, the dirty rect system gives around a 4x speedup for ~4 sprites.  At around 13 sprites, the benefit seems to be gone...  But on WinXP, the speedup was crazy!  At 100 sprites, I was still using around 2/3 of the full refresh time.  This may be due to build option differences between systems, so your best bet is to fiddle with compiler flags to get more speed.

Additional feedback would be great from those who are used to SGE or SDL_gfx.

If you have any requests, suggestions, or would like to contribute a binary package for any specific OS, please send me an email!


Name Description Dependencies Version Info License

SPriG

SPriG is a graphics primitive generator for SDL.  It supplies a quick and simple interface for the drawing of primitives (pixels, lines, polygons), the rotation and zooming of surfaces, and many useful surface functions.  It also includes several alpha-blending modes, dirty rectangles, and line thickness controls.

SDL


v1.0.1 - 11/27/09

[Documentation (online)]
[Documentation (.zip)]

v1.0.0 - 11/8/08

[Binary - Win32]

[Demo Sources]
[Demo Binaries]

v0.941 - 7/7/08

[Documentation (online)]
[Documentation (.zip)]

[Source]
[Binary]

LGPL

SDL_gfx
[Official Site]
SDL_gfx is another popular graphics extension for SDL that is still active. SDL - LGPL
SGE
[Official Site]
SGE is a graphics library for SDL that provides the drawing of primitives, the rotation and zooming of surfaces, and much more.  It is not in active development. SDL
FreeType (optional)
SDL_image (optional)
r030809 LGPL

 

Generic library installation guide:

  Download the binary distribution for your operating system.
  Copy headers (sprig.h and sprig_inline.h) to your compiler's /include folder.
  Copy library files (libsprig.a, sprig.lib, or libsprig.so) to your compiler's /lib folder.
  Add library to your project's linked libraries (e.g. -lsprig).
  Include the header (#include "sprig.h").

Building from source using 'make':

  Download the source distribution.
  Unzip it and move into the src directory.
  Run 'make', then 'make install'.

Write a program and enjoy!

For a more detailed look at installing libraries, see Graphics from Scratch, Using SDL.
For more info on what SPriG can do, see A Guide to Graphics with SPriG.