.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.ReadOnlyDC: ========================================================================================================================================== |phoenix_title| **wx.ReadOnlyDC** ========================================================================================================================================== Base class for device context not providing any drawing functions. Objects of this class can't be created directly, please see :ref:`wx.DC` for the description of how to create objects of the derived classes. Please note that all wxWidgets functions taking parameters of this type added before wxWidgets 3.3.0 used to take :ref:`wx.DC` instead and that they can still be called with :ref:`wx.DC` objects, as :ref:`wx.DC` inherits from :ref:`wx.ReadOnlyDC`. .. versionadded:: 4.3/wxWidgets-3.3.0 | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class ReadOnlyDC:
| |sub_classes| Known Subclasses ============================== :ref:`wx.DC`, `InfoDC` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.ReadOnlyDC.CanDrawBitmap` Does the DC support drawing bitmaps? :meth:`~wx.ReadOnlyDC.CanGetTextExtent` Does the DC support calculating the size required to draw text? :meth:`~wx.ReadOnlyDC.CanUseTransformMatrix` Check if the use of transformation matrix is supported by the current system. :meth:`~wx.ReadOnlyDC.DeviceToLogical` Converts device (`x`, `y`) coordinates to logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. :meth:`~wx.ReadOnlyDC.DeviceToLogicalRel` Converts device `x`, `y` coordinates to relative logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. :meth:`~wx.ReadOnlyDC.DeviceToLogicalX` Convert `device` X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :meth:`~wx.ReadOnlyDC.DeviceToLogicalXRel` Convert `device` X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. :meth:`~wx.ReadOnlyDC.DeviceToLogicalY` Converts `device` Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :meth:`~wx.ReadOnlyDC.DeviceToLogicalYRel` Convert `device` Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. :meth:`~wx.ReadOnlyDC.FromDIP` Convert DPI-independent pixel values to the value in pixels appropriate for the DC. :meth:`~wx.ReadOnlyDC.GetCharHeight` Gets the character height of the currently set font. :meth:`~wx.ReadOnlyDC.GetCharWidth` Gets the average character width of the currently set font. :meth:`~wx.ReadOnlyDC.GetContentScaleFactor` Returns the factor used for converting logical pixels to physical ones. :meth:`~wx.ReadOnlyDC.GetDepth` Returns the depth (number of bits/pixel) of this DC. :meth:`~wx.ReadOnlyDC.GetDeviceOrigin` Returns the current device origin. :meth:`~wx.ReadOnlyDC.GetFont` Gets the current font. :meth:`~wx.ReadOnlyDC.GetFontMetrics` Returns the various font characteristics. :meth:`~wx.ReadOnlyDC.GetLayoutDirection` Gets the current layout direction of the device context. :meth:`~wx.ReadOnlyDC.GetLogicalOrigin` Return the coordinates of the logical point (0, 0). :meth:`~wx.ReadOnlyDC.GetLogicalScale` Return the scale set by the last call to :meth:`~ReadOnlyDC.SetLogicalScale` . :meth:`~wx.ReadOnlyDC.GetMapMode` Gets the current mapping mode for the device context. :meth:`~wx.ReadOnlyDC.GetFullMultiLineTextExtent` Gets the dimensions of the string as it would be drawn. :meth:`~wx.ReadOnlyDC.GetPPI` Returns the resolution of the device in pixels per inch. :meth:`~wx.ReadOnlyDC.GetPartialTextExtents` Fills the `widths` array with the widths from the beginning of `text` to the corresponding character of `text`. :meth:`~wx.ReadOnlyDC.GetSize` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :meth:`~wx.ReadOnlyDC.GetSizeMM` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :meth:`~wx.ReadOnlyDC.GetFullTextExtent` Gets the dimensions of the string as it would be drawn. :meth:`~wx.ReadOnlyDC.GetTransformMatrix` Return the transformation matrix used by this device context. :meth:`~wx.ReadOnlyDC.GetUserScale` Gets the current user scale factor. :meth:`~wx.ReadOnlyDC.IsOk` Returns ``True`` if the DC is ok to use. :meth:`~wx.ReadOnlyDC.LogicalToDevice` Converts logical (`x`, `y`) coordinates to device coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. :meth:`~wx.ReadOnlyDC.LogicalToDeviceRel` Converts logical `x`, `y` coordinates to relative device coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. :meth:`~wx.ReadOnlyDC.LogicalToDeviceX` Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :meth:`~wx.ReadOnlyDC.LogicalToDeviceXRel` Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. :meth:`~wx.ReadOnlyDC.LogicalToDeviceY` Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :meth:`~wx.ReadOnlyDC.LogicalToDeviceYRel` Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. :meth:`~wx.ReadOnlyDC.ResetTransformMatrix` Revert the transformation matrix to identity matrix. :meth:`~wx.ReadOnlyDC.SetAxisOrientation` Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis). :meth:`~wx.ReadOnlyDC.SetDeviceOrigin` Sets the device origin (i.e. the origin in pixels after scaling has been applied). :meth:`~wx.ReadOnlyDC.SetFont` Sets the current font for the DC. :meth:`~wx.ReadOnlyDC.SetLayoutDirection` Sets the current layout direction for the device context. :meth:`~wx.ReadOnlyDC.SetLogicalOrigin` Change the offset used for translating :ref:`wx.DC` coordinates. :meth:`~wx.ReadOnlyDC.SetLogicalScale` Set the scale to use for translating :ref:`wx.DC` coordinates to the physical pixels. :meth:`~wx.ReadOnlyDC.SetMapMode` The mapping mode of the device context defines the unit of measurement used to convert `logical` units to `device` units. :meth:`~wx.ReadOnlyDC.SetTransformMatrix` Set the transformation matrix. :meth:`~wx.ReadOnlyDC.SetUserScale` Sets the user scaling factor, useful for applications which require 'zooming'. :meth:`~wx.ReadOnlyDC.ToDIP` Convert pixel values of the current DC to DPI-independent pixel values. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.ReadOnlyDC.CharHeight` See :meth:`~wx.ReadOnlyDC.GetCharHeight` :attr:`~wx.ReadOnlyDC.CharWidth` See :meth:`~wx.ReadOnlyDC.GetCharWidth` :attr:`~wx.ReadOnlyDC.ContentScaleFactor` See :meth:`~wx.ReadOnlyDC.GetContentScaleFactor` :attr:`~wx.ReadOnlyDC.Depth` See :meth:`~wx.ReadOnlyDC.GetDepth` :attr:`~wx.ReadOnlyDC.DeviceOrigin` See :meth:`~wx.ReadOnlyDC.GetDeviceOrigin` :attr:`~wx.ReadOnlyDC.Font` See :meth:`~wx.ReadOnlyDC.GetFont` and :meth:`~wx.ReadOnlyDC.SetFont` :attr:`~wx.ReadOnlyDC.FontMetrics` See :meth:`~wx.ReadOnlyDC.GetFontMetrics` :attr:`~wx.ReadOnlyDC.LayoutDirection` See :meth:`~wx.ReadOnlyDC.GetLayoutDirection` and :meth:`~wx.ReadOnlyDC.SetLayoutDirection` :attr:`~wx.ReadOnlyDC.MapMode` See :meth:`~wx.ReadOnlyDC.GetMapMode` and :meth:`~wx.ReadOnlyDC.SetMapMode` :attr:`~wx.ReadOnlyDC.PPI` See :meth:`~wx.ReadOnlyDC.GetPPI` :attr:`~wx.ReadOnlyDC.Size` See :meth:`~wx.ReadOnlyDC.GetSize` :attr:`~wx.ReadOnlyDC.SizeMM` See :meth:`~wx.ReadOnlyDC.GetSizeMM` :attr:`~wx.ReadOnlyDC.TransformMatrix` See :meth:`~wx.ReadOnlyDC.GetTransformMatrix` and :meth:`~wx.ReadOnlyDC.SetTransformMatrix` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.ReadOnlyDC(Object) Base class for device context not providing any drawing functions. .. method:: CanDrawBitmap(self) Does the DC support drawing bitmaps? :rtype: `bool` .. method:: CanGetTextExtent(self) Does the DC support calculating the size required to draw text? :rtype: `bool` .. method:: CanUseTransformMatrix(self) Check if the use of transformation matrix is supported by the current system. This function returns ``True`` for MSW and GTK+ 3 platforms and since 3.1.1 also for :ref:`wx.GCDC` in all ports. :rtype: `bool` .. versionadded:: 2.9.2 .. method:: DeviceToLogical(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`

` **DeviceToLogical** `(self, x, y)` Converts device (`x`, `y`) coordinates to logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. :param `x`: :type `x`: int :param `y`: :type `y`: int :rtype: :ref:`wx.Point` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` **DeviceToLogical** `(self, pt)` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :param `pt`: :type `pt`: wx.Point :rtype: :ref:`wx.Point` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` .. method:: DeviceToLogicalRel(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`

` **DeviceToLogicalRel** `(self, x, y)` Converts device `x`, `y` coordinates to relative logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. Use this for converting distances like e.g. width and height. :param `x`: :type `x`: int :param `y`: :type `y`: int :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` **DeviceToLogicalRel** `(self, dim)` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :param `dim`: :type `dim`: wx.Size :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` .. method:: DeviceToLogicalX(self, x) Convert `device` X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :param `x`: :type `x`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: DeviceToLogicalXRel(self, x) Convert `device` X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. Use this for converting a horizontal distance like for example a width. :param `x`: :type `x`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: DeviceToLogicalY(self, y) Converts `device` Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :param `y`: :type `y`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: DeviceToLogicalYRel(self, y) Convert `device` Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. Use this for converting a vertical distance like for example a height. :param `y`: :type `y`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: FromDIP(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`

` **FromDIP** `(self, sz)` Convert DPI-independent pixel values to the value in pixels appropriate for the DC. See `Window.FromDIP(const` Size& sz) for more info about converting device independent pixel values. :param `sz`: :type `sz`: wx.Size :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.7 :html:`

` **FromDIP** `(self, pt)` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :param `pt`: :type `pt`: wx.Point :rtype: :ref:`wx.Point` :html:`

` **FromDIP** `(self, d)` Convert DPI-independent value in pixels to the value in pixels appropriate for the DC. This is the same as FromDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions. :param `d`: :type `d`: int :rtype: `int` .. versionadded:: 4.1/wxWidgets-3.1.7 :html:`

` .. method:: GetCharHeight(self) Gets the character height of the currently set font. :rtype: `int` .. method:: GetCharWidth(self) Gets the average character width of the currently set font. :rtype: `int` .. method:: GetContentScaleFactor(self) Returns the factor used for converting logical pixels to physical ones. Returns the same value as :meth:`wx.Window.GetDPIScaleFactor` for the device contexts associated with a window and the same value as :meth:`wx.Bitmap.GetScaleFactor` for the associated bitmap for :ref:`wx.MemoryDC`. :rtype: `float` .. versionadded:: 2.9.5 .. note:: Beware that since wxWidgets 3.1.6, this function does `not` return the same value as :meth:`wx.Window.GetContentScaleFactor` for the device contexts associated with the window. Unlike :ref:`wx.Window` method, it always returns the effective scale factor instead of always returning 1 on platforms where logical pixels are the same as physical ones, such as MSW. .. method:: GetDepth(self) Returns the depth (number of bits/pixel) of this DC. :rtype: `int` .. seealso:: `wx.DisplayDepth` .. method:: GetDeviceOrigin(self) Returns the current device origin. :rtype: :ref:`wx.Point` .. seealso:: :meth:`SetDeviceOrigin` .. method:: GetFont(self) Gets the current font. Notice that even although each device context object has some default font after creation, this method would return a `wx.NullFont` initially and only after calling :meth:`SetFont` a valid font is returned. :rtype: :ref:`wx.Font` .. method:: GetFontMetrics(self) Returns the various font characteristics. This method allows retrieving some of the font characteristics not returned by :meth:`GetTextExtent` , notably internal leading and average character width. Currently this method returns correct results only under wxMSW, in the other ports the internal leading will always be 0 and the average character width will be computed as the width of the character 'x'. :rtype: :ref:`wx.FontMetrics` .. versionadded:: 2.9.2 .. method:: GetLayoutDirection(self) Gets the current layout direction of the device context. On platforms where RTL layout is supported, the return value will either be ``Layout_LeftToRight`` or ``Layout_RightToLeft`` . If RTL layout is not supported, the return value will be ``Layout_Default`` . :rtype: :ref:`wx.LayoutDirection` .. seealso:: :meth:`SetLayoutDirection` .. method:: GetLogicalOrigin(self) Return the coordinates of the logical point (0, 0). :rtype: :ref:`Tuple[int, int]` .. seealso:: :meth:`SetLogicalOrigin` .. method:: GetLogicalScale(self) Return the scale set by the last call to :meth:`SetLogicalScale` . :rtype: :ref:`Tuple[float, float]` .. method:: GetMapMode(self) Gets the current mapping mode for the device context. :rtype: :ref:`wx.MappingMode` .. seealso:: :meth:`SetMapMode` .. method:: GetFullMultiLineTextExtent(self, string, font=nullptr) Gets the dimensions of the string as it would be drawn. The ``string`` parameter is the string to measure. The return value is a tuple of integer values consisting of ``widget``, ``height`` and ``heightLine``. The ``heightLine`` is the the height of a single line. If the optional parameter ``font`` is specified and valid, then it is used for the text extent calculation. Otherwise the currently selected font is. .. note:: This function works with both single-line and multi-line strings. .. seealso:: :class:`wx.Font`, :meth:`~wx.ReadOnlyDC.SetFont` :meth:`~wx.DC.GetPartialTextExtents, :meth:`~wx.DC.GetTextExtent` :param `string`: :type `string`: string :param `font`: :type `font`: wx.Font :rtype: :ref:`Tuple[int, int, int]` .. method:: GetPPI(self) Returns the resolution of the device in pixels per inch. :rtype: :ref:`wx.Size` .. method:: GetPartialTextExtents(self, text) Fills the `widths` array with the widths from the beginning of `text` to the corresponding character of `text`. The generic version simply builds a running total of the widths of each character using :meth:`GetTextExtent` , however if the various platforms have a native API function that is faster or more accurate than the generic implementation then it should be used instead. .. method:: GetSize(self) This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :rtype: :ref:`wx.Size` .. method:: GetSizeMM(self) This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :rtype: :ref:`wx.Size` .. method:: GetFullTextExtent(self, string, font=nullptr) Gets the dimensions of the string as it would be drawn. The ``string`` parameter is the string to measure. The return value is a tuple of integer values consisting of ``widget``, ``height``, ``decent`` and ``externalLeading``. The ``descent`` is the dimension from the baseline of the font to the bottom of the descender, and ``externalLeading`` is any extra vertical space added to the font by the font designer (usually is zero). If the optional parameter ``font`` is specified and valid, then it is used for the text extent calculation. Otherwise the currently selected font is. .. seealso:: :class:`wx.Font`, :meth:`~wx.ReadOnlyDC.SetFont` :meth:`~wx.DC.GetPartialTextExtents, :meth:`~wx.DC.GetMultiLineTextExtent` :param `string`: :type `string`: string :param `font`: :type `font`: wx.Font :rtype: :ref:`Tuple[int, int, int, int]` .. method:: GetTransformMatrix(self) Return the transformation matrix used by this device context. By default the transformation matrix is the identity matrix. :rtype: :ref:`wx.AffineMatrix2D` .. versionadded:: 2.9.2 .. method:: GetUserScale(self) Gets the current user scale factor. .. method:: IsOk(self) Returns ``True`` if the DC is ok to use. :rtype: `bool` .. method:: LogicalToDevice(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`

` **LogicalToDevice** `(self, x, y)` Converts logical (`x`, `y`) coordinates to device coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. :param `x`: :type `x`: int :param `y`: :type `y`: int :rtype: :ref:`wx.Point` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` **LogicalToDevice** `(self, pt)` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :param `pt`: :type `pt`: wx.Point :rtype: :ref:`wx.Point` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` .. method:: LogicalToDeviceRel(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`

` **LogicalToDeviceRel** `(self, x, y)` Converts logical `x`, `y` coordinates to relative device coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. Use this for converting distances like e.g. width and height. :param `x`: :type `x`: int :param `y`: :type `y`: int :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` **LogicalToDeviceRel** `(self, dim)` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :param `dim`: :type `dim`: wx.Size :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.5 :html:`

` .. method:: LogicalToDeviceX(self, x) Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :param `x`: :type `x`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: LogicalToDeviceXRel(self, x) Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. Use this for converting a horizontal distance like for example a width. :param `x`: :type `x`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: LogicalToDeviceY(self, y) Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. :param `y`: :type `y`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: LogicalToDeviceYRel(self, y) Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. Use this for converting a vertical distance like for example a height. :param `y`: :type `y`: int :rtype: `int` .. note:: Affine transformation applied to the coordinate system with :meth:`SetTransformMatrix` is not taken into account. .. method:: ResetTransformMatrix(self) Revert the transformation matrix to identity matrix. :rtype: `None` .. versionadded:: 2.9.2 .. method:: SetAxisOrientation(self, xLeftRight, yBottomUp) 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. :type `xLeftRight`: bool :param `yBottomUp`: True to set the y axis orientation to the natural bottom up orientation, ``False`` to invert it. :type `yBottomUp`: bool :rtype: `None` .. method:: SetDeviceOrigin(self, x, y) 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. :param `x`: :type `x`: int :param `y`: :type `y`: int :rtype: `None` .. method:: SetFont(self, font) Sets the current font for the DC. The `font` parameter should be valid, although in wxMSW port (only) the argument `wx.NullFont` is also accepted and resets the device context font to the default value used by the system (which is not generally useful). :param `font`: :type `font`: wx.Font :rtype: `None` .. seealso:: :ref:`wx.Font` .. method:: SetLayoutDirection(self, dir) Sets the current layout direction for the device context. :param `dir`: May be either ``Layout_Default`` , ``Layout_LeftToRight`` or ``Layout_RightToLeft`` . :type `dir`: wx.LayoutDirection :rtype: `None` .. seealso:: :meth:`GetLayoutDirection` .. method:: SetLogicalOrigin(self, x, y) Change the offset used for translating :ref:`wx.DC` coordinates. :param `x`: :type `x`: int :param `y`: :type `y`: int :rtype: `None` .. seealso:: :meth:`SetLogicalOrigin` , :meth:`SetDeviceOrigin` .. method:: SetLogicalScale(self, x, y) Set the scale to use for translating :ref:`wx.DC` coordinates to the physical pixels. The effect of calling this function is similar to that of calling :meth:`SetUserScale` . :param `x`: :type `x`: float :param `y`: :type `y`: float :rtype: `None` .. method:: SetMapMode(self, mode) The mapping mode of the device context defines the unit of measurement used to convert `logical` units to `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 :meth:`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. :param `mode`: :type `mode`: wx.MappingMode :rtype: `None` .. method:: SetTransformMatrix(self, matrix) Set the transformation matrix. If transformation matrix is supported on the current system, the specified `matrix` will be used to transform between :ref:`wx.DC` and physical coordinates. Otherwise the function returns ``False`` and doesn't change the coordinate mapping. :param `matrix`: :type `matrix`: wx.AffineMatrix2D :rtype: `bool` .. versionadded:: 2.9.2 .. method:: SetUserScale(self, xScale, yScale) Sets the user scaling factor, useful for applications which require 'zooming'. :param `xScale`: :type `xScale`: float :param `yScale`: :type `yScale`: float :rtype: `None` .. method:: ToDIP(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`

` **ToDIP** `(self, sz)` Convert pixel values of the current DC to DPI-independent pixel values. See `Window.ToDIP(const` Size& sz) for more info about converting device independent pixel values. :param `sz`: :type `sz`: wx.Size :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.7 :html:`

` **ToDIP** `(self, pt)` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. :param `pt`: :type `pt`: wx.Point :rtype: :ref:`wx.Point` :html:`

` **ToDIP** `(self, d)` Convert pixel values of the current DC to DPI-independent pixel values. This is the same as ToDIP(const Size& sz) overload, but assumes that the resolution is the same in horizontal and vertical directions. :param `d`: :type `d`: int :rtype: `int` .. versionadded:: 4.1/wxWidgets-3.1.7 :html:`

` .. attribute:: CharHeight See :meth:`~wx.ReadOnlyDC.GetCharHeight` .. attribute:: CharWidth See :meth:`~wx.ReadOnlyDC.GetCharWidth` .. attribute:: ContentScaleFactor See :meth:`~wx.ReadOnlyDC.GetContentScaleFactor` .. attribute:: Depth See :meth:`~wx.ReadOnlyDC.GetDepth` .. attribute:: DeviceOrigin See :meth:`~wx.ReadOnlyDC.GetDeviceOrigin` .. attribute:: Font See :meth:`~wx.ReadOnlyDC.GetFont` and :meth:`~wx.ReadOnlyDC.SetFont` .. attribute:: FontMetrics See :meth:`~wx.ReadOnlyDC.GetFontMetrics` .. attribute:: LayoutDirection See :meth:`~wx.ReadOnlyDC.GetLayoutDirection` and :meth:`~wx.ReadOnlyDC.SetLayoutDirection` .. attribute:: MapMode See :meth:`~wx.ReadOnlyDC.GetMapMode` and :meth:`~wx.ReadOnlyDC.SetMapMode` .. attribute:: PPI See :meth:`~wx.ReadOnlyDC.GetPPI` .. attribute:: Size See :meth:`~wx.ReadOnlyDC.GetSize` .. attribute:: SizeMM See :meth:`~wx.ReadOnlyDC.GetSizeMM` .. attribute:: TransformMatrix See :meth:`~wx.ReadOnlyDC.GetTransformMatrix` and :meth:`~wx.ReadOnlyDC.SetTransformMatrix`