ai-content-maker/.venv/Lib/site-packages/matplotlib/backends/backend_wxcairo.py

24 lines
848 B
Python
Raw Normal View History

2024-05-03 04:18:51 +03:00
import wx.lib.wxcairo as wxcairo
from .backend_cairo import cairo, FigureCanvasCairo
from .backend_wx import _BackendWx, _FigureCanvasWxBase
from .backend_wx import ( # noqa: F401 # pylint: disable=W0611
NavigationToolbar2Wx as NavigationToolbar2WxCairo)
class FigureCanvasWxCairo(FigureCanvasCairo, _FigureCanvasWxBase):
def draw(self, drawDC=None):
size = self.figure.bbox.size.astype(int)
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, *size)
self._renderer.set_context(cairo.Context(surface))
self._renderer.dpi = self.figure.dpi
self.figure.draw(self._renderer)
self.bitmap = wxcairo.BitmapFromImageSurface(surface)
self._isDrawn = True
self.gui_repaint(drawDC=drawDC)
@_BackendWx.export
class _BackendWxCairo(_BackendWx):
FigureCanvas = FigureCanvasWxCairo