
    li                        d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ erdd	lmZ dd
lmZ ddlmZ  G d de      Z G d de      Z G d de      Z G d de      Zy)zAShapes based on the `p:pic` element, including Picture and Movie.    )annotations)TYPE_CHECKING
LineFormat)	MSO_SHAPEMSO_SHAPE_TYPEPP_MEDIA_TYPE)	BaseShape)ParentedElementProxy)lazyproperty)
CT_Picture)CT_LineProperties)ProvidesPartc                  .    e Zd ZdZd fdZedd       Zej                  dd       Zedd       Zej                  dd       Zedd       Z	e	j                  dd       Z	edd	       Z
e
j                  dd
       Z
d Zedd       Zedd       Z xZS )_BasePicturez1Base class for shapes based on a `p:pic` element.c                <    t         t        |   ||       || _        y N)superr   __init___pic)selfpicparent	__class__s      Q/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/pptx/shapes/picture.pyr   z_BasePicture.__init__   s    lD*37	    c                .    | j                   j                  S )z|float| representing relative portion cropped from shape bottom.

        Read/write. 1.0 represents 100%. For example, 25% is represented by 0.25. Negative values
        are valid as are values greater than 1.0.
        r   	srcRect_br   s    r   crop_bottomz_BasePicture.crop_bottom        yy"""r   c                &    || j                   _        y r   r   r   values     r   r!   z_BasePicture.crop_bottom#       #		r   c                .    | j                   j                  S )z|float| representing relative portion cropped from left of shape.

        Read/write. 1.0 represents 100%. A negative value extends the side beyond the image
        boundary.
        r   	srcRect_lr    s    r   	crop_leftz_BasePicture.crop_left'   r"   r   c                &    || j                   _        y r   r(   r$   s     r   r*   z_BasePicture.crop_left0   r&   r   c                .    | j                   j                  S )zu|float| representing relative portion cropped from right of shape.

        Read/write. 1.0 represents 100%.
        r   	srcRect_rr    s    r   
crop_rightz_BasePicture.crop_right4        yy"""r   c                &    || j                   _        y r   r-   r$   s     r   r/   z_BasePicture.crop_right<   r&   r   c                .    | j                   j                  S )zp|float| representing relative portion cropped from shape top.

        Read/write. 1.0 represents 100%.
        r   	srcRect_tr    s    r   crop_topz_BasePicture.crop_top@   r0   r   c                &    || j                   _        y r   r3   r$   s     r   r5   z_BasePicture.crop_topH   r&   r   c                6    | j                   j                         S )zReturn the `a:ln` element for this `p:pic`-based image.

        The `a:ln` element contains the line format properties XML.
        )r   get_or_add_lnr    s    r   r8   z_BasePicture.get_or_add_lnL   s    
 yy&&((r   c                    t        |       S )zRProvides access to properties of the picture outline, such as its color and width.r   r    s    r   linez_BasePicture.lineS   s     $r   c                .    | j                   j                  S )zThe `a:ln` element for this `p:pic`.

        Contains the line format properties such as line color and width. |None| if no `a:ln`
        element is present.
        )r   lnr    s    r   r<   z_BasePicture.lnX   s     yy||r   )r   r   r   r   )returnfloat)r%   r>   )r=   r   )r=   zCT_LineProperties | None)__name__
__module____qualname____doc__r   propertyr!   setterr*   r/   r5   r8   r   r:   r<   __classcell__)r   s   @r   r   r      s    ; # # $ $ # # $ $ # # $ $ # # __$ $)      r   r   c                  V    e Zd ZdZedd       Zedd       Zed        Zed	d       Z	y)
MoviezA movie shape, one that places a video on a slide.

    Like |Picture|, a movie shape is based on the `p:pic` element. A movie is composed of a video
    and a *poster frame*, the placeholder image that represents the video before it is played.
    c                .    t        | j                  |       S )zThe |_MediaFormat| object for this movie.

        The |_MediaFormat| object provides access to formatting properties for the movie.
        )_MediaFormatr   r    s    r   media_formatzMovie.media_formati   s     DIIt,,r   c                "    t         j                  S )zMember of :ref:`PpMediaType` describing this shape.

        The return value is unconditionally `PP_MEDIA_TYPE.MOVIE` in this case.
        )r	   MOVIEr    s    r   
media_typezMovie.media_typeq   s     """r   c                n    | j                   | j                  j                  }}|y|j                  |      S )zReturn |Image| object containing poster frame for this movie.

        Returns |None| if this movie has no poster frame (uncommon).
        N)partr   blip_rId	get_imager   
slide_partrIds      r   poster_framezMovie.poster_framey   s4     ))TYY%7%7C
;##C((r   c                "    t         j                  S )zReturn member of :ref:`MsoShapeType` describing this shape.

        The return value is unconditionally `MSO_SHAPE_TYPE.MEDIA` in this
        case.
        )r   MEDIAr    s    r   
shape_typezMovie.shape_type   s     ###r   N)r=   rI   )r=   r	   r=   r   )
r?   r@   rA   rB   r   rJ   rC   rM   rU   rX    r   r   rG   rG   b   sW     - - # # ) ) $ $r   rG   c                  j    e Zd ZdZedd       Zej                  dd       Zed        Zed	d       Zy)
Picturez]A picture shape, one that places an image on a slide.

    Based on the `p:pic` element.
    c                `    | j                   j                  j                  }|y|j                  S )a  Member of MSO_SHAPE indicating masking shape.

        A picture can be masked by any of the so-called "auto-shapes" available in PowerPoint,
        such as an ellipse or triangle. When a picture is masked by a shape, the shape assumes the
        same dimensions as the picture and the portion of the picture outside the shape boundaries
        does not appear. Note the default value for a newly-inserted picture is
        `MSO_AUTO_SHAPE_TYPE.RECTANGLE`, which performs no cropping because the extents of the
        rectangle exactly correspond to the extents of the picture.

        The available shapes correspond to the members of :ref:`MsoAutoShapeType`.

        The return value can also be |None|, indicating the picture either has no geometry (not
        expected) or has custom geometry, like a freeform shape. A picture with no geometry will
        have no visible representation on the slide, although it can be selected. This is because
        without geometry, there is no "inside-the-shape" for it to appear in.
        N)r   spPrprstGeomprst)r   r_   s     r   auto_shape_typezPicture.auto_shape_type   s*    $ 99>>**}}r   c                    t        j                  |       | j                  j                  }|j                  }| |j                          |j                         }||_        y r   )r   validater   r^   r_   _remove_custGeom_add_prstGeomr`   )r   memberr^   r_   s       r   ra   zPicture.auto_shape_type   sM    6"yy~~==!!#))+Hr   c                    | j                   | j                  j                  }}|t        d      |j	                  |      S )zThe |Image| object for this picture.

        Provides access to the properties and bytes of the image in this picture shape.
        zno embedded image)rO   r   rP   
ValueErrorrQ   rR   s      r   imagezPicture.image   s=     ))TYY%7%7C
;011##C((r   c                "    t         j                  S )z6Unconditionally `MSO_SHAPE_TYPE.PICTURE` in this case.)r   PICTUREr    s    r   rX   zPicture.shape_type   s     %%%r   N)r=   zMSO_SHAPE | None)rf   r   rY   )	r?   r@   rA   rB   rC   ra   rD   ri   rX   rZ   r   r   r\   r\      s]    
  ,   ) ) & &r   r\   c                      e Zd ZdZy)rI   zProvides access to formatting properties for a Media object.

    Media format properties are things like start point, volume, and
    compression type.
    N)r?   r@   rA   rB   rZ   r   r   rI   rI      s    r   rI   N)rB   
__future__r   typingr   pptx.dml.liner   pptx.enum.shapesr   r   r	   pptx.shapes.baser
   pptx.sharedr   	pptx.utilr   pptx.oxml.shapes.picturer   pptx.oxml.shapes.sharedr   
pptx.typesr   r   rG   r\   rI   rZ   r   r   <module>rw      sb    G "   $ E E & , "39'L9 L^)$L )$X5&l 5&p' r   