B
    ‹°Sè  ã               @   sP   d dl mZmZmZ ddlmZ ddlmZmZ ddl	m
Z
 G dd„ de
ƒZdS )	é    )Úabsolute_importÚdivisionÚprint_functioné   )Ú	MIME_TYPE)ÚLITTLE_ENDIANÚStreamReader)ÚBaseImageHeaderc               @   s@   e Zd ZdZedd„ ƒZedd„ ƒZedd„ ƒZe	dd	„ ƒZ
d
S )ÚBmpz,
    Image header parser for BMP images
    c       	      C   sT   t |tƒ}| d¡}| d¡}| d¡}| d¡}|  |¡}|  |¡}| ||||ƒS )zo
        Return |Bmp| instance having header properties parsed from the BMP
        image in *stream*.
        é   é   é&   é*   )r   r   Z	read_longÚ_dpi)	ÚclsÚstreamZ
stream_rdrZpx_widthZ	px_heightZhorz_px_per_meterZvert_px_per_meterZhorz_dpiZvert_dpi© r   ú@/var/www/html/venv/lib/python3.7/site-packages/docx/image/bmp.pyÚfrom_stream   s    






zBmp.from_streamc             C   s   t jS )zg
        MIME content type for this image, unconditionally `image/bmp` for
        BMP images.
        )r   ZBMP)Úselfr   r   r   Úcontent_type!   s    zBmp.content_typec             C   s   dS )zJ
        Default filename extension, always 'bmp' for BMP images.
        Zbmpr   )r   r   r   r   Údefault_ext)   s    zBmp.default_extc             C   s   | dkrdS t t| d ƒƒS )z}
        Return the integer pixels per inch from *px_per_meter*, defaulting to
        96 if *px_per_meter* is zero.
        r   é`   g¦
F%uš?)ÚintÚround)Zpx_per_meterr   r   r   r   0   s    zBmp._dpiN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úclassmethodr   Úpropertyr   r   Ústaticmethodr   r   r   r   r   r
   
   s
   r
   N)Ú
__future__r   r   r   Ú	constantsr   Zhelpersr   r   Úimager	   r
   r   r   r   r   Ú<module>   s   