
    h                        S SK Jr  S SKrS SKJr  S SKJr  SSKJrJ	r	  Sr
\
(       a  SSKJr  SS	 jr        SS
 jr " S S5      r " S S5      rSS jrg)    )annotationsN)BytesIO)Any   )Image	ImageFileF)CapsuleTypec                    S nSU ;   a  U R                  S5      nO SU ;   a  [        U R                  S5      5      nU(       d  g [        R                  " U5      $ )Nfiledata)popr   r   open)kwsources     =/var/www/html/env/lib/python3.13/site-packages/PIL/ImageTk.py_get_image_from_kwr   +   sI    F|	2(::f    c                   UR                   n UR                  X[        U5      5        g ! [        R                   aC    SSKJn  UR                  UR                  5       5        UR                  X[        U5      5         g f = f)Nr   )
_imagingtk)	tkcallreprtkinterTclError r   tkinit
interpaddr)commandphotoptrr   r   s        r   _pyimagingtkcallr!   6   sd     
B+
S	* + 	!"--/*
S	*+s   * AB Bc                  j    \ rS rSrSr  S       SS jjrSS jrSS jrSS jrSS jr	SS	 jr
S
rg)
PhotoImageI   a  
A Tkinter-compatible photo image.  This can be used
everywhere Tkinter expects an image object.  If the image is an RGBA
image, pixels having alpha 0 are treated as transparent.

The constructor takes either a PIL image, or a mode and a size.
Alternatively, you can use the ``file`` or ``data`` options to initialize
the photo image object.

:param image: Either a PIL image, or a mode string.  If a mode string is
              used, a size must also be given.
:param size: If the first argument is a mode string, this defines the size
             of the image.
:keyword file: A filename to load the image from (using
               ``Image.open(file)``).
:keyword data: An 8-bit string containing image data (as loaded from an
               image file).
Nc                f   Uc  [        U5      nUc  Sn[        U5      e[        U[        5      (       a  UnS nUc  Sn[        U5      eOrUR                  nUS:X  aI  UR                  5         UR                  5         UR                  (       a  UR                  R                  OSnUR                  nUu  US'   US'   US;  a  [        R                  " U5      nXPl        X l        [        R                  " S0 UD6U l        U R                  R                   U l        U(       a  U R#                  U5        g g )	NImage is requiredz+If first argument is mode, size is requiredPRGBwidthheight)1Lr(   RGBA )r   
ValueError
isinstancestrmodeapply_transparencyloadpalettesizer   getmodebase_PhotoImage__mode_PhotoImage__sizer   r#   _PhotoImage__photor   paste)selfimager6   r   msgr2   s         r   __init__PhotoImage.__init__]   s    =&r*E=%CS/!s##DE|C o% 
 ::Ds{((*

-2]]u}}))::D(,%BwKH00$$T*D))/B/,,//JJu r   c                     U R                   R                  nS U R                   l         U R                   R                  R	                  SSU5        g ! [         a     g f = f! [
         a     g f = fNr=   delete)r:   nameAttributeErrorr   r   	Exceptionr<   rD   s     r   __del__PhotoImage.__del__   j    	<<$$D !	LLOO  (D9	  		
  		"   A 'A" 
AA"
A/.A/c                ,    [        U R                  5      $ )z
Get the Tkinter photo image identifier.  This method is automatically
called by Tkinter whenever a PhotoImage object is passed to a Tkinter
method.

:return: A Tkinter photo image identifier (a string).
)r1   r:   r<   s    r   __str__PhotoImage.__str__        4<<  r   c                     U R                   S   $ z=
Get the width of the image.

:return: The width, in pixels.
r   r9   rM   s    r   r)   PhotoImage.width        {{1~r   c                     U R                   S   $ z?
Get the height of the image.

:return: The height, in pixels.
r   rS   rM   s    r   r*   PhotoImage.height   rU   r   c                j   UR                  5       nUR                  nUR                  5       (       a  UR                  U R                  :w  aQ  [
        R                  R                  U R                  UR                  5      nUR                  XC5        UR                  n[        SU R                  U5        g)a  
Paste a PIL image into the photo image.  Note that this can
be very slow if the photo image is displayed.

:param im: A PIL image. The size must match the target region.  If the
           mode does not match, the image is converted to the mode of
           the bitmap image.
PyImagingPhotoN)getimimisblockr2   r8   r   core	new_blockr6   convert2r    r!   r:   )r<   r\   r    r=   blocks        r   r;   PhotoImage.paste   sv     hhj}}"''T[["8JJ((bgg>ENN5())C)4<<=r   )__mode__photo__sizer   )NN)r=   zImage.Image | str | Noner6   ztuple[int, int] | Noner   r   returnNonerf   rg   rf   r1   rf   int)r\   Image.Imagerf   rg   )__name__
__module____qualname____firstlineno____doc__r?   rH   rN   r)   r*   r;   __static_attributes__r.   r   r   r#   r#   I   sT    * +/'+''' %' 	'
 
'R	!>r   r#   c                  N    \ rS rSrSrS
SS jjrSS jrSS jrSS jrSS jr	S	r
g)BitmapImage   a  
A Tkinter-compatible bitmap image.  This can be used everywhere Tkinter
expects an image object.

The given image must have mode "1".  Pixels having value 0 are treated as
transparent.  Options, if any, are passed on to Tkinter.  The most commonly
used option is ``foreground``, which is used to specify the color for the
non-transparent parts.  See the Tkinter documentation for information on
how to specify colours.

:param image: A PIL image.
Nc                    Uc  [        U5      nUc  Sn[        U5      eUR                  U l        UR                  U l        [        R                  " SSUR                  5       0UD6U l	        g )Nr&   r   r.   )
r   r/   r2   _BitmapImage__moder6   _BitmapImage__sizer   rt   tobitmap_BitmapImage__photo)r<   r=   r   r>   s       r   r?   BitmapImage.__init__   s\    =&r*E=%CS/!jjjj**G0@GBGr   c                     U R                   R                  nS U R                   l         U R                   R                  R	                  SSU5        g ! [         a     g f = f! [
         a     g f = frB   )rz   rD   rE   r   r   rF   rG   s     r   rH   BitmapImage.__del__   rJ   rK   c                     U R                   S   $ rR   rx   rM   s    r   r)   BitmapImage.width   rU   r   c                     U R                   S   $ rW   r   rM   s    r   r*   BitmapImage.height   rU   r   c                ,    [        U R                  5      $ )z
Get the Tkinter bitmap image identifier.  This method is automatically
called by Tkinter whenever a BitmapImage object is passed to a Tkinter
method.

:return: A Tkinter bitmap image identifier (a string).
)r1   rz   rM   s    r   rN   BitmapImage.__str__   rP   r   )rc   rd   re   )N)r=   zImage.Image | Noner   r   rf   rg   rh   rj   ri   )rm   rn   ro   rp   rq   r?   rH   r)   r*   rN   rr   r.   r   r   rt   rt      s!    H	!r   rt   c                    [         R                  " SU R                  5       U R                  5       45      n[	        SXR                  5       5        U$ )z:Copies the contents of a PhotoImage to a PIL image memory.r-   PyImagingPhotoGet)r   newr)   r*   r!   r[   )r   r\   s     r   getimager     s9    	6EKKM5<<>:	;B(%<Ir   )r   zdict[str, Any]rf   zImageFile.ImageFile | None)r   r1   r   zPhotoImage | tkinter.PhotoImager    r	   rf   rg   )r   r#   rf   rl   )
__future__r   r   ior   typingr   r   r   r   TYPE_CHECKING_typingr	   r   r!   r#   rt   r   r.   r   r   <module>r      sh   6 #    $++8+?J+	+&s> s>t>! >!Br   