.. 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.GCDC.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.GCDC.FloodFill`  method is not, and can't be, implemented, as its functionality relies on reading the pixels from :ref:`wx.GraphicsContext`  too. 
- :meth:`~wx.GCDC.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.GCDC.Blit`  and :meth:`~wx.GCDC.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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GCDC</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.GCDC_inheritance.png" alt="Inheritance diagram of GCDC" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.GCDC.html" title="wx.GCDC" alt="" coords="7,160,90,189"/> <area shape="rect" id="node2" href="wx.DC.html" title="wx.DC" alt="" coords="13,83,85,112"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> </map> 
   </p>
   </div>

|


|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:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, windowDC)`
      
      Constructs a :ref:`wx.GCDC`  from a :ref:`wx.WindowDC`.                  
      
      
      :param `windowDC`: 
      :type `windowDC`: wx.WindowDC
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, memoryDC)`
      
      Constructs a :ref:`wx.GCDC`  from a :ref:`wx.MemoryDC`.                  
      
      
      :param `memoryDC`: 
      :type `memoryDC`: wx.MemoryDC
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, printerDC)`
      
      Constructs a :ref:`wx.GCDC`  from a :ref:`wx.PrinterDC`.                  
      
      
      :param `printerDC`: 
      :type `printerDC`: wx.PrinterDC
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__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:`SetFont` , :meth:`SetPen`   or :meth:`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:`GetFont` , :meth:`GetPen`   and :meth:`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:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. 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`

