+ wxCoord xsrcMask = wxDefaultCoord,
+ wxCoord ysrcMask = wxDefaultCoord);
+ //@}
+
+
+ /**
+ @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 (or another invalid brush; see wxBrush::IsOk),
+ 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 (or another invalid pen; see wxPen::IsOk),
+ the current pen is selected out of the device context (leaving wxDC without any
+ valid pen), allowing the current pen to be destroyed safely.
+
+ @see wxMemoryDC for the interpretation of colours when drawing into a
+ monochrome bitmap.
+ */
+ void SetPen(const wxPen& pen);
+
+ //@}
+
+
+ /**
+ Copy attributes from another DC.
+
+ The copied attributes currently are:
+ - Font
+ - Text foreground and background colours
+ - Background brush
+ - Layout direction
+
+ @param dc
+ A valid (i.e. its IsOk() must return @true) source device context.
+ */
+ void CopyAttributes(const wxDC& dc);
+
+ /**
+ 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().
+
+ @note This method shouldn't be used with wxPaintDC as accessing the DC
+ while drawing can result in unexpected results, notably in wxGTK.
+ */
+ 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
+
+ @beginWxPerlOnly
+ In wxPerl there are two methods instead of a single overloaded
+ method:
+ - GetSize(): returns a Wx::Size object.
+ - GetSizeWH(): returns a 2-element list (width, height).
+ @endWxPerlOnly
+ */
+ 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.
+
+ @beginWxPerlOnly
+ In wxPerl this method takes no arguments and return a two
+ element array (x, y).
+ @endWxPerlOnly
+
+ @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);
+
+
+ /**
+ @name Transformation matrix
+
+ See the notes about the availability of these functions in the class
+ documentation.
+ */
+ //@{
+
+ /**
+ Check if the use of transformation matrix is supported by the current
+ system.
+
+ Currently this function always returns @false for non-MSW platforms and
+ may return @false for old (Windows 9x/ME) Windows systems. Normally
+ support for the transformation matrix is always available in any
+ relatively recent Windows versions.
+
+ @since 2.9.2
+ */
+ bool CanUseTransformMatrix() const;
+
+ /**
+ Set the transformation matrix.
+
+ If transformation matrix is supported on the current system, the
+ specified @a matrix will be used to transform between wxDC and physical
+ coordinates. Otherwise the function returns @false and doesn't change
+ the coordinate mapping.
+
+ @since 2.9.2
+ */
+ bool SetTransformMatrix(const wxAffineMatrix2D& matrix);
+
+ /**
+ Return the transformation matrix used by this device context.
+
+ By default the transformation matrix is the identity matrix.
+
+ @since 2.9.2
+ */
+ wxAffineMatrix2D GetTransformMatrix() const;
+
+ /**
+ Revert the transformation matrix to identity matrix.
+
+ @since 2.9.2
+ */
+ void ResetTransformMatrix();
+
+ //@}
+
+
+ void SetLogicalScale(double x, double y);
+ void GetLogicalScale(double *x, double *y) const;
+ void SetLogicalOrigin(wxCoord x, wxCoord y);
+ void GetLogicalOrigin(wxCoord *x, wxCoord *y) const;
+ wxPoint GetLogicalOrigin() const;
+