phoenix_title wx.GCDC

wx.GCDC is a device context that draws on a wx.GraphicsContext.

wx.GCDC does its best to implement wx.DC API, but the following features are not (fully) implemented because wx.GraphicsContext doesn’t support them:

  • GetPixel method is not implemented and always returns False because modern graphics layers don’t support retrieving the contents of the drawn pixels.

  • FloodFill method is not, and can’t be, implemented, as its functionality relies on reading the pixels from wx.GraphicsContext too.

  • 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, wx.RasterOperationMode parameter of Blit and 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 wx.GraphicsContext, only true-type fonts can be used in the font-related functions.


class_hierarchy Class Hierarchy

Inheritance diagram for class GCDC:

method_summary Methods Summary

__init__

Constructs a wx.GCDC from a wx.WindowDC.

GetGraphicsContext

Retrieves associated wx.GraphicsContext.

SetGraphicsContext

Set the graphics context to be used for this wx.GCDC.


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.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, windowDC)

Constructs a wx.GCDC from a wx.WindowDC.

Parameters

windowDC (wx.WindowDC) –



__init__ (self, memoryDC)

Constructs a wx.GCDC from a wx.MemoryDC.

Parameters

memoryDC (wx.MemoryDC) –



__init__ (self, printerDC)

Constructs a wx.GCDC from a wx.PrinterDC.

Parameters

printerDC (wx.PrinterDC) –



__init__ (self, context)

Construct a 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 SetGraphicsContext is called with a different context object.

Also notice that context will continue using the same font, pen and brush as before until SetFont , SetPen or 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 wx.DC API), but it also means that the return values of GetFont , GetPen and 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 wx.DC and wx.GraphicsContext font, pen and brush in sync with each other.

Parameters

context (wx.GraphicsContext) –



__init__ (self)





GetGraphicsContext(self)

Retrieves associated wx.GraphicsContext.

Return type

wx.GraphicsContext



SetGraphicsContext(self, context)

Set the graphics context to be used for this wx.GCDC.

Note that this object takes ownership of context and will delete it when it is destroyed or when SetGraphicsContext is called again.

Also, unlike the constructor taking 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 wx.GCDC directly from wx.GraphicsContext).

Parameters

context (wx.GraphicsContext) –


Properties

GraphicsContext

See GetGraphicsContext and SetGraphicsContext