Files
old-saburly-wagtail-web/env/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw.cpython-310.pyc

298 lines
26 KiB
Plaintext
Raw Normal View History

2024-08-27 20:33:44 +02:00
o
<00><><EFBFBD>fj<66><00>@s*UddlmZddlZddlZddlZddlmZddlmZm Z m
Z
m Z m Z m Z mZmZddlmZmZddlmZddlmZd ed
<zejjZWn eyVdZYnweradd lmZmZeee ed fe fZ! Gd d<0E>d<0E>Z"d4d5dd<15>Z# d6d7dd<1B>Z$  d8d9d&d'<27>Z%d:d.d/<2F>Z&d;d2d3<64>Z'dS)<<3C>)<01> annotationsN)<01>
ModuleType)<08> TYPE_CHECKING<4E>AnyStr<74>Callable<6C>List<73>Sequence<63>Tuple<6C>Union<6F>cast<73>)<02>Image<67>
ImageColor)<01> deprecate)<01>Coordsz(Callable[[], Image.core._Outline] | None<6E>Outline)<02>
ImageDraw2<EFBFBD> ImageFont.c@s<>eZdZUdZded<dfdgd
d <0B>Zdhd d<0E>Zdidd<12>Z dfdjdd<18>Z  dkdld!d"<22>Z dfdmd%d&<26>Z
  dndod(d)<29>Z   dndpd*d+<2B>Z   dndqd.d/<2F>Z  0 drdsd2d3<64>Z  dtdud6d7<64>Z   dndod8d9<64>Zdfdvd:d;<3B>Z   dndpd<d=<3D>Z 0   dwdxdBdC<64>Z   dndpdDdE<64>Z 0   dwddF<64>dydIdJ<64>ZdzdNdO<64>Zd{dQdR<64>ZdSdT<64>Z    U V    0  Wd|d}dZd[<5B>Z    U V    0  Wd|dd\<5C>d}d]d^<5E>Z     Wd~dd\<5C>dd_d`<60>Z   U V    0 Wd<57>dd\<5C>d<>dbdc<64>Z   U V    0 Wd<57>dd\<5C>d<>ddde<64>ZdS)<29><> ImageDrawN<77>NImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont | None<6E>font<6E>im<69> Image.Image<67>mode<64>
str | None<6E>return<72>NonecCs<>|<01><00>|jr |<01><02>d}|dur|j}||jkr+|dkr%|jdkr%d}nd}t|<04><01>|dkr4|j|_nd|_||_|j|_tj <09>
|j|<03>|_
||_|dvrV|j
<EFBFBD> d<05>|_ n|j
<EFBFBD> d <09>|_ |d
vred |_ nd |_ d |_dS)a<>
Create a drawing instance.
:param im: The image to draw in.
:param mode: Optional mode to use for color values. For RGB
images, this argument can be RGB or RGBA (to blend the
drawing into the image). For all other modes, this argument
must be the same as the image mode. If omitted, the mode
defaults to the mode of the image.
rN<>RGBA<42>RGBr z mode mismatch<63>P)<02>I<>F<><46><EFBFBD><EFBFBD><EFBFBD>)<04>1rr r!r#<00>LF)<0F>load<61>readonly<6C>_copyr<00>
ValueError<EFBFBD>palette<74>_imagerr <00>core<72>draw<61>draw_ink<6E>ink<6E>fontmode<64>fill)<05>selfrr<00>blend<6E>msg<73>r4<00>O/home/amir/Desktop/saburlyweb/env/lib/python3.10/site-packages/PIL/ImageDraw.py<70>__init__Es2 


zImageDraw.__init__<5F>GImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFontcCs"|jsddlm}|<01><03>|_|jS)a=
Get the current default font.
To set the default font for this ImageDraw instance::
from PIL import ImageDraw, ImageFont
draw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf")
To set the default font for all future ImageDraw instances::
from PIL import ImageDraw, ImageFont
ImageDraw.ImageDraw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf")
If the current default font is ``None``,
it is initialized with ``ImageFont.load_default()``.
:returns: An image font.r <00>r)r<00>r<00> load_default)r1rr4r4r5<00>getfontos 
zImageDraw.getfont<6E> font_size<7A> float | NonecCs&|durddlm}|<02>|<01>S|<00><03>S)Nr r8)r9rr:r;)r1r<rr4r4r5<00>_getfont<6E>s 
zImageDraw._getfontr.<00> _Ink | Noner0<00>tuple[int | None, int | None]cCs<>d}d}|dur|dur|jr|j}||fS|j}||fS|durDt|t<03>r-t<04>||j<06>}|jr>t|tj <09>s>|j<07>||j
<EFBFBD>}|j <0B> |<01>}|durkt|t<03>rTt<04>||j<06>}|jret|tj <09>se|j<07>||j
<EFBFBD>}|j <0B> |<02>}||fS<00>N) r0r.<00>
isinstance<EFBFBD>strr<00>getcolorrr)<00>numbers<72>Numberr*r,r-)r1r.r0<00>
result_ink<EFBFBD> result_fillr4r4r5<00>_getink<6E>s*<06><08>
 
 zImageDraw._getinkr <00>xyr<00>start<72>float<61>end<6E>width<74>intcCs2|<00>|<04>\}}|dur|j<01>|||||<05>dSdS)z Draw an arc.N)rIr,<00>draw_arc)r1rJrKrMr0rNr.r4r4r5<00>arc<72>s <04>z ImageDraw.arc<72> Sequence[int]<5D>bitmapcCsD|<02><00>|<00>|<03>\}}|dur|}|dur |j<02>||j|<04>dSdS)zDraw a bitmap.N)r%rIr,<00> draw_bitmapr)r1rJrSr0r.r4r4r5rS<00>s<04>zImageDraw.bitmap<61>outlinec C<01>j|<00>||<04>\}}|dur|j<01>||||d<02>|dur/||kr1|dkr3|j<01>||||d|<06>dSdSdSdS)z Draw a chord.Nr r)rIr,<00>
draw_chord<EFBFBD> r1rJrKrMr0rUrNr.<00>fill_inkr4r4r5<00>chord<72><00> 
 <0C>zImageDraw.chordcC<01>b|<00>||<02>\}}|dur|j<01>||d<02>|dur+||kr-|dkr/|j<01>||d|<04>dSdSdSdS)zDraw an ellipse.Nr r)rIr,<00> draw_ellipse<73>r1rJr0rUrNr.rYr4r4r5<00>ellipse<73><00>  <0C>zImageDraw.ellipse<73>Sequence[float]<5D>radiuscCs@|d||d||d||d|f}|<00>||||<05>dS)z4Draw a circle given center coordinates and a radius.rr N)r_)r1rJrbr0rUrN<00>
ellipse_xyr4r4r5<00>circle<6C>s, zImageDraw.circler<00>jointcsR|<00>|<02>d}|du<01>r!|j<01><02>|<05><00>|dk<02>r#<23>dk<04>r%t<03>dttf<02>r1tttt<00><01>}n<0F>fdd<06>t dt
<EFBFBD><01>d<07>D<00>}t dt
|<06>d<00>D]<5D>}||}d d<06>||d|f|||dffD<00>} | d| dkrmqId<17>fdd<11> }
| d| dko<>| dd| dkp<>| d| dko<>| dd| dk} |d<00>dd|d<00>ddf|d<00>dd|d<00>ddfg} | r<>| dd| dd} }n | dd| dd} }|<00> | | d|d|<02><00>dk<04>r | <0B>r|
|| dd<00>||
|| dd<00>g}n|
|| dd<00>||
|| dd<00>g}|j ||dd<16>qIdSdSdSdS)z6Draw a line, or a connected sequence of line segments.rN<>curve<76>c s*g|]}tttt<03>||d<00><00><01><02>qS)<01>)r rrL<00>tuple<6C><02>.0<EFBFBD>i)rJr4r5<00>
<listcomp><3E>s<1C><06>z"ImageDraw.line.<locals>.<listcomp>rhr c
Ss>g|]\}}t<00>t<00>|d|d|d|d<00><02>d<00>qS)rr <00>h)<03>math<74>degrees<65>atan2)rkrKrMr4r4r5rms (<28><02><06><>coordra<00>anglerLr<00>tuple[float, ...]c
sZ|\}}|d8}<01>dd}tdd<05>||t<01>t<01>|<01><01>f||t<01>t<01>|<01><01>ffD<00><01>S)N<>Zrhr css4<00>|]\}}||dkrt<00>|<02>nt<00>|<02>VqdS<00>rN)ro<00>floor<6F>ceil)rk<00>p<>p_dr4r4r5<00> <genexpr>s
<02><1E>
<EFBFBD>z9ImageDraw.line.<locals>.coord_at_angle.<locals>.<genexpr>)riro<00>cos<6F>radians<6E>sin)rrrs<00>x<>y<>distance<63>rNr4r5<00>coord_at_angles <02><08>z&ImageDraw.line.<locals>.coord_at_angle<6C><65>ru<00><00>r<>)rrrarsrLrrt) rIr,<00>
draw_linesrB<00>listrir rrL<00>range<67>len<65>pieslice<63>line)r1rJr0rNrer.<00>pointsrl<00>point<6E>anglesr<73><00>flipped<65>coordsrKrM<00>
gap_coordsr4)rNrJr5r<><00>sZ

<06><02><06>"<02>"<02>&&<04>
<06><04><02><04> zImageDraw.line<6E>shape<70>Image.core._OutlinecCs\|<01><00>|<00>||<02>\}}|dur|j<02>||d<02>|dur*||kr,|j<02>||d<03>dSdSdS)z(Experimental) Draw a shape.Nr r)<04>closerIr,<00> draw_outline)r1r<>r0rUr.rYr4r4r5r<><s<08>zImageDraw.shapec CrV)zDraw a pieslice.Nr r)rIr,<00> draw_pieslicerXr4r4r5r<>Jr[zImageDraw.pieslicecCs,|<00>|<02>\}}|dur|j<01>||<03>dSdS)z#Draw one or more individual pixels.N)rIr,<00> draw_points)r1rJr0r.r4r4r5r<>Zs<04>zImageDraw.pointc Cs<|<00>||<02>\}}|dur|j<01>||d<02>|dur<>||kr<>|dkr<>|dkr/|j<01>||d|<04>dS|jdur<>t<04>d|jj<06>}|<00>d<02>d}|<07><07>} t| <09>}
|
j<01>||d<02>|<07><07>} t| <0B>}
|dd}|
j<01>||d|<04>|j | | d<06>t<04>|j
|jj<06>} t| <0C>}
|
j<01>||d|<04>|j<03> | jd| j|j<03>dSdSdSdSdS)zDraw a polygon.Nr rr#rh)<01>mask<73>rr) rIr,<00> draw_polygonrr <00>new<65>size<7A>copy<70>Draw<61>paster) r1rJr0rUrNr.rYr<><00>mask_ink<6E>fill_imr,<00>ink_imrr4r4r5<00>polygon`s.
  <0C>zImageDraw.polygon<6F>bounding_circle<6C>!Sequence[Sequence[float] | float]<5D>n_sides<65>rotationcCs t|||<03>}|<00>||||<06>dS)zDraw a regular polygon.N)<02>!_compute_regular_polygon_verticesr<73>)r1r<>r<>r<>r0rUrNrJr4r4r5<00>regular_polygon<6F>s
zImageDraw.regular_polygoncCr\)zDraw a rectangle.Nr r)rIr,<00>draw_rectangler^r4r4r5<00> rectangle<6C>r`zImageDraw.rectangle<6C><01>cornersr<73><00>$tuple[bool, bool, bool, bool] | Nonec sVt|dttf<02>rtttt|<01>\\<02><08>
\<02> <09> n ttt|<01>\<04><08>
<EFBFBD> <09> <0B> <09>kr.d}t|<07><01><01> <0B>
kr8d}t|<07><01><01>dur>d<05>|d<00>t<07><08><01>t<07>
<EFBFBD><01>
t<07> <09><01> t<07> <0B><01> d\<02><03>t<08><00>r<><72><01> <09>dk<05><03>rh<72> <09><00><01><01> <0B>
dk<05><04>rv<72> <0B>
<00><01>r<><72>r<><72><06> |||<04><07>S<00>dks<>t
<EFBFBD><00>s<><73><06> |||<04><07>St <0C>d<00>}<08><06> ||<03>\<02><05>d<12><00><01><02><03><04><05><06><07><08> <09>
<EFBFBD> f d d<0E> } <09>du<01>rH| d<0F><00>j<0E><0F><08>
|d<00> <09> |df<04>d<08>n<14>j<0E><0F>|d<00>
<EFBFBD> |d<00> f<04>d<08><00><03>sH<73><04>sH<73><08>
<EFBFBD>|<00> g}
<EFBFBD>d<00>r|
d|d7<<00>d<00>r|
d|d8<<00>j<0E>|
<EFBFBD>d<08><00> |<00>
<EFBFBD> <09> g} <0B>d<00>r1| d|d7<<00>d<00>r@| d|d8<<00>j<0E>| <0B>d<08><00>du<01>r#<23><05>k<03>r%<25>dk<03>r'| d<11><00><03>s<><73><08>
<EFBFBD> <09>
<EFBFBD>dg} <0C>d<00>rw| d|d7<<00>d<00>r<>| d|d8<<00>j<0E>| <0C>d<08><00><08> <0B>d<00> <09> g} <0A>d<00>r<>| d|d7<<00>d<00>r<>| d|d8<<00>j<0E>| <0A>d<08><00><04>s)<29><08>
<EFBFBD><08>d<00> g}
<EFBFBD>d<00>r<>|
d|d7<<00>d<00>r<>|
d|d8<<00>j<0E>|
<EFBFBD>d<08><00> <09>d<00>
<EFBFBD> <09> g} <0B>d<00>r
| d|d7<<00>d<00>r| d|d8<<00>j<0E>| <0B>d<08>dSdSdSdSdS)zDraw a rounded rectangle.rz&x1 must be greater than or equal to x0z&y1 must be greater than or equal to y0N)TTTTrh)FFr r<><00>boolrrc
s*<00>r<1D><08>
<EFBFBD><08><00>
<EFBFBD>fddf<03><08> <0B><00><08><00> fddff}nZ<6E>r:<3A><08>
<EFBFBD><08><00>
<EFBFBD>fddf<03> <09><00>
<EFBFBD> <09>
<EFBFBD>fddff}n=t<00>fdd<07>t<01><08>
<EFBFBD><08><00>
<EFBFBD>fddf<03> <09><00>
<EFBFBD> <09>
<EFBFBD>fddf<03> <09><00> <0B><00> <09> fddf<03><08> <0B><00><08><00> fddff<04>D<00><01>}|D]}|r<><72>jj|<02>df<00>qy<71>jj|<02><05>f<00>qydS) Nr<4E>rnrru<00>c3s <00>|] \}}<02>|r|VqdSrAr4)rkrl<00>partr<74>r4r5r{<00>s<02><02>
<EFBFBD>zDImageDraw.rounded_rectangle.<locals>.draw_corners.<locals>.<genexpr>r )ri<00> enumerater,r<>rP)r<><00>partsr<73><00> r<><00>drY<00>full_x<5F>full_yr.r1rN<00>x0<78>x1<78>y0<79>y1r4r5<00> draw_corners<72>s,<06><06> <02><02><08> <04>z1ImageDraw.rounded_rectangle.<locals>.draw_cornersTr<54>F)r<>r<>rr)rBr<>rir rrLr(<00>round<6E>allr_<00>anyr<79>rOrIr,r<>)r1rJrbr0rUrNr<>r3<00>rr<72><00>left<66>right<68>top<6F>bottomr4r<>r5<00>rounded_rectangle<6C>s<>  $
"*( 











 <0C>zImageDraw.rounded_rectangle<6C>textrr<>cCst|t<01>rdnd}||vS<00>N<>
<EFBFBD>
)rBrC)r1r<><00>split_characterr4r4r5<00>_multiline_check+szImageDraw._multiline_check<63> list[AnyStr]cCs|<01>t|t<02>r
d<01>Sd<02>Sr<>)<03>splitrBrC)r1r<>r4r4r5<00>_multiline_split0szImageDraw._multiline_splitcCs|jdd||d<03>d||S)Nr<4E><00>A)<01> stroke_widthr<68>)<01>textbbox)r1r<00>spacingr<67>r4r4r5<00>_multiline_spacing3s <02><02><02>zImageDraw._multiline_spacingrgr<>F<>tuple[float, float]rCcs<><00>r <0A>jdvr d}t|<10><01><01>dur<19><08><02><06>d<04><01><01><05><08><04> <09>r/<2F><08><05>
<EFBFBD> |<03><05>||<07><02><04>| | <0C><03> Sd<0F>fd d
<EFBFBD> }dd<11><00><01><02><03><04><05><06><07><08> <09>
f d d<0E> }||<03>}|durtd}| r^| dur\|| <0C>n|}|durn||| <0B>||d <0B>dS||<13>dSdS)z
Draw text.<2E>rr<00>3Embedded color supported only in RGB and RGBA modesNr<r0r?rrOcs*<00><00>|<00>\}}|dur|dusJ<00>|S|SrA)rI)r0r.rY)r1r4r5<00>getinkjs
 zImageDraw.text.<locals>.getinkrrc s<><00>j}|dkr <0B>r d}g}g}td<03>D]}|<04>t<03>
|<00><01>|<05>t<04><05>
|<00>d<00>qz)<29>j<06> |g<02><01>R<00><02><04>|<01>||d<04><07><06><01>\}}|d|d|d|dg}Wn/ty<>z<17>j<08> |<03><02><04>|<01>|g<08><01>Rd|i<01><06><01>}Wnt y<><00><05><08> <09>}YnwYnw|r<>|d|d|d|dg}|dkr<>||<07>
d<07>} }t <0B> d|<00>d}
| <09> d|
<EFBFBD>|\} } <0C>jduj<0E>| | | | |jd| |jdf|<07>dSdS<00>j<11>|||<00>dS) Nrrrh)<07> direction<6F>features<65>languager<65><00>anchorr.rKr rKr<>rl)r/r<><00>appendrOro<00>modf<64>getmask2<6B>AttributeError<6F>getmask<73> TypeError<6F>getband<6E>struct<63>pack<63>fillbandrr<>r<>r,rT) r.r<><00> stroke_offsetrrrrKrlr<><00>offset<65>color<6F> ink_alpharr<><00> r<><00>argsr<73><00>embedded_colorr<72>r<00>kwargsr<73>r1r<>rJr4r5<00> draw_textqs|  <02>
<04><04>
<EFBFBD>$ <02>
<06> <02>
<EFBFBD> <02><04><02>  
"<08><04>z!ImageDraw.text.<locals>.draw_text)r0r?rrOrv)rr)rr(r><00>getr<74><00>multiline_text)r1rJr<>r0rr<>r<><00>alignr<6E>r<>r<>r<><00> stroke_fillr<6C>r<>r<>r3r<>r<>r.<00>
stroke_inkr4r<>r5r<>:sB
<04>$9
 <04>zImageDraw.text)r<cCs<>|dkr
d}t|<0F><01>|durd}nt|<05>dkrd}t|<0F><01>|ddvr)d}t|<0F><01>|dur2|<00>|<0E>}g}d }|<00>|<02>}|<00>||| <0B>}|D]}|j|||| |
d
<EFBFBD>}|<10>|<15>t||<15>}qD|d}|dd krr|t|<12>d|d 8}n|dd kr<>|t|<12>d|8}t|<12>D]Z\}}|d }|||}|d d kr<>||d 8}n
|d dkr<>||8}|dkr<>n|dkr<>||d 7}n|dkr<>||7}nd}t|<0F><01>|j ||f|||||| |
| | | d<13> ||7}q<>dS)N<>ttb<74>/ttb direction is unsupported for multiline text<78>larh<00>#anchor must be a 2 character stringr <00>tb<74>'anchor not supported for multiline textr)r<>r<>r<><00>m<>@r<>r<>r<><00>centerr<72><00>)align must be "left", "center" or "right")r<>r<>r<>r<>r<>r<>)
r(r<>r>r<>r<><00>
textlengthr<EFBFBD><00>maxr<78>r<>)r1rJr<>r0rr<>r<>r<>r<>r<>r<>r<>r<>r<>r<r3<00>widths<68> max_width<74>lines<65> line_spacingr<67><00>
line_widthr<EFBFBD><00>idxr<78><00>width_differencer4r4r5r<><00>st  


<06>
      
<06>
<04>zImageDraw.multiline_textc
Csb|<00>|<01>r d}t|<08><01>|r|jdvrd}t|<08><01>|dur!|<00>|<07>}|r%dn|j} |<02>|| |||<05>S)z@Get the length of a given string, in pixels with 1/64 precision.z&can't measure length of multiline textr<74>r<>Nr)r<>r(rr>r/<00> getlength)
r1r<>rr<>r<>r<>r<>r<r3rr4r4r5r<>s

zImageDraw.textlength<74>tuple[int, int, int, int]c  Cs<>| r |jdvr d} t| <0A><01>|dur|<00>| <0C>}|<00>|<02>r*|<00>||||||||| |
| <0B> S| r.dn|j}|<03>||||| |
|<04>}|d|d|d|d|d|d|d|dfS) z2Get the bounding box of a given string, in pixels.r<>r<>Nrrr rhr<>)rr(r>r<><00>multiline_textbboxr/<00>getbbox)r1rJr<>rr<>r<>r<>r<>r<>r<>r<>r<>r<r3r<00>bboxr4r4r5r<>3s0

<04><04><zImageDraw.textbboxc  Cs@|dkr
d} t| <0A><01>|durd}nt|<04>dkrd} t| <0A><01>|ddvr)d} t| <0A><01>|dur2|<00>| <0C>}g}d }|<00>|<02>}|<00>|||
<EFBFBD>}|D]}|j||||| | d
<EFBFBD>}|<0E>|<13>t||<13>}qD|d}|dd krs|t|<10>d|d 8}n|dd kr<>|t|<10>d|8}d}t|<10>D]<5D>\}}|d }|||}|d d kr<>||d 8}n
|d dkr<>||8}|dkr<>n|dkr<>||d 7}n|dkr<>||7}nd} t| <0A><01>|j ||f|||||| |
| d<13> }|dur<>|}n"t
|d |d <00>t
|d|d<00>t|d|d<00>t|d|d<00>f}||7}q<>|du<00>r|d |d|d |dfS|S)Nr<4E>r<>r<>rhr<>r r<>r<>r)r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>)r<>r<>r<>r<>r<>r<>) r(r<>r>r<>r<>r<>r<>rr<>r<><00>min)r1rJr<>rr<>r<>r<>r<>r<>r<>r<>r<>r<r3rrrrr<>rr<>r rr<>r<00> bbox_liner4r4r5r
`s<>  

<06>
      
<06> <04>

zImageDraw.multiline_textbboxrA)rrrrrr)rr7)r<r=rr7)r.r?r0r?rr@)Nr ) rJrrKrLrMrLr0r?rNrOrr)rJrRrSrr0r?rr)NNr )rJrrKrLrMrLr0r?rUr?rNrOrr)
rJrr0r?rUr?rNrOrr) rJrarbrLr0r?rUr?rNrOrr)NrN)
rJrr0r?rNrOrerrr<00>NN)r<>r<>r0r?rUr?rr)rJrr0r?rr)rNNr )r<>r<>r<>rOr<>rLr0r?rUr?rNrOrr)rJrrbrLr0r?rUr?rNrOr<>r<>rr)r<>rrr<>)r<>rrr<>) NNNrgr<>NNNrNF)rJr<>r<>rCrrrr)NNNNF)r<>rCrrrrL) NNrgr<>NNNrF)rr )<1E>__name__<5F>
__module__<EFBFBD> __qualname__r<00>__annotations__r6r;r>rIrQrSrZr_rdr<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r
r4r4r4r5r@s<>

<EFBFBD> 
*
 <0C> <0C> <0C> <0C> <0C> <0C> <0C>P <0C> <0C>   <0C>( <0C> <0C><02><0E>
  <0C><02><0E>d<02><0E>!<02><0E>1<02><12>rrrrrrcCs.zt|d<01>|<01>WStyt||<01>YSw)a<>
A simple 2D drawing interface for PIL images.
:param im: The image to draw in.
:param mode: Optional mode to use for color values. For RGB
images, this argument can be RGB or RGBA (to blend the
drawing into the image). For all other modes, this argument
must be the same as the image mode. If omitted, the mode
defaults to the mode of the image.
<20>getdraw)<03>getattrr<72>r)rrr4r4r5r<><00>s
  <02>r<EFBFBD><00>Image.Image | None<6E>hints<74>list[str] | None<6E>)tuple[ImageDraw2.Draw | None, ModuleType]cCs<|dur tdd<03>ddlm}|dur|<02>|<00>nd}||fS)z<>
:param im: The image to draw in.
:param hints: An optional list of hints. Deprecated.
:returns: A (drawing context, drawing resource factory) tuple.
Nz'hints' parameter<65> r )r)rr9rr<>)rrrr,r4r4r5r<00>s

 r<00>imagerJ<00>tuple[int, int]<5D>value<75>float | tuple[int, ...]<5D>border<65>float | tuple[int, ...] | None<6E>threshrLrc Csn|<00><00>}|dus
J<00>|\}}z|||f}t||<08>|krWdS||||f<Wn ttfy2YdSw||fh} t<04>}
| r<>t<04>} | D]j\}}|d|f|d|f||df||dffD]O\} } | | f|
vsn| dksn| dkroq\z|| | f}Wn ttfy<>Yq\w|
<EFBFBD>| | f<02>|dur<>t||<08>|k}n|||fv}|r<>||| | f<| <0B>| | f<02>q\qB| }
| } | s=dSdS)a<>
.. warning:: This method is experimental.
Fills a bounded region with a given color.
:param image: Target image.
:param xy: Seed position (a 2-item coordinate tuple). See
:ref:`coordinate-system`.
:param value: Fill color.
:param border: Optional border value. If given, the region consists of
pixels with a color different from the border color. If not given,
the region consists of pixels having the same color as the seed
pixel.
:param thresh: Optional threshold value which specifies a maximum
tolerable difference of a pixel value from the 'background' in
order for it to be replaced. Useful for filling regions of
non-homogeneous, but similar, colors.
Nr r)r%<00> _color_diffr(<00>
IndexError<EFBFBD>set<65>add)rrJrrr!<00>pixelrr<><00>
background<EFBFBD>edge<67> full_edge<67>new_edge<67>s<>tryr0r4r4r5<00> floodfill<6C>sH  <02>
 4<02>  <02><02> <0C>r-r<>r<>r<>rOr<><00>list[tuple[float, float]]cs<>t|t<01>s d}t|<03><01>|dkrd}t|<03><01>t|ttf<02>s"d}t|<03><01>t|<00>dkrDtdd<06>|D<00><01>s7d}t|<03><01>tt t
t|<00><01><02>^<00><02>nPt|<00>dkr<>t|d ttf<02>r<>td
d<06>|d D<00><01>rgt|d tt
f<02>smd}t|<03><01>t|d <00>dkr{d }t|<03><01>tt t
t|d <00><01><02>tt
|d <00><02>nd }t|<03><01><01>d kr<>d}t|<03><01>t|tt
f<02>s<>d}t|<03><01>d#<23>fdd<17> <0C>d$<24><00>fdd<1A> <0C>d%dd<1F>}|||<02>}<05>fd d!<21>|D<00>S)&u<>
Generate a list of vertices for a 2D regular polygon.
:param bounding_circle: The bounding circle is a sequence defined
by a point and radius. The polygon is inscribed in this circle.
(e.g. ``bounding_circle=(x, y, r)`` or ``((x, y), r)``)
:param n_sides: Number of sides
(e.g. ``n_sides=3`` for a triangle, ``6`` for a hexagon)
:param rotation: Apply an arbitrary rotation to the polygon
(e.g. ``rotation=90``, applies a 90 degree rotation)
:return: List of regular polygon vertices
(e.g. ``[(25, 50), (50, 50), (50, 25), (25, 25)]``)
How are the vertices computed?
1. Compute the following variables
- theta: Angle between the apothem & the nearest polygon vertex
- side_length: Length of each polygon edge
- centroid: Center of bounding circle (1st, 2nd elements of bounding_circle)
- polygon_radius: Polygon radius (last element of bounding_circle)
- angles: Location of each polygon vertex in polar grid
(e.g. A square with 0 degree rotation => [225.0, 315.0, 45.0, 135.0])
2. For each angle in angles, get the polygon vertex at that angle
The vertex is computed using the equation below.
X= xcos(φ) + ysin(φ)
Y= xsin(φ) + ycos(φ)
Note:
φ = angle in degrees
x = 0
y = polygon_radius
The formula above assumes rotation around the origin.
In our case, we are rotating around the centroid.
To account for this, we use the formula below
X = xcos(φ) + ysin(φ) + centroid_x
Y = xsin(φ) + ycos(φ) + centroid_y
zn_sides should be an intr<74>zn_sides should be an int > 2z$bounding_circle should be a sequencecs<01><00>|]
}t|ttf<02>VqdSrA<00>rBrOrLrjr4r4r5r{cs<02>z4_compute_regular_polygon_vertices.<locals>.<genexpr>z0bounding_circle should only contain numeric datarhrcsr/rAr0rjr4r4r5r{is<02>
<EFBFBD>r zBbounding_circle centre should contain 2D coordinates (e.g. (x, y))z[bounding_circle should contain 2D coordinates and a radius (e.g. (x, y, r) or ((x, y), r) )z$bounding_circle radius should be > 0z"rotation should be an int or floatr<74><00> list[float]rprLrr<>c
s<>t|dt<01>t<01>d|<00><01>|dt<01>t<01>d|<00><01><00>dd<04>t|dt<01>t<01>d|<00><01>|dt<01>t<01>d|<00><01><00>dd<04>fS)Nrrnr rh)r<>ror|r}r~)r<>rp)<01>centroidr4r5<00>_apply_rotation<6F>s"<02><02><02><02><02><02><04>z:_compute_regular_polygon_vertices.<locals>._apply_rotationrscs<00>dg}<01>||<00>S<00>Nrr4)rs<00> start_point)r3<00>polygon_radiusr4r5<00>_compute_polygon_vertex<65>s
zB_compute_regular_polygon_vertices.<locals>._compute_polygon_vertexr<78>rOr<>cSsRg}d|}dd||}td|<00>D]}|<02>|<04>||7}|dkr&|d8}q|S)Nrnr<>g<00>?r)r<>r<>)r<>r<>r<>rp<00> current_angle<6C>_r4r4r5<00> _get_angles<65>s
<02>z6_compute_regular_polygon_vertices.<locals>._get_anglescsg|]}<01>|<01><01>qSr4r4)rkrs)r7r4r5rm<00>sz5_compute_regular_polygon_vertices.<locals>.<listcomp>N)r<>r1rprLrr<>)rsrLrr<>)r<>rOr<>rLrr1) rBrOr<>r(r<>rir<>r<>r rrL)r<>r<>r<>r3r:r<>r4)r3r7r2r6r5r<>+sR
+ <08><02><02>

r<><00>color1<72>color2csJt|t<01>r|n|f<01>t|t<01>r|n|f<01>t<02><00>fdd<02>tdt<04><01><01>D<00><01>S)zJ
Uses 1-norm distance to calculate difference between two values.
c3s$<00>|] }t<00>|<00>|<00>VqdSrA)<01>absrj<00><02>first<73>secondr4r5r{<00>s<02>"z_color_diff.<locals>.<genexpr>r)rBri<00>sumr<6D>r<>)r;r<r4r>r5r"<00>s"r"rA)rrrrrrr)rrrrrrr4) rrrJrrrrr r!rLrr)r<>r<>r<>rOr<>rLrr.)r;rr<rrrL)(<28>
__future__rrorEr<><00>typesr<00>typingrrrrrr r
r r9r r<00>
_deprecater<00>_typingrrr+rUrr<>rrrLrOrC<00>_Inkrr<>rr-r<>r"r4r4r4r5<00><module>sH (    <02>  <0C> <0C>
A