Programming Guide:xppguide

Graphic primitives Foundation

"Graphic primitives" are required to produce graphics. They are functions that draw elementary graphic figures, like lines, circles and rectangles. They always draw in a presentation space which displays itself in a device context that makes the result of graphic primitives visible on a physical output device.

Graphic primitives are the basic building blocks for graphic output. The GRA engine makes use of the six graphic primitives listed in the following table:

Graphic primitives
Function Description
GraMarker() Draws marker
GraLine() Draws line
GraBox() Draws box or rectangle
GraStringAt() Draws character string
GraSpline() Draws curve (Splines)
GraArc() Draws circle, arc or ellipse
GraQueryTextBox() Returns the coordinates of a character string

The functions in this table draw six elementary graphic figures: markers, lines, rectangles, circles, splines and character strings. The function GraQueryTextBox() is not a graphic primitive and does not display anything. This function determines the coordinates of the area occupied by a character string when it is output. This is significant for correct positioning of character strings on the display, especially with proportional fonts. The following illustration shows the result of various graphic primitives.

Output of graphic primitives

This illustration shows a few of the possibilities provided by the GRA engine through its graphic primitives. The illustration is created using Xbase++ and contains four examples. In the upper left quadrant lines, splines and markers are shown (the GraMarker(), GraLine() and GraSpline() functions). The upper right quadrant is drawn using GraStringAt(), GraQueryTextBox() and GraBox(). In the bottom half of the illustration two business graphs are shown. The bar graph is drawn mainly using GraBox() and GraLine() and the pie chart uses the function GraArc().


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.