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 returnsFalse
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 withCOPY
,OR
,NO_OP
,CLEAR
andXOR
functions, attempts to use any other function (includingINVERT
) don’t do anything.Similarly, wx.RasterOperationMode parameter of
Blit
andStretchBlit
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.
See also
Class Hierarchy¶
Methods Summary¶
Constructs a wx.GCDC from a wx.WindowDC. |
|
Retrieves associated wx.GraphicsContext. |
|
Set the graphics context to be used for this wx.GCDC. |
Properties Summary¶
See |
Class API¶
- class wx.GCDC(DC)¶
Possible constructors:
GCDC(windowDC) -> None GCDC(memoryDC) -> None GCDC(printerDC) -> None GCDC(context) -> None GCDC() -> None
GCDC is a device context that draws on a GraphicsContext.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self, windowDC)
Constructs a wx.GCDC from a wx.WindowDC.
- Parameters:
windowDC (wx.WindowDC)
- Return type:
None
__init__ (self, memoryDC)
Constructs a wx.GCDC from a wx.MemoryDC.
- Parameters:
memoryDC (wx.MemoryDC)
- Return type:
None
__init__ (self, printerDC)
Constructs a wx.GCDC from a wx.PrinterDC.
- Parameters:
printerDC (wx.PrinterDC)
- Return type:
None
__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
orSetBrush
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 ofGetFont
,GetPen
andGetBrush
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)
- Return type:
None
__init__ (self)
- Return type:
None
- GetGraphicsContext(self)¶
Retrieves associated wx.GraphicsContext.
- Return type:
- 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)
- Return type:
None
Properties¶
- GraphicsContext¶
See
GetGraphicsContext
andSetGraphicsContext