A wxDC (device context) is an abstraction of a surface that can be drawn onto.
The following functions can be used with any device context identifier, with the exception of blit which must not be used with a PostScript device context, and get-text-extent-width, get-text-extent-height which do not function correctly on PostScript or metafile device contexts.
wxDC begin-drawing
wxDC blit
wxDC clear
wxDC destroy-clipping-region
wxDC draw-ellipse
wxDC draw-line
wxDC draw-lines
wxDC draw-point
wxDC draw-polygon
wxDC draw-rectangle
wxDC draw-rounded-rectangle
wxDC draw-text
wxDC draw-spline
wxDC end-doc
wxDC end-drawing
wxDC end-page
wxDC get-min-x
wxDC get-min-y
wxDC get-max-x
wxDC get-max-y
wxDC get-text-extent-height
wxDC get-text-extent-width
wxDC ok
wxDC start-doc
wxDC start-page
wxDC set-background
wxDC set-background-mode
wxDC set-brush
wxDC set-colourmap
wxDC set-clipping-region
wxDC set-font
wxDC set-logical-function
wxDC set-pen
wxDC set-text-foreground
wxDC set-text-background
bool ( begin-drawing)
Bracket a series of drawing primitives in begin-drawing and end-drawing to optimize drawing under Windows, and also if drawing to a panel or dialog box context, for which these calls are mandatory. The calls may be nested.
bool ( blit double dest-x double dest-y double width double height wxDC source-dc double source-x double source-y string logical-op = "wxCOPY")
Block-copies the given area from a source device context to a destination device context (the current object). This operation is not available to PostScript and Windows Metafile destination device contexts.
The argument logical-op sets the current logical function for the canvas. This determines how a source pixel from the source device context combines with a destination pixel in the current device context. It will most commonly be "wxCOPY", which simply draws with the current source pixels.
The possible values and their meaning in terms of source and destination pixel values are as follows:
wxAND src AND dst wxAND_INVERT (NOT src) AND dst wxAND_REVERSE src AND (NOT dst) wxCLEAR 0 wxCOPY src wxEQUIV (NOT src) XOR dst wxINVERT NOT dst wxNAND (NOT src) OR (NOT dst) wxNOR (NOT src) AND (NOT dst) wxNO_OP dst wxOR src OR dst wxOR_INVERT (NOT src) OR dst wxOR_REVERSE src OR (NOT dst) wxSET 1 wxSRC_INVERT NOT src wxXOR src XOR dstThe most commonly used is wxCOPY. The others combine the current colour and the background using a logical operation. wxXOR is commonly used for drawing rubber bands or moving outlines, since drawing twice reverts to the original colour.
bool ( wxDC clear)
Clears the device context using the background colour.
bool ( destroy-clipping-region)
Destroys the current clipping region.
bool ( draw-ellipse double x double y double width double height)
Draws an ellipse. The outline and filling attributes are determined by the pen and brush settings respectively.
bool ( draw-line double x1 double y1 double x2 double y2)
Draws a line between the given points.
bool ( draw-lines multifield list)
Draws lines between the given points. list is a multifield, which can be created by a call to mv-append and a list of arguments. The list must contain an even number of floating-point values, interpreted in pairs as the points determining the multiline.
bool ( dc-draw-point double x double y)
Draws a point.
bool ( draw-polygon multifield list)
Draws a (possibly filled) polygon. list is a multifield, which can be created by a call to mv-append and a list of arguments. The list must contain an even number of floating-point values, interpreted in pairs as the points determining the polygon. The outline and filling attributes are determined by the pen and brush settings respectively.
bool ( draw-rectangle double x double y double width double height)
Draws a rectangle. The outline and filling attributes are determined by the pen and brush settings respectively.
bool ( draw-rounded-rectangle double x double y double width double height double radius)
Draws a rounded rectangle, with corners with a specified radius (optional). The outline and filling attributes are determined by the pen and brush settings respectively.
bool ( dc-draw-text string text double x double y)
Draw text at the given position, using the font set by set-font, and using the colours set by set-text-foreground and set-text-background respectively.
bool ( draw-spline multifield list)
Draws a spline curve. list is a multifield, which can be created by a call to mv-append and a list of arguments. The list must contain an even number of floating-point values, interpreted in pairs as the points determining the spline shape.
bool ( end-doc)
Ends a document (such as a PostScript or Windows printer document).
bool ( end-drawing)
Bracket a series of drawing primitives in begin-drawing and end-drawing to optimize drawing under Windows, and also if drawing to a panel or dialog box context, for which these calls are mandatory. The calls may be nested.
bool ( end-page)
Ends a page.
double ( get-min-x)
Returns the minimum X value drawn so far on the device context.
double ( get-min-y)
Returns the minimum Y value drawn so far on the device context.
double ( get-max-x)
Returns the maximum X value drawn so far on the device context.
double ( get-max-y)
Returns the maximum Y value drawn so far on the device context.
double ( get-text-extent-height string text)
Returns the height of the text as drawn on this device context, in logical units.
double ( get-text-extent-width string text)
Returns the width of the text as drawn on this device context, in logical units.
bool ( ok)
Returns TRUE if the device context is OK (usually meaning, it has been initialised correctly), and FALSE otherwise.
bool ( start-doc string message)
Starts a document (such as a PostScript or Windows printer document) using the given string for any associated message box (the message is not in fact currently used).
bool ( start-page)
Starts a page.
bool ( set-background long brush)
Sets the background brush.
bool ( set-background-mode string mode)
Sets the mode for drawing text background.
mode may be wxSOLID (use the text background colour) or wxTRANSPARENT (do not fill the background).
bool ( set-brush wxBrush brush)
Sets the current brush for the device context. brush is a wxBrush object, or nil t select any existing brush out of the device context.
bool ( set-colourmap wxColourMap cmap)
Sets the colourmap for the device context. If cmap is nil, the original colourmap is restored so that it is safe to delete the device context (or colourmap).
bool ( set-clipping-region double x1 double y1 double x2 double y2)
Sets a rectangular clipping region, outside which drawing operations have no effect.
bool ( set-font long font)
Sets the current font for the device context. font is a wxFont object, or nil to select any existing font out of the device context.
bool ( set-logical-function string logical-function)
Sets the current logical function for the device context. The logical function determines how pixels are changed by the drawing functions, and may be one of wxCOPY, wxXOR, wxINVERT, wxOR_REVERSE and wxAND_REVERSE.
bool ( set-pen long pen)
Sets the current pen for the device context. pen is a wxPen object, or nil to select any existing pen out of the device context.
bool ( set-text-foreground string colour)
Sets the colour for the text foreground, effective when draw-text is used. colour is a capitalized name from the list defined in the wxWindows manual.
bool ( set-text-background string colour)
Sets the colour for the text background, effective when draw-text is used. colour is a capitalized name from the list defined in the wxWindows manual.