§
    `Ò³g	  ã                   ó@   — d Z ddlZddlZddlmZ  G d„ d¦  «        ZdS ))Ú	PdfMatrixé    Nc                   ó’   — e Zd ZdZdd„Zd„ Zd„ Zed„ ¦   «         Zd„ Z	e
d	„ ¦   «         Zd
„ Zd„ Zd„ Zd„ Zdd„Zd„ Zdd„Zd„ Zd„ ZdS )r   a�  
    PDF transformation matrix helper class.
    
    See the PDF 1.7 specification, Section 8.3.3 ("Common Transformations").
    
    Note:
        * The PDF format uses row vectors.
        * Transformations operate from the origin of the coordinate system
          (PDF coordinates: bottom left corner, Device coordinates: top left corner).
        * Matrix calculations are implemented independently in Python.
        * Matrix objects are immutable, so transforming methods return a new matrix.
        * Matrix objects implement ctypes auto-conversion to ``FS_MATRIX`` for easy use as C function parameter.
    
    Attributes:
        a (float): Matrix value [0][0].
        b (float): Matrix value [0][1].
        c (float): Matrix value [1][0].
        d (float): Matrix value [1][1].
        e (float): Matrix value [2][0] (X translation).
        f (float): Matrix value [2][1] (Y translation).
    é   r   c                 ó`   — ||||||f\  | _         | _        | _        | _        | _        | _        d S ©N©ÚaÚbÚcÚdÚeÚf)Úselfr	   r
   r   r   r   r   s          úW/var/www/html/mpstechhub/venv/lib/python3.11/site-packages/pypdfium2/_helpers/matrix.pyÚ__init__zPdfMatrix.__init__(   s1   € Ø9:¸A¸qÀ!ÀQÈÐ9IÑ6ˆŒ�”˜œ ¤¨¬°´°°ó    c                 ó0   — d|                       ¦   «         › �S )Nr   )Úget©r   s    r   Ú__repr__zPdfMatrix.__repr__,   s   € Ø'˜4Ÿ8š8™:œ:Ð'Ð'Ð'r   c                 ó–   — t          | ¦  «        t          |¦  «        urdS |                      ¦   «         |                     ¦   «         k    S )NF)Útyper   ©r   Úothers     r   Ú__eq__zPdfMatrix.__eq__0   s9   € Ý�‰:Œ:�T %™[œ[Ð(Ð(Ø�5Ø—’‘
”
˜eŸiši™kœkÒ)Ð*r   c                 óN   — t          j        |                      ¦   «         ¦  «        S r   )ÚctypesÚbyrefÚto_rawr   s    r   Ú_as_parameter_zPdfMatrix._as_parameter_6   s   € åŒ|˜TŸ[š[™]œ]Ñ,Ô,Ð,r   c                 óN   — | j         | j        | j        | j        | j        | j        fS )zI
        Get the matrix as tuple of the form (a, b, c, d, e, f).
        r   r   s    r   r   zPdfMatrix.get;   s#   € ð ”˜œ ¤¨¬°´¸¼Ð?Ð?r   c                 ó^   —  | |j         |j        |j        |j        |j        |j        ¦  «        S )zR
        Load a :class:`.PdfMatrix` from a raw :class:`FS_MATRIX` object.
        r   )ÚclsÚraws     r   Úfrom_rawzPdfMatrix.from_rawB   s*   € ð
 ˆs�3”5˜#œ% ¤¨¬¨s¬u°c´eÑ<Ô<Ð<r   c                 óB   — t          j        |                      ¦   «         Ž S )zH
        Convert the matrix to a raw :class:`FS_MATRIX` object.
        )Úpdfium_cÚ	FS_MATRIXr   r   s    r   r   zPdfMatrix.to_rawJ   s   € õ Ô! 4§8¢8¡:¤:Ð.Ð.r   c           
      ó¨  — t          | j        |j        z  | j        |j        z  z   | j        |j        z  | j        |j        z  z   | j        |j        z  | j        |j        z  z   | j        |j        z  | j        |j        z  z   | j        |j        z  | j        |j        z  z   |j        z   | j        |j        z  | j        |j        z  z   |j        z   ¬¦  «        S )zf
        Multiply this matrix by another :class:`.PdfMatrix`, to concatenate transformations.
        r   )r   r	   r
   r   r   r   r   r   s     r   ÚmultiplyzPdfMatrix.multiplyQ   s¹   € õ Ø”�u”w‘ ¤¨¬¡Ñ/Ø”�u”w‘ ¤¨¬¡Ñ/Ø”�u”w‘ ¤¨¬¡Ñ/Ø”�u”w‘ ¤¨¬¡Ñ/Ø”�u”w‘ ¤¨¬¡Ñ/°%´'Ñ9Ø”�u”w‘ ¤¨¬¡Ñ/°%´'Ñ9ð
ñ 
ô 
ð 	
r   c           
      óP   — |                       t          dddd||¦  «        ¦  «        S )zƒ
        Parameters:
            x (float): Horizontal shift (<0: left, >0: right).
            y (float): Vertical shift.
        r   r   ©r*   r   ©r   ÚxÚys      r   Ú	translatezPdfMatrix.translatec   s(   € ð �}Š}�i¨¨1¨a°°A°qÑ9Ô9Ñ;Ô;Ð;r   c                 óL   — |                       t          |dd|¦  «        ¦  «        S )z£
        Parameters:
            x (float): A factor to scale the X axis (<1: compress, >1: stretch).
            y (float): A factor to scale the Y axis.
        r   r,   r-   s      r   ÚscalezPdfMatrix.scalem   s$   € ð �}Š}�i¨¨1¨a°Ñ3Ô3Ñ5Ô5Ð5r   Fc                 óô   — |st          j        |¦  «        }t          j        |¦  «        t          j        |¦  «        }}|                      |rt          ||| |¦  «        nt          || ||¦  «        ¦  «        S )zÙ
        Parameters:
            angle (float): Angle by which to rotate the matrix.
            ccw (bool): If True, rotate counter-clockwise.
            rad (bool): If True, interpret the angle as radians.
        )ÚmathÚradiansÚcosÚsinr*   r   )r   ÚangleÚccwÚradr   Úss         r   ÚrotatezPdfMatrix.rotatew   sr   € ð ð 	(Ý”L Ñ'Ô'ˆEÝŒx˜‰Œ¥¤¨¡¤ˆ1ˆØ�}Š}¸ÐW�i¨¨1¨q¨b°!Ñ4Ô4Ð4ÅÈ1ÈqÈbÐRSÐUVÑAWÔAWÑYÔYÐYr   c                 ó@   — |                       |rdnd|rdnd¬¦  «        S )z¦
        Parameters:
            v (bool): Whether to mirror vertically (at the Y axis).
            h (bool): Whether to mirror horizontall (at the X axis).
        éÿÿÿÿr   )r.   r/   )r2   )r   ÚvÚhs      r   ÚmirrorzPdfMatrix.mirror„   s*   € ð �zŠz 1˜^˜R˜R¨!°q°°°¸aˆzÑAÔAÐAr   c           	      óè   — |s(t          j        |¦  «        }t          j        |¦  «        }|                      t          dt          j        |¦  «        t          j        |¦  «        d¦  «        ¦  «        S )zÙ
        Parameters:
            x_angle (float): Inner angle to skew the X axis.
            y_angle (float): Inner angle to skew the Y axis.
            rad (bool): If True, interpret the angles as radians.
        r   )r4   r5   r*   r   Útan)r   Úx_angleÚy_angler:   s       r   ÚskewzPdfMatrix.skew�   s_   € ð ð 	,Ý”l 7Ñ+Ô+ˆGÝ”l 7Ñ+Ô+ˆGØ�}Š}�i¨­4¬8°GÑ+<Ô+<½d¼hÀwÑ>OÔ>OÐQRÑSÔSÑUÔUÐUr   c                 óv   — | j         |z  | j        |z  z   | j        z   | j        |z  | j        |z  z   | j        z   fS )zI
        Returns:
            (float, float): Transformed point.
        )r	   r   r   r
   r   r   r-   s      r   Úon_pointzPdfMatrix.on_pointš   sD   € ð ŒF�1‰H�t”v˜a‘xÑ $¤&Ñ(ØŒF�1‰H�t”v˜a‘xÑ $¤&Ñ(ð
ð 	
r   c                 ór  — |                       ||¦  «        |                       ||¦  «        |                       ||¦  «        |                       ||¦  «        f}t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        fS )z[
        Returns:
            (float, float, float, float): Transformed rectangle.
        c              3   ó&   K  — | ]}|d          V — ŒdS ©r   N© ©Ú.0Úps     r   ú	<genexpr>z$PdfMatrix.on_rect.<locals>.<genexpr>³   ó&   è è € Ð%Ð%˜��!”Ð%Ð%Ð%Ð%Ð%Ð%r   c              3   ó&   K  — | ]}|d          V — ŒdS ©r   NrL   rM   s     r   rP   z$PdfMatrix.on_rect.<locals>.<genexpr>´   rQ   r   c              3   ó&   K  — | ]}|d          V — ŒdS rK   rL   rM   s     r   rP   z$PdfMatrix.on_rect.<locals>.<genexpr>µ   rQ   r   c              3   ó&   K  — | ]}|d          V — ŒdS rS   rL   rM   s     r   rP   z$PdfMatrix.on_rect.<locals>.<genexpr>¶   rQ   r   )rH   ÚminÚmax)r   ÚleftÚbottomÚrightÚtopÚpointss         r   Úon_rectzPdfMatrix.on_rect¦   sÃ   € ð �MŠM˜$ Ñ$Ô$Ø�MŠM˜$ Ñ'Ô'Ø�MŠM˜% Ñ%Ô%Ø�MŠM˜% Ñ(Ô(ð	
ˆõ Ð%Ð%˜fÐ%Ñ%Ô%Ñ%Ô%ÝÐ%Ð%˜fÐ%Ñ%Ô%Ñ%Ô%ÝÐ%Ð%˜fÐ%Ñ%Ô%Ñ%Ô%ÝÐ%Ð%˜fÐ%Ñ%Ô%Ñ%Ô%ð	
ð 	
r   N)r   r   r   r   r   r   )FF)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úpropertyr    r   Úclassmethodr%   r   r*   r0   r2   r<   rA   rF   rH   r]   rL   r   r   r   r      s8  € € € € € ðð ð0Jð Jð Jð Jð(ð (ð (ð+ð +ð +ð ð-ð -ñ „Xð-ð@ð @ð @ð ð=ð =ñ „[ð=ð/ð /ð /ð
ð 
ð 
ð$<ð <ð <ð6ð 6ð 6ð
Zð 
Zð 
Zð 
ZðBð Bð Bð
Vð 
Vð 
Vð 
Vð	
ð 	
ð 	
ð
ð 
ð 
ð 
ð 
r   r   )Ú__all__r4   r   Úpypdfium2.rawr$   r'   r   rL   r   r   ú<module>rf      sl   ðð €à €€€Ø €€€Ø  Ð  Ð  Ð  Ð  Ð  ðh
ð h
ð h
ð h
ð h
ñ h
ô h
ð h
ð h
ð h
r   