Contents Up Previous Next

Device context overview

wxCLIPS function groups: DC, PostScriptDC, MetaFileDC, MemoryDC, PrinterDC

wxCOOL classes: wxDC, wxPostScriptDC, wxMetaFileDC, wxMemoryDC, wxPrinterDC

A device context is an abstraction of all the devices that can be drawn onto, such as PostScript file, canvas, printer, metafile, and bitmap. Instead of drawing directly on one of these devices, the application programmer can write a function that writes to a device context, and then pass any device context to that function. The most frequently used device context is probably the canvas device context. This cannot be created by an application but can be retrieved from a canvas by calling canvas-get-dc.

At present, wxCLIPS supports the canvas, memory, PostScript, Windows printer and Windows metafile device contexts.

When writing code to draw into a device context, use a device context variable as a parameter whenever possible, to allow the most general use of your drawing code. You can then pass a device context object of any derived type.