§
    †Ûgz
  ã                   ó.   — d Z ddlmZmZmZ dd„Zdd„ZdS )zE
Helper module for the *bbox_inches* parameter in `.Figure.savefig`.
é    )ÚBboxÚTransformedBboxÚAffine2DNc                 ó  ‡ ‡‡‡‡‡‡— ‰ j         Š‰ j        Š‰ j        j        Šg Šg Št	          ¦   «         Š‰ j        D ]«}‰                     |                     ¦   «         ¦  «         |                     d¬¦  «         	                    ¦   «         }| 
                    |fd„¦  «         d|j        v r‰                     |j        ¦  «         n‰                     ‰¦  «         d	d„|_        Œ¬ˆˆ ˆˆˆˆˆfd„}|€‰ j        }t          ¦   «                              |¦  «        }|‰ j        z  }t!          j        ddg|j        ¢R Ž ‰ _        |                     |j        ¦  «        \  }}	‰ j         j        |z  \  }
}t!          j        | |	 |
|¦  «        ‰ j        _        ‰ j                             ¦   «          t-          ‰ j        |¦  «        ‰ _         ‰ j                             ||
z  |	|z  ‰ j         j        |
z  ‰ j         j        |z  ¦  «         |S )
aO  
    Temporarily adjust the figure so that only the specified area
    (bbox_inches) is saved.

    It modifies fig.bbox, fig.bbox_inches,
    fig.transFigure._boxout, and fig.patch.  While the figure size
    changes, the scale of the original figure is conserved.  A
    function which restores the original values are returned.
    F)Úoriginalc                 ó   — |S ©N© )ÚaÚrÚ_poss      úL/granary/edev/quantum/lib/python3.11/site-packages/matplotlib/_tight_bbox.pyú<lambda>zadjust_bbox.<locals>.<lambda>   s   € ¸4€ ó    Úapply_aspectNc                 ó   — d S r	   r
   )Úposs    r   r   zadjust_bbox.<locals>.<lambda>"   s   € ¨4€ r   c                  ó(  •— t          ‰j        ‰‰¦  «        D ])\  } }}|                      |¦  «         |‰	u r| `Œ"|| _        Œ*‰‰_        ‰‰_        ‰‰j        _        ‰j                             ¦   «          ‰j	         
                    dddd¦  «         d S )Nr   é   )ÚzipÚaxesÚset_axes_locatorr   ÚbboxÚbbox_inchesÚtransFigureÚ_boxoutÚ
invalidateÚpatchÚ
set_bounds)
ÚaxÚlocÚaspectr   ÚfigÚlocator_listÚ
old_aspectÚorigBboxÚorigBboxInchesÚsentinels
      €€€€€€€r   Úrestore_bboxz!adjust_bbox.<locals>.restore_bbox$   s£   ø€ Ý" 3¤8¨\¸:ÑFÔFð 	)ð 	)‰OˆB��VØ×Ò Ñ$Ô$Ð$Ø˜Ð!Ð!à�O�Oà"(�”�àˆŒØ(ˆŒØ")ˆŒÔØŒ×"Ò"Ñ$Ô$Ð$ØŒ	×Ò˜Q  1 aÑ(Ô(Ð(Ð(Ð(r   r   r	   )r   r   r   r   Úobjectr   ÚappendÚget_axes_locatorÚget_positionÚfrozenr   Ú__dict__r   Údpir   Úscaler   Úfrom_boundsÚsizeÚ	transformÚp0r   r   r   r   ÚwidthÚheight)r#   r   Ú	fixed_dpir    Úcurrent_posr)   ÚtrÚ	dpi_scaleÚx0Úy0Úw1Úh1r   r$   r%   r&   r'   r(   s   `           @@@@@@r   Úadjust_bboxr@      s+  øøøøøøø€ ð Œx€HØ”_€NØŒoÔ%€Gà€JØ€LÝ‰xŒx€HØŒhð 	0ð 	0ˆØ×Ò˜B×/Ò/Ñ1Ô1Ñ2Ô2Ð2Ø—o’o¨u�oÑ5Ô5×<Ò<Ñ>Ô>ˆØ
×Ò¨kÐ?Ð?Ð?Ñ@Ô@Ð@à˜Rœ[Ð(Ð(Ø×Ò˜bœoÑ.Ô.Ð.Ð.à×Ò˜hÑ'Ô'Ð'Ø/Ð/Ð/ˆŒˆð)ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð ÐØ”Gˆ	Ý	‰Œ×	Ò	˜)Ñ	$Ô	$€BØ˜CœGÑ#€IåÔ& q¨!Ð?¨kÔ.>Ð?Ð?Ð?€C„OØ�\Š\˜+œ.Ñ)Ô)�F€BˆØŒXŒ]˜YÑ&�F€BˆÝ"Ô.°¨s°R°C¸¸RÑ@Ô@€C„OÔØ„O×ÒÑ Ô Ð å˜sœ°Ñ3Ô3€C„Hà„I×Ò˜˜b™ " r¡'Øœœ¨"Ñ,¨c¬h¬oÀÑ.BñDô Dð Dð Ðr   c                 óJ   — |\  }} |¦   «          t          | ||¦  «        }||fS )z­
    A function that needs to be called when figure dpi changes during the
    drawing (e.g., rasterizing).  It recovers the bbox and re-adjust it with
    the new dpi.
    )r@   )r#   Úbbox_inches_restorer8   r   r)   r   s         r   Úprocess_figure_for_rasterizingrC   F   s4   € ð !4Ñ€K�Ø€L�N„N€NÝ�C˜ iÑ0Ô0€Aà˜ˆ>Ðr   r	   )Ú__doc__Úmatplotlib.transformsr   r   r   r@   rC   r
   r   r   ú<module>rF      sc   ððð ð BÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ Að;ð ;ð ;ð ;ð|ð ð ð ð ð r   