ó
    pyüi#  ã                   ó8   • S r SSKrSSKrSSKJr   " S S5      rg))Ú	PdfMatrixé    Nc                   ó’   • \ rS rSrSrSS jrS rS r\S 5       r	S r
\S 5       rS	 rS
 rS rS rSS jrS rSS jrS rS rSrg)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: commonly bottom left, but can be any corner in principle. Device coordinates: top left).
    * 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).
c                 óX   • XX4XV4u  U l         U l        U l        U l        U l        U l        g ©N©ÚaÚbÚcÚdÚeÚf)Úselfr	   r
   r   r   r   r   s          ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pypdfium2/_helpers/matrix.pyÚ__init__ÚPdfMatrix.__init__&   s'   € Ø9:¸qÀQÐ9IÑ6ˆŒ�”˜œ ¤¨¬°µó    c                 ó(   • SU R                  5        3$ )Nr   )Úget©r   s    r   Ú__repr__ÚPdfMatrix.__repr__)   s   € Ø˜4Ÿ8™8›:˜,Ð'Ð'r   c                 ót   • [        U 5      [        U5      La  gU R                  5       UR                  5       :H  $ )NF)Útyper   ©r   Úothers     r   Ú__eq__ÚPdfMatrix.__eq__,   s,   € Ü�‹:œT %›[Ò(ØØ�x‰x‹z˜UŸY™Y›[Ñ(Ð(r   c                 óJ   • [         R                  " U R                  5       5      $ r   )ÚctypesÚbyrefÚto_rawr   s    r   Ú_as_parameter_ÚPdfMatrix._as_parameter_1   s   € ä�|Š|˜TŸ[™[›]Ó,Ð,r   c                 óŠ   • U R                   U R                  U R                  U R                  U R                  U R
                  4$ )z9
Get the matrix as tuple of the form (a, b, c, d, e, f).
r   r   s    r   r   ÚPdfMatrix.get6   s/   € ð —‘˜Ÿ™ §¡¨¯©°·±¸¿¹Ð?Ð?r   c                 ó”   • U " UR                   UR                  UR                  UR                  UR                  UR
                  5      $ )zB
Load a :class:`.PdfMatrix` from a raw :class:`FS_MATRIX` object.
r   )ÚclsÚraws     r   Úfrom_rawÚPdfMatrix.from_raw=   s1   € ñ
 �3—5‘5˜#Ÿ%™% §¡¨¯©¨s¯u©u°c·e±eÓ<Ð<r   c                 óD   • [         R                  " U R                  5       6 $ )z8
Convert the matrix to a raw :class:`FS_MATRIX` object.
)Úpdfium_cÚ	FS_MATRIXr   r   s    r   r"   ÚPdfMatrix.to_rawE   s   € ô ×!Ò! 4§8¡8£:Ð.Ð.r   c           
      óž  • [        U R                  UR                  -  U R                  UR                  -  -   U R                  UR                  -  U R                  UR                  -  -   U R                  UR                  -  U R                  UR                  -  -   U R                  UR                  -  U R                  UR                  -  -   U R
                  UR                  -  U R                  UR                  -  -   UR
                  -   U R
                  UR                  -  U R                  UR                  -  -   UR                  -   S9$ )zV
Multiply this matrix by another :class:`.PdfMatrix`, to concatenate transformations.
r   )r   r	   r
   r   r   r   r   r   s     r   ÚmultiplyÚPdfMatrix.multiplyL   sã   € ô Ø—‘�u—w‘w‘ §¡¨¯©¡Ñ/Ø—‘�u—w‘w‘ §¡¨¯©¡Ñ/Ø—‘�u—w‘w‘ §¡¨¯©¡Ñ/Ø—‘�u—w‘w‘ §¡¨¯©¡Ñ/à—‘�u—w‘w‘ §¡¨¯©¡Ñ/°%·'±'Ñ9Ø—‘�u—w‘w‘ §¡¨¯©¡Ñ/°%·'±'Ñ9ñ
ð 	
r   c           
      ó>   • U R                  [        SSSSX5      5      $ )zc
Parameters:
    x (float): Horizontal shift (<0: left, >0: right).
    y (float): Vertical shift.
é   r   ©r1   r   ©r   ÚxÚys      r   Ú	translateÚPdfMatrix.translate_   s    € ð �}‰}œi¨¨1¨a°°AÓ9Ó;Ð;r   c                 ó<   • U R                  [        USSU5      5      $ )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   r5   r6   s      r   ÚscaleÚPdfMatrix.scalei   s   € ð �}‰}œi¨¨1¨a°Ó3Ó5Ð5r   c                 óü   • U(       d  [         R                  " U5      n[         R                  " U5      [         R                  " U5      pTU R	                  U(       a  [        XEU* U5      5      $ [        XE* XT5      5      $ )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Úsinr1   r   )r   ÚangleÚccwÚradr   Úss         r   ÚrotateÚPdfMatrix.rotates   sZ   € ö Ü—L’L Ó'ˆEÜ�xŠx˜‹¤§¢¨£ˆ1Ø�}‰}¾œi¨¨q¨b°!Ó4ÓYÐYÄÈ1ÈbÐRSÓAWÓYÐYr   c                 óJ   • U R                  U(       a  SOSU(       a  SS9$ SS9$ )aR  
Parameters:
    invert_x (bool): If True, invert X coordinates (horizontal transform). Corresponds to flipping around the Y axis.
    invert_y (bool): If True, invert Y coordinates (vertical transform). Corresponds to flipping around the X axis.
Note:
    Flipping around a vertical axis leads to a horizontal transform, and vice versa.
éÿÿÿÿr4   )r7   r8   )r<   )r   Úinvert_xÚinvert_ys      r   ÚmirrorÚPdfMatrix.mirror€   s'   € ð �z‰z¦8™R°¾h¸ˆzÐOÐOÈAˆzÐOÐOr   c           	      óò   • U(       d,  [         R                  " U5      n[         R                  " U5      nU R                  [        S[         R                  " U5      [         R                  " U5      S5      5      $ )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.
r4   )r?   r@   r1   r   Útan)r   Úx_angleÚy_anglerE   s       r   ÚskewÚPdfMatrix.skew‹   sP   € ö Ü—l’l 7Ó+ˆGÜ—l’l 7Ó+ˆGØ�}‰}œi¨¬4¯8ª8°GÓ+<¼d¿hºhÀwÓ>OÐQRÓSÓUÐUr   c                 ó²   • U R                   U-  U R                  U-  -   U R                  -   U R                  U-  U R                  U-  -   U R
                  -   4$ )z1
Returns:
    (float, float): Transformed point.
)r	   r   r   r
   r   r   r6   s      r   Úon_pointÚPdfMatrix.on_point˜   sP   € ð �F‰F�1‰H�t—v‘v˜a‘xÑ $§&¡&Ñ(Ø�F‰F�1‰H�t—v‘v˜a‘xÑ $§&¡&Ñ(ð
ð 	
r   c                 ó  • U R                  X5      U R                  X5      U R                  X45      U R                  X25      4n[        S U 5       5      [        S U 5       5      [        S U 5       5      [        S U 5       5      4$ )zC
Returns:
    (float, float, float, float): Transformed rectangle.
c              3   ó*   #   • U  H	  oS    v •  M     g7f©r   N© ©Ú.0Úps     r   Ú	<genexpr>Ú$PdfMatrix.on_rect.<locals>.<genexpr>°   ó   é € Ð%šf˜�!–šfùó   ‚c              3   ó*   #   • U  H	  oS    v •  M     g7f©r4   Nr[   r\   s     r   r_   r`   ±   ra   rb   c              3   ó*   #   • U  H	  oS    v •  M     g7frZ   r[   r\   s     r   r_   r`   ²   ra   rb   c              3   ó*   #   • U  H	  oS    v •  M     g7frd   r[   r\   s     r   r_   r`   ³   ra   rb   )rV   ÚminÚmax)r   ÚleftÚbottomÚrightÚtopÚpointss         r   Úon_rectÚPdfMatrix.on_rect¤   s   € ð �M‰M˜$Ó$Ø�M‰M˜$Ó'Ø�M‰M˜%Ó%Ø�M‰M˜%Ó(ð	
ˆô Ñ%™fÓ%Ó%ÜÑ%™fÓ%Ó%ÜÑ%™fÓ%Ó%ÜÑ%™fÓ%Ó%ð	
ð 	
r   r   N)r4   r   r   r4   r   r   )FF)F)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   Úpropertyr#   r   Úclassmethodr*   r"   r1   r9   r<   rG   rM   rS   rV   rn   Ú__static_attributes__r[   r   r   r   r      su   † ñô0Jò(ò)ð
 ñ-ó ð-ò@ð ñ=ó ð=ò/ò
ò&<ò6ô
ZòPô
Vò	
õ
r   r   )Ú__all__r?   r    Úpypdfium2.rawr)   r-   r   r[   r   r   Ú<module>rz      s!   ðð €ã Û Ý  ÷
g
ò g
r   