[SDL] Any good blitters?
mbickel at asc-hq.org
Sat Jun 9 04:51:55 PDT 2007
On Thu, 7 Jun 2007 09:27:02 -0400, Jonathan Dearborn wrote:
>Just like David Olofson said in the thread "[SDL] BUG?: RGBA->screen blit has 1-off error with opaque colors", an option for achieving perfect blending in SDL is to implement your own blitters. I myself made one a while ago, but it is about half the speed of SDL_BlitSurface(). Does anyone else have any extra blitters or know of 'libraries' that include some? I'd like to put up a list of blitters on my website so they'd be easy to find and compare.
ASC 2.0 (which hasn't been released yet) uses perhaps a hundred
individual Blitters. They are generated at compiletime by customizing a
generic blitting class with a bunch of policy classes. This approach is
very flexible, but heavily relies on the compiler doing the
- very flexible, modular and maintainable
- very high code reuse (you can customize your blitting behaviour with
very compact policy classes)
- fast enough (and still room for optimization)
It follows the concept that you don't have to pay for stuff that you
don't need. Clipping? Transparency handling? Zooming? Color depth
transformation? If you know at compile time what you need, the compiler
will generate you exactly the code that you need without any overhead
for stuff that you don't want.
The basic blitter itself can be seen here:
And an example for usag
If there is sufficient interest (i.e. enough people who are not afraid
of using C++ template metaprogramming for graphics stuff), they could
be documented and packaged as a separate library.
Right now, they depend on some SDLmm classes and the semantics are a
bit different than the SDL blitters regarding surface transparency.
Source code is available through CVS.
More information about the SDL