
    &Th}                     t    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
y)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y)Penz"Stores an outline color and width.c                 F    t        j                  |      | _        || _        y N)r   getrgbcolorwidth)selfr   r   opacitys       V/home/stella.sw7ft.com/public_html/venv/lib/python3.12/site-packages/PIL/ImageDraw2.py__init__zPen.__init__!   s    &&u-

    N)r      __name__
__module____qualname____doc__r    r   r   r	   r	      s
    ,r   r	   c                       e Zd ZdZddZy)BrushzStores a fill colorc                 8    t        j                  |      | _        y 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y)Fontz Stores a TrueType font and colorc                 n    t        j                  |      | _        t        j                  ||      | _        y r   )r   r   r   r   truetypefont)r   r   filesizes       r   r   zFont.__init__0   s(    &&u-
&&tT2	r   N)   r   r   r   r   r   r   -   s
    *3r   r   c                   h    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y)Drawz4
    (Experimental) WCK-style drawing interface
    Nc                     t        |d      st        j                  |||      }t        j                  |      | _        || _        d | _        y )Nim)hasattrr   newr   r'   drawimage	transform)r   r-   r$   r   s       r   r   zDraw.__init__;   s<    ud#IIeT51ENN5)	
r   c                     | j                   S r   )r-   )r   s    r   flushz
Draw.flushB   s    zz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
                  r0t        j                  |      }|j                  | j
                         |dk(  r| j                  j                  |||       y  t        | j                  |      |||       y )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iiGIIEs#kkGKKEeU#;;DU#99D>>#BLL(<IINN2G5N9"GDIIr"2D'Br   c                 (    |\  }}dd|dd|f| _         y)zSets a transformation offset.r       N)r.   )r   offsetxoffsetyoffsets       r   settransformzDraw.settransform]   s     #'QAw7r   c                 0     | j                   d|||g|  y)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4r   c                 0     | j                   d|||g|  y)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6r   c                 ,     | j                   d|g|  y)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|  y)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                 0     | j                   d|||g|  y)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9r   c                 ,     | j                   d|g|  y)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|  y)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                   r0t        j                  |      }|j                  | j                          | j                  j	                  |||j
                  |j                         y)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   sI     >>#BLL(		r4diidjjAr   c                     | j                   r0t        j                  |      }|j                  | 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   sI     >>#BLL(yy!!"d!;;r   c                 P    | j                   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"     yy##Dtyy#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   sO    C08
57-*:-/	B<:r   r'   N)r    r   r   r   r   r   r	   r   r   r'   r   r   r   <module>r_      s=   ( A @ . .3 3K: K:r   