.. 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.GCDC: ========================================================================================================================================== |phoenix_title| **wx.GCDC** ========================================================================================================================================== :ref:`wx.GCDC` is a device context that draws on a :ref:`wx.GraphicsContext`. :ref:`wx.GCDC` does its best to implement :ref:`wx.DC` API, but the following features are not (fully) implemented because :ref:`wx.GraphicsContext` doesn't support them: - :meth:`~wx.DC.GetPixel` method is not implemented and always returns ``False`` because modern graphics layers don't support retrieving the contents of the drawn pixels. - :meth:`~wx.DC.FloodFill` method is not, and can't be, implemented, as its functionality relies on reading the pixels from :ref:`wx.GraphicsContext` too. - :meth:`~wx.DC.SetLogicalFunction` method only works with ``COPY`` , ``OR`` , ``NO_OP`` , ``CLEAR`` and ``XOR`` functions, attempts to use any other function (including ``INVERT`` ) don't do anything. - Similarly, :ref:`wx.RasterOperationMode` parameter of :meth:`~wx.DC.Blit` and :meth:`~wx.DC.StretchBlit` can only be one of the supported logical functions listed above, using any other function will result in an assertion failure and not drawing anything. - For Direct2D-based :ref:`wx.GraphicsContext`, only true-type fonts can be used in the font-related functions. .. seealso:: :ref:`wx.DC`, :ref:`wx.GraphicsContext` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class GCDC:
| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.GCDC.__init__` Constructs a :ref:`wx.GCDC` from a :ref:`wx.WindowDC`. :meth:`~wx.GCDC.GetGraphicsContext` Retrieves associated :ref:`wx.GraphicsContext`. :meth:`~wx.GCDC.SetGraphicsContext` Set the graphics context to be used for this :ref:`wx.GCDC`. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.GCDC.GraphicsContext` See :meth:`~wx.GCDC.GetGraphicsContext` and :meth:`~wx.GCDC.SetGraphicsContext` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.GCDC(DC) **Possible constructors**:: GCDC(windowDC) GCDC(memoryDC) GCDC(printerDC) GCDC(context) GCDC() GCDC is a device context that draws on a GraphicsContext. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self, windowDC)` Constructs a :ref:`wx.GCDC` from a :ref:`wx.WindowDC`. :param `windowDC`: :type `windowDC`: wx.WindowDC :html:`

` **__init__** `(self, memoryDC)` Constructs a :ref:`wx.GCDC` from a :ref:`wx.MemoryDC`. :param `memoryDC`: :type `memoryDC`: wx.MemoryDC :html:`

` **__init__** `(self, printerDC)` Constructs a :ref:`wx.GCDC` from a :ref:`wx.PrinterDC`. :param `printerDC`: :type `printerDC`: wx.PrinterDC :html:`

` **__init__** `(self, context)` Construct a :ref:`wx.GCDC` from an existing graphics context. Note that this object takes ownership of `context` and will delete it when it is destroyed or when :meth:`SetGraphicsContext` is called with a different context object. Also notice that `context` will continue using the same font, pen and brush as before until :meth:`~wx.DC.SetFont` , :meth:`~wx.DC.SetPen` or :meth:`~wx.DC.SetBrush` is explicitly called to change them. This means that the code can use this DC-derived object to work using pens and brushes with alpha component, for example (which normally isn't supported by :ref:`wx.DC` API), but it also means that the return values of :meth:`~wx.DC.GetFont` , :meth:`~wx.DC.GetPen` and :meth:`~wx.DC.GetBrush` won't really correspond to the actually used objects because they simply can't represent them anyhow. If you wish to avoid such discrepancy, you need to call the setter methods to bring :ref:`wx.DC` and :ref:`wx.GraphicsContext` font, pen and brush in sync with each other. :param `context`: :type `context`: wx.GraphicsContext :html:`

` **__init__** `(self)` :html:`

` .. method:: GetGraphicsContext(self) Retrieves associated :ref:`wx.GraphicsContext`. :rtype: :ref:`wx.GraphicsContext` .. method:: SetGraphicsContext(self, context) Set the graphics context to be used for this :ref:`wx.GCDC`. Note that this object takes ownership of `context` and will delete it when it is destroyed or when :meth:`SetGraphicsContext` is called again. Also, unlike the constructor taking :ref:`wx.GraphicsContext`, this method will reapply the current font, pen and brush, so that this object continues to use them, if they had been changed before (which is never the case when constructing :ref:`wx.GCDC` directly from :ref:`wx.GraphicsContext`). :param `context`: :type `context`: wx.GraphicsContext .. attribute:: GraphicsContext See :meth:`~wx.GCDC.GetGraphicsContext` and :meth:`~wx.GCDC.SetGraphicsContext`