|$Mc@ sddlmZddlZddlZddlmZddlmZmZm Z m Z m Z ddlm Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZddlZdd lmZd e fdYZeZdefdYZdejefdYZ dZ!dZ"dej#e fdYZ$dej%e fdYZ&dej'fdYZ(dej e fdYZ)e&Z%dS(i(tdivisionN(tGcf(t RendererBasetGraphicsContextBasetFigureManagerBasetFigureCanvasBasetNavigationToolbar2(tShowBase(tmaxdict(tFigure(tPath(tMathTextParser(tcolorConverter(t SubplotTool(t_macosxtShowcB seZdZRS(cC stjdS(N(Rtshow(tself((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytmainloops(t__name__t __module__R(((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRst RendererMaccB seZdZedZdZdZddZddZ dZ dZ dZ d Z d Zd Zed Zd ZdZdZdZRS(s The renderer handles drawing/rendering operations. Most of the renderer's methods forward the command to the renderer's graphics context. The renderer does not wrap a C object and is written in pure Python. i2cC sGtj|||_||_||_t|_td|_dS(NtMacOSX( Rt__init__tdpitwidththeighttGraphicsContextMactgcR tmathtext_parser(RRRR((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR's      cC s|||_|_dS(N(RR(RRR((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytset_width_height/scC sE|dk rt|d }n|j}|j||||dS(Ni(tNonettuplet get_linewidtht draw_path(RRtpatht transformtrgbFacet linewidth((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR"2s  cC sK|dk rt|d }n|j}|j||||||dS(Ni(RR R!t draw_markers(RRt marker_patht marker_transR#ttransR%R&((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR'8s  c  C s|j} |j\}}|rLg|D]}tj||^q+}n |g}|j| ||||||||| | | dS(N(tget_clip_rectanglet get_clip_pathtnumpytdottdraw_path_collection(RRtmaster_transformtpathstall_transformstoffsetst offsetTranst facecolorst edgecolorst linewidthst linestylest antialiasedsturlstcliprecttclippathtclippath_transformttt transforms((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR/>s" (  c  C sP|j} |j\} } |j|| | | ||||||| | dS(N(R+R,tdraw_quad_mesh(RRR0t meshWidtht meshHeightt coordinatesR3R4R5t antialiasedt showedgesR;R<R=((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR@Ts  cC s$|jj|jjd|jS(N(Rtsavet set_hatchR(R((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytnew_gcfs cC sX|j|j\}}}|j||||||j|j|jdS(N(t flipud_outt as_rgba_strt draw_imageR+R,(RRtxtytimtnrowstncolstdata((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRKks   c C s|j}|j}|||j||jf} |jj| } | dkr|j|||j} tj d| dtj } n|j |||| dS(Ngo@( tget_size_in_pointstget_texmanagerRtget_font_configttexdtgetRtget_greyR-tarraytuint8t draw_mathtext( RRRLRMtstproptangletsizet texmanagertkeyRNtZ((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytdraw_texrs    cC sT|jj||j|\}}} } } } } |j|||d| jdS(Ni(RtparseRRZtas_array(RRRLRMR[R\R]toxtoyRRtdescenttimagetused_characters((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyt_draw_mathtext~s0c C s|r%|j||||||ng|j}|j} |j} |j} |j| } |j||t||| | | |dS(N(Rjt get_familyt get_weightt get_styleRRtpoints_to_pixelst draw_texttunicode( RRRLRMR[R\R]tismathtfamilytweighttstyletpointsR^((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRos    cC s|dkrR|j}|j}|j||d|\}}}|||fS|r|jj||j|\} } } } } }}| | | fS|j}|j}|j}|j}|j |}|j jt |||||\} } } | | d| fS(NtTeXtrendererg( RSRRtget_text_width_height_descentRRcRRkRlRmRnRRp(RR[R\RqR_tfontsizetwthtdReRfRRRgtfontsRiRrRsRtRuR^((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRxs     0     -cC stS(N(tFalse(R((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytflipyscC s|d|jS(NgR@(R(RRu((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRnscC stS(N(tTrue(R((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytoption_image_nocompositesN(RRt__doc__RRURRRR"R'R/R@RHRKRbRjR~RoRxRRnR(((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRs"             RcB sGeZdZdZdZedZdZdZdZ RS(s4 The GraphicsContext wraps a Quartz graphics context. All methods are implemented at the C-level in macosx.GraphicsContext. These methods set drawing properties such as the line style, fill color, etc. The actual drawing is done by the Renderer, which draws into the GraphicsContext. cC s!tj|tjj|dS(N(RRRtGraphicsContext(R((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRs cC s3tj|||j}tjj||dS(N(Rt set_alphat get_alphaRR(Rtalphat_alpha((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRs cC s:tj||||j}tjj||d dS(Ni(Rtset_foregroundtget_rgbRR(RtfgtisRGBtrgb((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRs cC s'tj||tjj||dS(N(Rt set_graylevelRR(RR((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRscC s4tj|||sdStjj||jdS(N(Rtset_clip_rectangleRRtbounds(Rtbox((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRscC s=tj|||sdS|j}tjj||dS(N(Rt set_clip_pathtget_fully_transformed_pathRR(RR#((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRs  ( RRRRRR~RRRR(((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRs     cC s,tj}|dk r(|jjndS(sN For performance reasons, we don't want to redraw the figure after each draw command. Instead, we mark the figure as invalid, so that it will be redrawn as soon as the event loop resumes via PyOS_InputHook. This function should be called after each draw event, even if matplotlib is not running interactively. N(Rt get_activeRtcanvast invalidate(t figManager((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytdraw_if_interactives  cO shtjs(ddl}|jdn|jdt}|||}t|}t||}|S(s. Create a new figure manager instance iNsPython is not installed as a framework. The MacOSX backend may not work correctly if Python is not installed as a framework. Please see the Python documentation for more information on installing Python as a framework on Mac OS Xt FigureClass(Rtverify_main_displaytwarningstwarntpopR tFigureCanvasMactFigureManagerMac(tnumtargstkwargsRRtfigureRtmanager((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytnew_figure_managers   RcB seZdZejjZdedOs(RRRt FigureManagert matplotlibtrcParamstNavigationToolbarMacRtNavigationToolbar2MacRRRRtadd_axobserverR(RRRttitleR((RsU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR;s  cC s|jjdS(N(Rtdraw(R((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyRQscC stj|jdS(N(RtdestroyR(R((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pytcloseTs(RRRRRR(((sU/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_macosx.pyR7s  RcB sGeZdZdZdZdZdZdZdZRS(cC s||_tjjtjdd}i}x:d D]2}tjj||d }|j|||s0  (  , G C)