PackageDescription: CairoGraphics
Cairo GraphicsLast published: May 5, 2008 by 'randy'
Defines 52 Classes
Extends 65 Classes
This is a Smalltalk binding for the open source cross platform CairoGraphics library. See .
The CairoGraphics documents describe some conventions and desires for language bindings. These were difficult to follow in some cases.
Method Names:
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 similiar, 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.
Constants:
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 simliarly after the contsant (see subclasses of CairoConstant) with method names that are similiar to the constant name. So one can simply write 'CapStyle butt'. I used a piece of code to actually generate all of these.