ImgBlit, the Image Blit Library

This library will handle Pygame Surface software blits and surface to array copies. It will be built as a standalone shared library with a C api with a Python wrapper module using CFFI. The LibJIT library will be the JIT backend. The front end will be written in C++, with C entry points.

Directory Layout

Source files:


Header files:


C++ test programs:


Memory Management

Heap allocated objects, such as abstract syntax tree nodes, are managed by class imgblit::Reference smart pointers. The Reference class is defined in header file imgblit/memory.h. It is implemented in memory.cpp. Program testmemory.cpp performs unit tests. So far this has only tried with g++ on gnu/linux. The shell command to build testmemory in the base directory is:

g++ -std=c++98 -g -Iinclude test/testmemory.cpp src/memory.cpp -o testmemory

Source Language

The ImgBlit source language operates on array types. A blit operation is a function that takes zero or more source array arguments and returns the target array value. Arguments are passed by value. The target array may be one of the source arguments. Altering it does not affect the actual target of the operation.

A blit function is written in an abstract assembly language. Each instruction is an operation with zero or more arguments. The language is procedural. Instructions modify local array variables. For a binary operation, the first argument is applied to the second. Several global values, registers, may be available. Additional local variables can be defined.

Language tokens are white space separated.