Archive for the ‘Documentation’ Category.

Imago Documentation

When compiling, the build system assumes fltk-1.1.6 is in the same directory as the Imago source. For example, you should have something like the following:

/home/user/devel/fltk-1.1.6
/home/user/devel/imago
or C:\devel\fltk-1.1.6
C:\devel\imago

The API reference is available in Doxygen form.

I have a number of outstanding issues with Cairo:

  • Image renderer is a bit too slow.
  • Image renderer outputs in different formats on platforms with different endianness.
  • The formats that that the image renderer outputs (ARGB and BGRA) are incompatible with FLTK’s imaging layer.
  • XML parser can not handle out of order items causing some legal SVG elements to not be rendered.
  • No SVG “filter” support.

Currently the Windows version needs to have the fontconfig “fonts.conf” file compiled into your executable if you are statically linking. The resource ID is 17987 (0x4643 or “FC” in ASCII). The resource is automatically included in the Imago DLL when not using the static library. If this resource is missing then the Windows application will most likely crash. I need to fix this in the fontconfig library for Windows.

Because FLTK currently does not support translucency you must set the background color of SVG images if you want them to appear smooth against the background. I hope to eliminate this issue at some point by patching FLTK.

Here is a simple FLTK application that uses an SVG image loaded from a file:

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include "Fl_SVG_Image.H"
int main(int argc, char* argv[])
{
   Fl_Double_Window* win = new Fl_Double_Window(800, 600);
   Fl_Box* box = new Fl_Box(0, 0, win->w(), win->h());
   Fl_SVG_Image* img = new Fl_SVG_Image(argv[1], box->w(), box->h(), box->color());
   box->image(img);
   win->end();
   win->show();
   Fl::run();
   return 0;
}

Or to load an image from memory (note this doesn’t actually work because the SVG image data is invalid):

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include "Fl_SVG_Image.H"

const char* sample_svg_image = “<svg …> … SVG data here, gziped or plain text</svg>”;

int main(int argc, char* argv[])
{
   Fl_Double_Window* win = new Fl_Double_Window(800, 600);
   Fl_Box* box = new Fl_Box(0, 0, win->w(), win->h());
   Fl_SVG_Image* img = new Fl_SVG_Image(sample_svg_image, strlen(sample_svg_image), box->w(), box->h(), box->color());
   box->image(img);
   win->end();
   win->show();
   Fl::run();
   return 0;
}