The core Common Graphics subsystem is based on the X Window system's library of graphics operations (Xlib) and provides the same functions as the Xlib C calls. The Common Graphics Image Support classes are not based on Xlib.
This section will be of interest to developers familiar with Xlib graphic operations, as it describes the two main strategies that were used to convert the standard Xlib C calls to Smalltalk classes and methods. By understanding these two principles, experienced Xlib software engineers should be able to use the Common Graphics subsystem relatively quickly.
First, objects have been created for all C data types. These data types include items such as Display, Drawable, GC, and Font. These objects were named by prefixing the Xlib data type name with Cg and removing any leading X. For example, the Xlib type Display becomes the Smalltalk class CgDisplay.
Second, each Xlib C function has been converted to a corresponding Smalltalk method. To understand this conversion, consider the following standard Xlib function XDrawRectangle:
XDrawRectangle(display, drawable, gc, x, y, width, height);
In the Common Graphics subsystem, this function has been converted to the following method:
CgDrawable>>#drawRectangle: gc x: x y: y width: width height: height.
In translating C Xlib functions to Smalltalk, two rules have been applied: