Gfxprim is simple modular 2D bitmap graphics library with emphasis on speed and correctness.
One of the key points of the library are code generators. Most of the graphics operations are written using Jinja templating engine which is used to create specialized C code. So, for an example, once you add pixel definition into configuration file, creating specialized filters, loaders and conversions to other pixel formats is just a matter of typing make rebuild.
Core of the library contains minimal amount of code to define interface that is shared between all parts of the library.
The most important part of the core is CP_Context structure that represents in-memory pixmap.
The Core also contains generated code for basic operations such as GP_GetPixel and GP_PutPixel and optimized functions for writing continous line of pixels GP_WritePixels that are base for the more complex drawing primitives in GFX or for graphics operations in Filters.
Blits are functions used to copy part of one bitmap into another bitmap. The blits be also used for primitive bitmap pixel type conversions (i.e. RGB888 vs BGR888).
Progress Callback is an interface that allows you to monitor progress of an operation it is mainly used in loaders and filters. Generally any operation that is not really quick takes optional pointer to progress callback that allows your program to monitor and possibly abort the operation.
Debug interface is used as unified facility to print debug messages, control debug level, etc.
There is also support for Gamma correction. Unfortunatelly not all parts of library use it at the moment.
And last but not least Core is a home for some common macros that are used from different parts of the library.
Gfx is part of the library that implements basic graphics primitives such as lines, circles, polygons, etc. Clasicall primitives are nearly finished. Work on anti aliased primitives has been started.
Loaders are part that is resposible for loading and saving images into various standard formats (PNG, JPEG, GIF, TIFF, BMP, PNM, etc…).
| Extension | Format Name | Read Support | Write Support |
|---|---|---|---|
JPEG |
Yes |
Yes |
|
PNG |
Portable Network Graphics |
16 Bit RGB not supported |
16 Bit RGB not supported |
GIF |
Graphics Interchange Format |
Yes |
No |
BMP |
RLE4 and some less common bitfiels not supported |
RGB888 only |
|
TIFF |
Tagged Image File Format |
Most of the Palette, RGB and Grayscale works (no tiles yet) |
RGB888 and Grayscale |
PSP |
Paint Shop Pro Image |
Composite image only for newer formats than 3.0 |
No |
PBM PGM PNM |
Netpbm portable bitmap |
All but < 8bit binary grayscale |
All ASCII formats |
JP2 |
JPEG 2000 |
Experimental support for RGB images |
No |
CBZ |
Comic book archive |
Experimental support via ZIP Container |
No |
Filters are part of the library that implements bitmap image filters.
| Filter Name | Supported Pixel Type | Multithreaded |
|---|---|---|
Brightness |
All |
Not Applicable |
Contrast |
All |
Not Applicable |
Invert |
All |
Not Applicable |
Posterize |
All |
Not Applicable |
| Filter Name | Supported Pixel Type | Mutithreaded |
|---|---|---|
Convolution |
All |
Yes |
Separable Convolution |
All |
Yes |
Gaussian Blur |
All |
Yes |
Sobel Edge Detection |
RGB888 |
Yes |
Prewitt Edge Detection |
RGB888 |
Yes |
| Filter Name | Supported Pixel Type | Multithreaded |
|---|---|---|
Addition |
All |
No |
Multiplication |
All |
No |
Difference |
All |
No |
Max, Min |
All |
No |
| Filter Name | Supported Pixel Type | Multithreaded |
|---|---|---|
Floyd Steinberg |
All → Any |
No |
Hilbert Peano |
All → Any |
No |
| Filter Name | Supported Pixel Type | Multithreaded |
|---|---|---|
Nearest Neighbour |
All |
No |
Bilinear (Integer Arithmetics) |
All |
No |
Bicubic (Integer Arithmetics) |
All |
No |
Bicubic (Float Arithmetics) |
RGB888 |
No |
| Filter Name | Supported Pixel Type | Multithreaded |
|---|---|---|
Rotate 90 |
All |
No |
Rotate 180 |
All |
No |
Rotate 270 |
All |
No |
Mirror Vertically |
All |
No |
Mirror Horizontally |
All |
No |
| Filter Name | Supported Pixel Type | Multithreaded |
|---|---|---|
Histogram |
All |
No |
Additive Gaussian Noise |
All |
No |
Median |
RGB888 |
No |
Weighted Median |
RGB888 |
No |
Sigma Lee |
RGB888 |
No |
Backends together with Input are API for drawing on screen (or into a window) and for getting keystrokes/mouse coordinates. So far we support X11, linux framebuffer, SDL and AALib as a graphics backend.
There is also a virtual backend used for testing that allows you to create a backend of any pixel type on the top of other backends.
Anti Aliased drawing
Gamma correction and color profiles