
    '	4j+                         U d dl mZmZ d dlmZmZmZ ed   Zeed<    G d de	e
ef         Z G d de      Z G d	 d
e      Ze G d d             Zy)    )	dataclassfield)Literal	TypeAliascast)AUTOFlateDecode	DCTDecode	JPXDecode	LZWDecodeCCITTFaxDecodeImageFilterc                       e Zd ZdZedefd       Zedefd       Zedefd       Zedefd       Z	de
fdZded	ed
ededeeeeef   f
dZy)	ImageInfozInformation about an image used in the PDF document (base class).
    We subclass this to distinguish between raster and vector images.returnc                 (    t        t        | d         S )zIntrinsic image widthwr   floatselfs    F/DATA/.local/lib/python3.12/site-packages/fpdf/image_datastructures.pywidthzImageInfo.width        E49%%    c                 (    t        t        | d         S )zIntrinsic image heighthr   r   s    r   heightzImageInfo.height   r   r   c                 (    t        t        | d         S );Only available if the image has been placed on the documentrendered_widthr   r   s    r   r!   zImageInfo.rendered_width   s     E4 0122r   c                 (    t        t        | d         S )r    rendered_heightr   r   s    r   r#   zImageInfo.rendered_height"   s     E4 1233r   c                 l    | j                         D ci c]  \  }}||dv rdn| }}}d| dS c c}}w )N)dataiccpsmaskz...zself.__class__.__name__())items)r   kvds       r   __str__zImageInfo.__str__'   sM    LPJJL
LXDAqA77Q>L 	
 
 *!A..
s   0xyr   r   c                     | d   }| d   }||z  }||z  |k  r||z  }|}	|||z
  dz  z  }n||z  }	|}|||	z
  dz  z  }||||	fS )z
        Make an image fit within a bounding box, maintaining its proportions.
        In the reduced dimension it will be centered within the available space.
        r   r       )
r   r.   r/   r   r   img_wimg_hrationew_wnew_hs
             r   scale_inside_boxzImageInfo.scale_inside_box-   sy     CyCyu9q=IEE!e)q AIEE!e)q A!UE!!r   N)__name__
__module____qualname____doc__propertyr   r   r   r!   r#   strr-   tupler8   r2   r   r   r   r      s    I &u & & & & & 3 3 3 4 4 4/ /"" "%*"/4"	ueUE)	*"r   r   c                   6    e Zd ZdZ	 ddedededeeef   fdZy)	RasterImageInfoz9Information about a raster image used in the PDF documentr   r   scaler   c                     | d   }| d   }|dk(  r|dk(  r||z  }||z  }||fS |dk(  r||z  |z  }||fS |dk(  r||z  |z  }||fS )Nr   r   r   r2   )r   r   r   rB   r3   r4   s         r   size_in_document_unitsz&RasterImageInfo.size_in_document_unitsE   s     CyCy6a1fAA
 !t	 !VE	E!A !t !VE	E!A!tr   N)   )r9   r:   r;   r<   r   r?   rD   r2   r   r   rA   rA   B   s8    ? 23 ).	ue|	r   rA   c                       e Zd ZdZy)VectorImageInfoz9Information about a vector image used in the PDF documentN)r9   r:   r;   r<   r2   r   r   rG   rG   T   s    ?r   rG   c                   v    e Zd ZU  ee      Zeeeez  f   e	d<    ee      Z
eeef   e	d<   dZee	d<   ddZy)	
ImageCache)default_factoryimagesicc_profilesr   image_filterNc                 L    | j                   j                         D ]  }d|d<   	 y )Nr   usages)rK   values)r   imgs     r   reset_usageszImageCache.reset_usagesc   s"    ;;%%'CCM (r   )r   N)r9   r:   r;   r   dictrK   r>   rA   rG   __annotations__rL   bytesintrM   r   rR   r2   r   r   rI   rI   Z   sK     <AQU;VFDo778V%*4%@L$ucz"@ &L+&r   rI   N)dataclassesr   r   typingr   r   r   r   rT   rS   r>   objectr   rA   rG   rI   r2   r   r   <module>rZ      sp    ( ( + + Y 0"S&[! 0"fi $@i @ 
 
 
r   