K i;dZddlmZddlmZmZmZddlmZm Z m Z m Z m Z ddl mZmZGddZGd d ZGd d ZGd dZy)z] (Experimental) WCK-style drawing interface operations .. seealso:: :py:mod:`PIL.ImageDraw` ) annotations)AnyAnyStrBinaryIO)Image ImageColor ImageDraw ImageFont ImagePath)CoordsStrOrBytesPathceZdZdZdddZy)Penz"Stores an outline color and width.cFtj||_||_yN)r getrgbcolorwidth)selfrropacitys T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/PIL/ImageDraw2.py__init__z Pen.__init__$s&&u-  N)r)rstrrintrrreturnNone__name__ __module__ __qualname____doc__rrrrr!s ,rrceZdZdZdddZy)BrushzStores a fill colorc8tj||_yr)r rr)rrrs rrzBrush.__init__,s&&u- rN)r)rrrrrrr r%rrr'r')s .rr'c*eZdZdZ d ddZy)Fontz Stores a TrueType font and colorcntj||_tj|||_yr)r rrr truetypefont)rrfilesizes rrz Font.__init__3s* &&u- &&tT2 rN) )rrr.zStrOrBytesPath | BinaryIOr/floatrrr r%rrr*r*0s1*JL33 93AF3 3rr*ceZdZdZ d ddZddZ d ddZddZ ddZ ddZ dd Z dd Z dd Z dd Z dd ZddZ ddZddZy)Drawz4 (Experimental) WCK-style drawing interface Nct|tr&| d}t|tj|||}t j ||_||_d|_ y)Nz>If image argument is mode string, size must be a list or tuple) isinstancer ValueErrorrnewr r3drawimage transform)rr9r/rmsgs rrz Draw.__init__@sR eS !|V o%IIeT51ENN5)  QUrc|jSr)r9)rs rflushz Draw.flushOs zzrc ~dx}}d}t|tr|j}|j}n(t|tr|j}|j}t|tr |j}nt|tr |j}|j r2t j|} | j |j | }|dvr|jd|n$|jd||jd||dk(r|jd|t|j||fi|y)Nr)arclinefilloutliner@r) r5rrrr'r:r Path setdefaultgetattrr8) ropxypenbrushkwargsrBrArpaths rrenderz Draw.renderRs$ c3 iiGIIE s #kkGKKE eU #;;D U #99D >>>>"%D NN4>> *B    fg .   fd +   i 1 <   gu - 2r,V,rc(|\}}dd|dd|f|_y)zSets a transformation offset.rrN)r:)roffsetxoffsetyoffsets r settransformzDraw.settransformvs #'QAw7rc6|jd||g|||dy)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` r?startendNrLrrGrHrTrUoptionss rr?zDraw.arc{s"  E2sCWCEsCrc6|jd||g|||dy)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` chordrSNrVrWs rrZz Draw.chords"  GREwEeErc.|jd||g|y)z Draws an ellipse inside the given bounding box. .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse` ellipseNrVrrGrHrXs rr\z Draw.ellipses  Ir311rc.|jd||g|y)z Draws a line between the coordinates in the ``xy`` list. .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line` r@NrVr]s rr@z Draw.lines  FB.g.rc6|jd||g|||dy)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` pieslicerSNrVrWs rr`z Draw.pieslices"  JCH'HCHrc.|jd||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` polygonNrVr]s rrbz Draw.polygons  Ir311rc.|jd||g|y)zg Draws a rectangle. .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle` rectangleNrVr]s rrdzDraw.rectangles  KS373rc|jr2tj|}|j|j|}|jj |||j |j y)zw Draws the string at the given position. .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text` )r-rAN)r:r rCr8textr-rrrGrfr-rKs rrfz Draw.textsN >>>>"%D NN4>> *B r4diidjjArc|jr2tj|}|j|j|}|jj |||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 rCr8textbboxr-rgs rrjz Draw.textbboxsN >>>>"%D NN4>> *Byy!!"d!;;rcP|jj||jS)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` ri)r8 textlengthr-)rrfr-s rrlzDraw.textlengths"yy##Dtyy#99r)NN)r9zImage.Image | strr/z"tuple[int, int] | list[int] | Nonerz&float | tuple[float, ...] | str | Nonerr)rz Image.Imager) rFrrGr rHPen | Brush | NonerIzBrush | Pen | NonerJrrr)rNtuple[float, float]rr) rGr rHrmrTr1rUr1rXrrr)rGr rHrmrXrrr)rGrnrfrr-r*rr)rGrnrfrr-r*rz!tuple[float, float, float, float])rfrr-r*rr1)r!r"r#r$rr=rLrQr?rZr\r@r`rbrdrfrjrlr%rrr3r3;s488< V  V1 V6 V  V%) "- "- "- "- " "-  "- "-H8 D D D D  D  D D F F F F  F  F F 2/I I I I  I  I I 24 B<%<-3<;?< *< :rr3N)r$ __future__rtypingrrrrr r r r _typingr rrr'r*r3r%rrrssH( #((@@+..33x:x:r