CD (Canvas Draw) is a platform-independent graphics library. Its drivers are implemented in several platforms, some use portable code, others use native graphics libraries, such as Microsoft Windows (GDI, Direct2D and GDI+) and X-Windows (XLIB).

The library contains functions to support both vector and raster primitives, and the visualization surface can be either a user interface window or a more abstract surface, such as Clipboard, Metafile, PS, and so on.

Furthermore, the list of parameters of the CD primitive functions contains only the geometrical descriptions of the objects (line, circle, text, etc.). Where these objects should appear and what is the their color, thickness, etc. are defined as current state variables stored in the visualization surfaces. That is, the library is visualization-surface oriented, meaning that all attributes are stored in each visualization surface.

CD is free software, can be used for public and commercial applications.


The library is available for several compilers:

The library is available for several operating systems:


The official support mechanism is by e-mail, using cd@tecgraf.puc-rio.br. Before sending your message:

After all of the above have been checked, report the problem, including in your message: function, element, driver, platform, and compiler.

We host the CD support features at SourceForge: http://sourceforge.net/projects/canvasdraw/. It provides us Mailing List, SVN Repository and Downloads.

The discussion list is available at: http://lists.sourceforge.net/lists/listinfo/canvasdraw-users.
Source code, pre-compiled binaries and documentation can be downloaded at: http://sourceforge.net/projects/canvasdraw/files/.
The SVN can be browsed at: https://sourceforge.net/p/canvasdraw/cd/.

If you want us to develop a specific feature for the library, Tecgraf is available for partnerships and cooperation.

Lua documentation and resources can be found at http://www.lua.org/.


This work was developed at Tecgraf by means of the partnership with PETROBRAS/CENPES.

Library Authors:

Thanks to the people that worked and contributed to the library:

We also thank the developers of the FreeType, FTGL, PDFlib, libJPEG and Mesa libraries, for making the source code available, which helped us improve our implementation of the Simulation driver and of the X-Windows driver. Thanks to Alan Richardson for the XVertex rotines. Thanks to Lode Vandevenne for the LodePNG module used in the SVG driver. Thanks to Jason Perkins for the Premake tool.

The CD distribution includes the FreeType library, this is a third party library not developed at Tecgraf. But its license is also free and have the same freedom as the Tecgraf Library License. You can read the Free Type license and copyright in the file freetype.txt. FreeType is copyright David Turner, Robert Wilhelm, and Werner Lemberg.

Mesa X-Windows utilities source code copyright Brian Paul. libJPEG quantization source code copyright Thomas G. Lane. XVertex routines source code copyright Alan Richardson.

Thanks for the SourceForge for hosting the support features. Thanks for the LuaForge team for previously hosting the support features for many years.

CD is registered at the National Institute of Intellectual Property in Brazil (INPI) under the number 07571-1, and so it is protected against illegal use. The registration is valid internationally. See the Tecgraf Library License for further usage information and Copyright.


This documentation is available at http://www.tecgraf.puc-rio.br/cd and http://canvasdraw.sourceforge.net/

The full documentation can be downloaded from the Download Files. The documentation is also available in Adobe Acrobat and Windows HTML Help formats.

The HTML navigation uses the WebBook tool, available at http://www.tecgraf.puc-rio.br/webbook.