
    h
                        S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
JrJr  \(       a  SSKJr  SS	KJr   " S
 S\	5      rg)z7The proxy class for an image part, and related objects.    )annotationsN)TYPE_CHECKING)Image)Part)EmuInches)
OpcPackage)PackURIc                     ^  \ rS rSrSr S       SU 4S jjjr\S 5       r\S 5       r\S 5       r	\
SS j5       r\SS j5       r\
SS	 j5       r\S
 5       rSrU =r$ )	ImagePart   zdAn image part.

Corresponds to the target part of a relationship with type RELATIONSHIP_TYPE.IMAGE.
c                :   > [         [        U ]  XU5        X@l        g N)superr   __init___image)selfpartnamecontent_typeblobimage	__class__s        B/var/www/html/env/lib/python3.13/site-packages/docx/parts/image.pyr   ImagePart.__init__   s     	i'E    c                x    U R                   R                  nU R                   R                  nX-  n[        U5      $ )zcNative width of this image, calculated from its width in pixels and
horizontal dots per inch (dpi).)r   px_widthhorz_dpir   )r   r   r   width_in_inchess       r   
default_cxImagePart.default_cx   s5     ::&&::&&"-o&&r   c                    U R                   R                  nU R                   R                  n[        [	        SU-  U-  5      5      n[        U5      $ )zcNative height of this image, calculated from its height in pixels and
vertical dots per inch (dpi).i )r   	px_heightr   introundr   )r   r#   r   height_in_emus       r   
default_cyImagePart.default_cy&   sF     JJ((	::&&E&9"4x"?@A=!!r   c                z    U R                   b  U R                   R                  $ SU R                  R                  -  $ )a  Filename from which this image part was originally created.

A generic name, e.g. 'image.png', is substituted if no name is available, for
example when the image was loaded from an unnamed stream. In that case a default
extension is applied based on the detected MIME type of the image.
zimage.%s)r   filenamer   extr   s    r   r*   ImagePart.filename/   s3     ;;";;'''DMM----r   c                D    [        X!R                  UR                  U5      $ )zRReturn an |ImagePart| instance newly created from `image` and assigned
`partname`.)r   r   r   )clsr   r   s      r   
from_imageImagePart.from_image;   s     #5#5uzz5IIr   c                ~    U R                   c%  [        R                  " U R                  5      U l         U R                   $ r   )r   r   	from_blobr   r,   s    r   r   ImagePart.imageA   s*    ;;//$))4DK{{r   c                    U " XU5      $ )zwCalled by ``docx.opc.package.PartFactory`` to load an image part from a
package being opened by ``Document(...)`` call. )r/   r   r   r   packages        r   loadImagePart.loadG   s     8400r   c                ^    [         R                  " U R                  5      R                  5       $ )z0SHA1 hash digest of the blob of this image part.)hashlibsha1r   	hexdigestr,   s    r   r<   ImagePart.sha1M   s      ||DII&0022r   )r   r   )r   r
   r   strr   bytesr   zImage | None)r   r   r   r
   )returnr   )r   r
   r   r?   r   r@   r7   r	   )__name__
__module____qualname____firstlineno____doc__r   propertyr    r'   r*   classmethodr0   r   r8   r<   __static_attributes____classcell__)r   s   @r   r   r      s     X\/2:?HT  ' ' " " 	. 	. J J
  
 1 1
 3 3r   r   )rF   
__future__r   r;   typingr   docx.image.imager   docx.opc.partr   docx.sharedr   r   docx.opc.packager	   docx.opc.packurir
   r   r6   r   r   <module>rR      s/    = "    "  #+(?3 ?3r   