A Programmers Guide
To
Just Another Boring Animator (JABA)

Written
By

Varol Okan


2D Graphic formats
  1. The internal graphic format
  2. The CPicture class
  3. The C2DUtils class
  4. The C2DCoder class
  5. BMP - Format
  6. PCX - Format
  7. TIFF - Format
  8. PNG - Format
  9. JPG - Format

The internal graphic format

The internal format is split into different parts.

//  Class C2Dgfx is a abstract class, to encapsulate all neccesary 
//  functions for the picture coder class.
//  Derived classes are :
//  CBMP/CPCX/CTGA/CTIFF/CJPG/CJFIF/CPNG
//
//  The decoded pictures are the stored in a special BMP-Format 
//  (CPicture). Special because in contrast to the original BMP 
//  format, there is a Alpha plane (32bit pictures), 
//  Red, Green, Blue and Transparent have 8-bit.
//
// Abstract                         C2Dgfx
//   Base                              |
//  Class :                            V
//             ---------------------------------------------------
// Derived     |       |       |       |        |       |        |
// Classes : CBMP    CPCX    CTGA    CTIFF    CJPG    CPNG    [CGIF]
//             |       |       |       |        |       |        |
//             ---------------------------------------------------
//                                     |
//                                  CPicture
//                                     |
//                                     V
//             ---------------------------------------------------
// Storing     |       |       |       |        |       |        |
//   to      CBMP    CPCX    CTGA    CTIFF    CJPG    CPNG    [CGIF]
// file, as    |       |       |       |        |       |        |
//             ---------------------------------------------------
//                                     |
//                                Store to file ...
//
// One remark on the GIF-coder. I can't make the source code available
// here. But there is nothing that prevent me from giving away a GIF-DLL, 
// to be able to read and write this still important graphic format.
//
  1. The main part consist basically of the BMP-Structure. Remember that we want to handle the picture internally as BMP, so it is rather simple to display it or convert it into the Pixmap format for OpenGL or any other needed format.

  2. The next big part is the Coder / Decoder. This classes are needed to convert to and from another picture format (e.g. JPG). They are dynamically loaded into memory and if no longer needed, removed from memory.
    To Load a tiff - picture for example, one need to :
    1. Create a CPicture instance (e.g. CPicture myPicture();)
    2. Create a CTiff instance (child of CDecoder class) CTiff myTiff = new CTiff();
    3. Attatch the CTiff object to the CPicture object myPicture.Add((C2DCoder *)myTiff);
    4. Now you can call myPicture.2DCoder.Load2DGFX('test.tif');
    5. Now you can remove the CTiff object from myPicture.myPicture.Remove(myTiff);.
    6. And last, destroy the CTiff object delete myTiff;.
    The newly loaded picture is now within the CPicture object and can be displayed wether through the Platform Abstarction Layer function myPal.DC.Display2DGFX (myPicture);
    Note : The orange lines (b, c, e and f) are not neccesarily needed. In that case the CPicture class will dynamically create and destroy a Tiff decoder class. The created decoder class is dependend on the file-extension given in the file-name.

  3. The last part is a merely place-holder for the used language. Posiible values are :
    1. LANGUAGE_GERMAN
    2. LANGUAGE_ENGLISH
    Note that the CPicture class has a language specific part as well as every coder / decoder class.

The CPicture class


The C2DUtils class

This class provides a smal set of filter, special effects and comparison utils for two dimensional pictures (Non animation). It is mainly used for testing purposes.
It includes (simple) rotation, fliping, grayscaling, histogramm, resizing, programable FFT filter, difference between 2 pictures, Octree filter (color reduction) etc.


The CCoder class


BMP - Format


PCX - Format


TIFF - Format


PNG - Format


JPG - Format


Author : Varol Okan Last Updated: October, 19'th 1998