
    th}                         d Z ddlmZmZmZmZmZ  G d d          Z G d d          Z G d d          Z	 G d	 d
          Z
dS )z]
(Experimental) WCK-style drawing interface operations

.. seealso:: :py:mod:`PIL.ImageDraw`
   )Image
ImageColor	ImageDraw	ImageFont	ImagePathc                       e Zd ZdZddZdS )Penz"Stores an outline color and width.r      c                 F    t          j        |          | _        || _        d S N)r   getrgbcolorwidth)selfr   r   opacitys       b/var/www/html/mycamper/aliexpress-site/backend/venv/lib/python3.11/site-packages/PIL/ImageDraw2.py__init__zPen.__init__!   s    &u--



    N)r   r
   __name__
__module____qualname____doc__r    r   r   r	   r	      s.        ,,     r   r	   c                       e Zd ZdZddZdS )BrushzStores a fill colorr
   c                 8    t          j        |          | _        d S r   )r   r   r   )r   r   r   s      r   r   zBrush.__init__)   s    &u--


r   N)r
   r   r   r   r   r   r   &   s.        . . . . . .r   r   c                       e Zd ZdZddZdS )Fontz Stores a TrueType font and color   c                 l    t          j        |          | _        t          j        ||          | _        d S r   )r   r   r   r   truetypefont)r   r   filesizes       r   r   zFont.__init__0   s,    &u--
&tT22			r   N)r    r   r   r   r   r   r   -   s.        **3 3 3 3 3 3r   r   c                   j    e Zd ZdZddZd ZddZd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd ZdS )Drawz4
    (Experimental) WCK-style drawing interface
    Nc                     t          |d          st          j        |||          }t          j        |          | _        || _        d | _        d S )Nim)hasattrr   newr   r'   drawimage	transform)r   r-   r%   r   s       r   r   zDraw.__init__;   sJ    ud## 	2IeT511EN5))	
r   c                     | j         S r   )r-   )r   s    r   flushz
Draw.flushB   s
    zr   c                    d x}}d}t          |t                    r|j        }|j        }n#t          |t                    r|j        }|j        }t          |t                    r|j        }nt          |t                    r|j        }| j        r.t          j        |          }|                    | j                   |dk    r| j        	                    |||           d S  t          | j        |          |||           d S )Nr   line)fillr   )r3   outline)
isinstancer	   r   r   r   r.   r   Pathr,   r2   getattr)r   opxypenbrushr4   r3   r   s           r   renderzDraw.renderE   s   $c3 	 iGIEEs## 	 kGKEeU## 	;DDU## 	9D> 	)##BLL(((<<INN2G5N99999"GDIr""2D'BBBBBBr   c                 *    |\  }}dd|dd|f| _         dS )zSets a transformation offset.r       N)r.   )r   offsetxoffsetyoffsets       r   settransformzDraw.settransform]   s$    #'QAw7r   c                 (     | j         d|||g|R   dS )z
        Draws an arc (a portion of a circle outline) between the start and end
        angles, inside the given bounding box.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc`
        arcNr<   r   r9   startendoptionss        r   rD   zDraw.arcb   s*     	E2uc4G444444r   c                 (     | j         d|||g|R   dS )z
        Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
        with a straight line.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord`
        chordNrE   rF   s        r   rK   z
Draw.chordk   s*     	GR6g666666r   c                 $     | j         d|g|R   dS )z
        Draws an ellipse inside the given bounding box.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse`
        ellipseNrE   r   r9   rI   s      r   rM   zDraw.ellipset   s&     	Ir,G,,,,,,r   c                 $     | j         d|g|R   dS )z
        Draws a line between the coordinates in the ``xy`` list.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line`
        r2   NrE   rN   s      r   r2   z	Draw.line|   s&     	FB)))))))r   c                 (     | j         d|||g|R   dS )z
        Same as arc, but also draws straight lines between the end points and the
        center of the bounding box.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice`
        piesliceNrE   rF   s        r   rQ   zDraw.pieslice   s*     	JE39999999r   c                 $     | j         d|g|R   dS )a  
        Draws a polygon.

        The polygon outline consists of straight lines between the given
        coordinates, plus a straight line between the last and the first
        coordinate.


        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon`
        polygonNrE   rN   s      r   rS   zDraw.polygon   s&     	Ir,G,,,,,,r   c                 $     | j         d|g|R   dS )zg
        Draws a rectangle.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle`
        	rectangleNrE   rN   s      r   rU   zDraw.rectangle   s&     	K.g......r   c                     | j         r.t          j        |          }|                     | j                    | j                            |||j        |j                   dS )zw
        Draws the string at the given position.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text`
        )r#   r3   N)r.   r   r6   r,   textr#   r   r   r9   rW   r#   s       r   rW   z	Draw.text   sW     > 	)##BLL(((	r4didjAAAAAr   c                     | j         r.t          j        |          }|                     | j                    | j                            |||j                  S )z
        Returns bounding box (in pixels) of given text.

        :return: ``(left, top, right, bottom)`` bounding box

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textbbox`
        r#   )r.   r   r6   r,   textbboxr#   rX   s       r   r[   zDraw.textbbox   sP     > 	)##BLL(((y!!"d!;;;r   c                 D    | j                             ||j                  S )z
        Returns length (in pixels) of given text.
        This is the amount by which following text should be offset.

        .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textlength`
        rZ   )r,   
textlengthr#   )r   rW   r#   s      r   r]   zDraw.textlength   s!     y##Dty#999r   )NNr   )r   r   r   r   r   r0   r<   rB   rD   rK   rM   r2   rQ   rS   rU   rW   r[   r]   r   r   r   r'   r'   6   s             C C C C08 8 8
5 5 57 7 7- - -* * *: : :- - -/ / /	B 	B 	B< < <: : : : :r   r'   N)r    r   r   r   r   r   r	   r   r   r'   r   r   r   <module>r_      s   (  A @ @ @ @ @ @ @ @ @ @ @ @ @       . . . . . . . .3 3 3 3 3 3 3 3K: K: K: K: K: K: K: K: K: K:r   