3
$ßL]V  ã               @   sp   d dl Z ddlmZ ddlmZmZmZmZ G dd„ deƒZ	G dd„ deeƒZ
d	d
„ ZejG dd„ deƒƒZdS )é    Né   )ÚFigureCanvasAgg)Ú
_BackendWxÚ_FigureCanvasWxBaseÚFigureFrameWxÚNavigationToolbar2Wxc               @   s   e Zd Zdd„ ZdS )ÚFigureFrameWxAggc             C   s   t | d|ƒS )Nr   éÿÿÿÿ)ÚFigureCanvasWxAgg)ÚselfZfig© r   úI/tmp/pip-install-edjban26/matplotlib/matplotlib/backends/backend_wxagg.pyÚ
get_canvas
   s    zFigureFrameWxAgg.get_canvasN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   	   s   r   c               @   s$   e Zd ZdZddd„Zddd„ZdS )	r
   ad  
    The FigureCanvas contains the figure and does event handling.

    In the wxPython backend, it is derived from wxPanel, and (usually)
    lives inside a frame instantiated by a FigureManagerWx. The parent
    window probably implements a wxSizer to control the displayed
    control size - but we give a hint as to our preferred minimum
    size.
    Nc             C   s2   t j| ƒ t| jƒ dƒ| _d| _| j|dd� dS )z.
        Render the figure using agg.
        NTZWXAgg)ÚdrawDCÚorigin)r   ÚdrawÚ_convert_agg_to_wx_bitmapÚget_rendererÚbitmapZ_isDrawnÚgui_repaint)r   r   r   r   r   r      s    
zFigureCanvasWxAgg.drawc             C   sÒ   |dkr$t | jƒ dƒ| _| jƒ  dS |j\}}}}|| }|| }t|ƒ}t| jjƒ | ƒ}	t | jƒ dƒ}
tjƒ }|j	|
ƒ tjƒ }|j	| jƒ |j
||	t|ƒt|ƒ|||	ƒ |j	tjƒ |j	tjƒ | jƒ  dS )z’
        Transfer the region of the agg buffer defined by bbox to the display.
        If bbox is None, the entire buffer is transferred.
        N)r   r   r   r   ÚboundsÚintZ	GetHeightÚwxÚMemoryDCÚSelectObjectÚBlitÚ
NullBitmap)r   ÚbboxÚlÚbÚwÚhÚrÚtÚxÚyÚsrcBmpÚsrcDCÚdestDCr   r   r   Úblit#   s$    
zFigureCanvasWxAgg.blit)N)N)r   r   r   Ú__doc__r   r,   r   r   r   r   r
      s   	

r
   c             C   sö   |dkr(t jjt| jƒt| jƒ| jƒ ƒS |j\}}}}|| }|| }t jjt| jƒt| jƒ| jƒ ƒ}t jƒ }	|	j	|ƒ t jt|ƒt|ƒƒ}
t jƒ }|j	|
ƒ t|ƒ}tt| jƒ| ƒ}|j
ddt|ƒt|ƒ|	||ƒ |	j	t jƒ |j	t jƒ |
S dS )z¾
    Convert the region of the agg buffer bounded by bbox to a wx.Bitmap.  If
    bbox is None, the entire buffer is converted.
    Note: agg must be a backend_agg.RendererAgg instance.
    Nr   )r   ZBitmapZFromBufferRGBAr   ÚwidthÚheightZbuffer_rgbar   r   r   r   r   )Zaggr    r!   r"   r.   r/   r%   r&   r)   r*   ZdestBmpr+   r'   r(   r   r   r   r   A   s&    



r   c               @   s   e Zd ZeZeZdS )Ú_BackendWxAggN)r   r   r   r
   ZFigureCanvasr   Z_frame_classr   r   r   r   r0   d   s   r0   )r   Zbackend_aggr   Z
backend_wxr   r   r   r   ZNavigationToolbar2WxAggr   r
   r   Úexportr0   r   r   r   r   Ú<module>   s   3#