+ //@}
+
+
+ /**
+ @name Background/foreground brush and pen
+ */
+ //@{
+
+ /**
+ Gets the brush used for painting the background.
+
+ @see wxDC::SetBackground()
+ */
+ const wxBrush& GetBackground() const;
+
+ /**
+ Gets the current brush.
+
+ @see wxDC::SetBrush()
+ */
+ const wxBrush& GetBrush() const;
+
+ /**
+ Gets the current pen.
+
+ @see SetPen()
+ */
+ const wxPen& GetPen() const;
+
+ /**
+ Sets the current background brush for the DC.
+ */
+ void SetBackground(const wxBrush& brush);
+
+ /**
+ Sets the current brush for the DC.
+
+ If the argument is wxNullBrush, the current brush is selected out of
+ the device context (leaving wxDC without any valid brush), allowing the
+ current brush to be destroyed safely.
+
+ @see wxBrush, wxMemoryDC (for the interpretation of colours when
+ drawing into a monochrome bitmap)
+ */
+ void SetBrush(const wxBrush& brush);
+
+ /**
+ Sets the current pen for the DC. If the argument is wxNullPen, the
+ current pen is selected out of the device context (leaving wxDC without
+ any valid pen), allowing the current brush to be destroyed safely.
+
+ @see wxMemoryDC for the interpretation of colours when drawing into a
+ monochrome bitmap.
+ */
+ void SetPen(const wxPen& pen);
+
+ //@}
+
+
+
+ /**
+ Returns the depth (number of bits/pixel) of this DC.
+
+ @see wxDisplayDepth()
+ */
+ int GetDepth() const;
+
+ /**
+ Returns the current device origin.
+
+ @see SetDeviceOrigin()
+ */
+ wxPoint GetDeviceOrigin() const;
+
+ /**
+ Gets the current logical function.
+
+ @see SetLogicalFunction()
+ */
+ wxRasterOperationMode GetLogicalFunction() const;
+
+ /**
+ Gets the current mapping mode for the device context.
+
+ @see SetMapMode()
+ */
+ wxMappingMode GetMapMode() const;
+
+ /**
+ Gets in @a colour the colour at the specified location. Not available
+ for wxPostScriptDC or wxMetafileDC.
+
+ @note Setting a pixel can be done using DrawPoint().
+
+ @beginWxPythonOnly
+ The wxColour value is returned and is not required as a parameter.
+ @endWxPythonOnly
+ */
+ bool GetPixel(wxCoord x, wxCoord y, wxColour* colour) const;
+
+ /**
+ Returns the resolution of the device in pixels per inch.
+ */
+ wxSize GetPPI() const;
+
+ /**
+ Gets the horizontal and vertical extent of this device context in @e device units.
+ It can be used to scale graphics to fit the page.
+
+ For example, if @e maxX and @e maxY represent the maximum horizontal
+ and vertical 'pixel' values used in your application, the following
+ code will scale the graphic to fit on the printer page:
+
+ @code
+ wxCoord w, h;
+ dc.GetSize(&w, &h);
+ double scaleX = (double)(maxX / w);
+ double scaleY = (double)(maxY / h);
+ dc.SetUserScale(min(scaleX, scaleY),min(scaleX, scaleY));
+ @endcode
+
+ @beginWxPythonOnly
+ In place of a single overloaded method name, wxPython implements the
+ following methods:
+ - GetSize() - Returns a wxSize.
+ - GetSizeWH() - Returns a 2-tuple (width, height).
+ @endWxPythonOnly
+ */
+ void GetSize(wxCoord* width, wxCoord* height) const;
+
+ /**
+ @overload
+ */
+ wxSize GetSize() const;
+
+ /**
+ Returns the horizontal and vertical resolution in millimetres.
+ */
+ void GetSizeMM(wxCoord* width, wxCoord* height) const;
+
+ /**
+ @overload
+ */
+ wxSize GetSizeMM() const;
+
+ /**
+ Gets the current user scale factor.
+
+ @see SetUserScale()
+ */
+ void GetUserScale(double* x, double* y) const;
+
+ /**
+ Returns @true if the DC is ok to use.
+ */
+ bool IsOk() const;
+
+ /**
+ Sets the x and y axis orientation (i.e., the direction from lowest to
+ highest values on the axis). The default orientation is x axis from
+ left to right and y axis from top down.
+
+ @param xLeftRight
+ True to set the x axis orientation to the natural left to right
+ orientation, @false to invert it.
+ @param yBottomUp
+ True to set the y axis orientation to the natural bottom up
+ orientation, @false to invert it.
+ */
+ void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
+
+ /**
+ Sets the device origin (i.e., the origin in pixels after scaling has
+ been applied). This function may be useful in Windows printing
+ operations for placing a graphic on a page.
+ */
+ void SetDeviceOrigin(wxCoord x, wxCoord y);
+
+ /**
+ Sets the current logical function for the device context.
+ It determines how a @e source pixel (from a pen or brush colour, or source
+ device context if using Blit()) combines with a @e destination pixel in
+ the current device context.
+ Text drawing is not affected by this function.
+
+ See ::wxRasterOperationMode enumeration values for more info.
+
+ The default is @c wxCOPY, which simply draws with the current colour.
+ The others combine the current colour and the background using a logical
+ operation. @c wxINVERT is commonly used for drawing rubber bands or moving
+ outlines, since drawing twice reverts to the original colour.
+ */
+ void SetLogicalFunction(wxRasterOperationMode function);
+
+ /**
+ The mapping mode of the device context defines the unit of measurement
+ used to convert @e logical units to @e device units.
+
+ Note that in X, text drawing isn't handled consistently with the mapping mode;
+ a font is always specified in point size. However, setting the user scale (see
+ SetUserScale()) scales the text appropriately. In Windows, scalable
+ TrueType fonts are always used; in X, results depend on availability of
+ fonts, but usually a reasonable match is found.
+
+ The coordinate origin is always at the top left of the screen/printer.
+
+ Drawing to a Windows printer device context uses the current mapping
+ mode, but mapping mode is currently ignored for PostScript output.
+ */
+ void SetMapMode(wxMappingMode mode);
+
+ /**
+ If this is a window DC or memory DC, assigns the given palette to the
+ window or bitmap associated with the DC. If the argument is
+ ::wxNullPalette, the current palette is selected out of the device
+ context, and the original palette restored.
+
+ @see wxPalette
+ */
+ void SetPalette(const wxPalette& palette);
+
+ /**
+ Sets the user scaling factor, useful for applications which require
+ 'zooming'.
+ */
+ void SetUserScale(double xScale, double yScale);