I've uploaded to github an example of a simple minded interface, running the first example found in CImg documentation (see example.pl) when passed as argument to the program.
It shows how to create objects and define methods that act on such objects.
Take a look at what the code does, and feel free to ask for problems.
edit:
Updated the git repo introducing modules for the interface predicates.
Now exposed members of CImg
,CImgDisplay
classes must be prefixed respectively by cImg
,cImgDisplay
, and constructors/destructors are named new
, delete
.
The file example.pl has been moved to examples/getting_started.pl, and it's shown how to fetch images located relative to the source:
...
module_property(getting_started,file(ModuleFile)),
file_directory_name(ModuleFile,ModuleDir),
directory_file_path(ModuleDir,'img/milla.bmp',Milla),
cImg:new(Milla,Image),
cImg:blur(Image,2.5),
edit:
When you find you need to call a member not yet implemented, you should add it in your swipl_cimg.cpp, in the appropriate section (I mean, where you see the #define PROLOG_MODULE className...
corresponding to the object you need), dereference the object(s) using the cast functions and call the c++ method. It's a lengthy, boring way, sorry but I don't know nothing better... To cover the full CImg library, a lot of work is required. So, attempt to implement - and carefully test - only what is needed...
It's useful to follow some convention: input parameters first, output last.