Last published: July 1, 2016 by 'ken'
Defines 60 Classes
Extends 80 Classes
This is a Smalltalk binding for the open source cross platform CairoGraphics library. See .
As of version 7.9 - 12, it maps to the 1.12.0 set of CairoGraphics features. It should be backwards compatible with earlier versions of the library, as long as features that are found only in the newer versions are not invoked. See the "Index of a new symbols in..." sections near the bottom of http://www.cairographics.org/manual/ to get a feel for which capabilities show up in which versions of the library.
The CairoGraphics documents describe some conventions and desires for language bindings. These were difficult to follow in some cases.
Smalltalk's keyword messages makes it difficult to map the keyword style to the comma list function style at times. At the DLLCC direct mapping level found in the LibCairo object, I originally followed the standard practice of using functionName(:with:with:...).
At the higher level where we create Smalltalk objects to map to the Cairo side objects, I tried to keep them as similiar as possible. Many of the methods take separate x: and y: arguments. These I kept, but also provided shortcuts which just take points for *many* of these. There are a couple of names that I just couldn't stomach either and translated into something else. But none come to mind right now actually. The argument for keeping them similar, is that this should make it so a Smalltalk Cairo user can read the docs and at least be able to translate into the Smalltalk side the code they see there. I'm trying.
This an ongoing area of evolution. The Cairo Library defines a vast number of "Constant" flags. From specifying interpolation in 6 different ways for 3 different functions, to various line end/butt/cap/etc styles to font tuning flags. They are of course preserved (at least so far) in all of their glory in the ExternalInterface. Something like LibCairo new enumType memberAt: #SYMBOL_IN_CAPS_WITH_UNDERSCORES should probably fetch the right value. But this just seems so baroque (say it fast).
The current approach is to use a class named similarly after the constant (see subclasses of CairoConstant) with method names that are similar to the constant name. So one can simply write 'CapStyle butt'. I used a piece of code to actually generate all of these.