
    ,h3                     n   d Z ddlmZmZmZm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mZmZ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 G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z  G d de      Z! G d de      Z"y) z"DrawingML objects related to fill.    )absolute_importdivisionprint_functionunicode_literals)Sequence)ColorFormat)MSO_FILL)CT_BlipFillPropertiesCT_GradientFillPropertiesCT_GroupFillPropertiesCT_NoFillPropertiesCT_PatternFillPropertiesCT_SolidColorFillProperties)ElementProxy)lazypropertyc                        e Zd ZdZ fdZed        Zed        Zd Z	ed        Z
d Zed        Zej                  d	        Zed
        Zed        Zej                  d        Zd Zd Zed        Z xZS )
FillFormatzq
    Provides access to the current fill properties object and provides
    methods to change the fill type.
    c                 F    t         t        |           || _        || _        y N)superr   __init___xPr_fill)selfeg_fill_properties_parentfill_obj	__class__s      O/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/dml/fill.pyr   zFillFormat.__init__   s    j$(*-	
    c                 F    |j                   }t        |      } | ||      }|S )z
        Return a |FillFormat| instance initialized to the settings contained
        in *eg_fillProperties_parent*, which must be an element having
        EG_FillProperties in its child element sequence in the XML schema.
        )eg_fillProperties_Fill)clseg_fillProperties_parentfill_elmfillfill_formats        r   from_fill_parentzFillFormat.from_fill_parent!   s+     ,==X2D9r   c                 .    | j                   j                  S )zReturn a |ColorFormat| object representing background color.

        This property is only applicable to pattern fills and lines.
        )r   
back_colorr   s    r   r*   zFillFormat.back_color-        zz$$$r   c                 X    | j                   j                         }t        |      | _        y)zA
        Sets the fill type to noFill, i.e. transparent.
        N)r   get_or_change_to_noFill_NoFillr   )r   noFills     r   
backgroundzFillFormat.background5   s!     224V_
r   c                 .    | j                   j                  S )zi
        Return a |ColorFormat| instance representing the foreground color of
        this fill.
        )r   
fore_colorr+   s    r   r3   zFillFormat.fore_color<   r,   r   c                 X    | j                   j                         }t        |      | _        y)a  Sets the fill type to gradient.

        If the fill is not already a gradient, a default gradient is added.
        The default gradient corresponds to the default in the built-in
        PowerPoint "White" template. This gradient is linear at angle
        90-degrees (upward), with two stops. The first stop is Accent-1 with
        tint 100%, shade 100%, and satMod 130%. The second stop is Accent-1
        with tint 50%, shade 100%, and satMod 350%.
        N)r   get_or_change_to_gradFill	_GradFillr   r   gradFills     r   gradientzFillFormat.gradientD   s"     99668x(
r   c                 ~    | j                   t        j                  k7  rt        d      | j                  j
                  S )a  Angle in float degrees of line of a linear gradient.

        Read/Write. May be |None|, indicating the angle should be inherited
        from the style hierarchy. An angle of 0.0 corresponds to
        a left-to-right gradient. Increasing angles represent
        counter-clockwise rotation of the line, for example 90.0 represents
        a bottom-to-top gradient. Raises |TypeError| when the fill type is
        not MSO_FILL_TYPE.GRADIENT. Raises |ValueError| for a non-linear
        gradient (e.g. a radial gradient).
        *Fill is not of type MSO_FILL_TYPE.GRADIENTtyper	   GRADIENT	TypeErrorr   gradient_angler+   s    r   r@   zFillFormat.gradient_angleQ   s2     99)))HIIzz(((r   c                 v    | j                   t        j                  k7  rt        d      || j                  _        y )Nr;   r<   r   values     r   r@   zFillFormat.gradient_anglea   s,    99)))HII$)

!r   c                 ~    | j                   t        j                  k7  rt        d      | j                  j
                  S )z|GradientStops| object providing access to stops of this gradient.

        Raises |TypeError| when fill is not gradient (call `fill.gradient()`
        first). Each stop represents a color between which the gradient
        smoothly transitions.
        r;   )r=   r	   r>   r?   r   gradient_stopsr+   s    r   rE   zFillFormat.gradient_stopsg   s2     99)))HIIzz(((r   c                 .    | j                   j                  S )a  Return member of :ref:`MsoPatternType` indicating fill pattern.

        Raises |TypeError| when fill is not patterned (call
        `fill.patterned()` first). Returns |None| if no pattern has been set;
        PowerPoint may display the default `PERCENT_5` pattern in this case.
        Assigning |None| will remove any explicit pattern setting, although
        relying on the default behavior is discouraged and may produce
        rendering differences across client applications.
        r   patternr+   s    r   rH   zFillFormat.patterns   s     zz!!!r   c                 &    || j                   _        y r   rG   r   pattern_types     r   rH   zFillFormat.pattern   s    )

r   c                 X    | j                   j                         }t        |      | _        y)a  Selects the pattern fill type.

        Note that calling this method does not by itself set a foreground or
        background color of the pattern. Rather it enables subsequent
        assignments to properties like fore_color to set the pattern and
        colors.
        N)r   get_or_change_to_pattFill	_PattFillr   )r   pattFills     r   	patternedzFillFormat.patterned   s"     99668x(
r   c                 X    | j                   j                         }t        |      | _        y)a&  
        Sets the fill type to solid, i.e. a solid color. Note that calling
        this method does not set a color or by itself cause the shape to
        appear with a solid color fill; rather it enables subsequent
        assignments to properties like fore_color to set the color.
        N)r   get_or_change_to_solidFill
_SolidFillr   )r   	solidFills     r   solidzFillFormat.solid   s"     II88:		*
r   c                 .    | j                   j                  S )zx
        Return a value from the :ref:`MsoFillType` enumeration corresponding
        to the type of this fill.
        )r   r=   r+   s    r   r=   zFillFormat.type   s     zzr   )__name__
__module____qualname____doc__r   classmethodr(   propertyr*   r1   r3   r9   r@   setterrE   rH   rP   rU   r=   __classcell__r   s   @r   r   r      s    

 	 	 % %% % %) ) ) * *
 	) 	) 
" 
" ^^* *	)+  r   r   c                   b     e Zd ZdZ fdZed        Zed        Zed        Zed        Z	 xZ
S )r"   z
    Object factory for fill object of class matching fill element, such as
    _SolidFill for ``<a:solidFill>``; also serves as the base class for all
    fill classes
    c                 \   |t         }nt        |t              rt        }nyt        |t              rt
        }nbt        |t              rt        }nKt        |t              rt        }n4t        |t              rt        }nt        |t              rt        }nt        }t        t        | C  |      S r   )	_NoneFill
isinstancer
   	_BlipFillr   r6   r   _GrpFillr   r/   r   rN   r   rS   r"   r   __new__)r#   xFillfill_clsr   s      r   rf   z_Fill.__new__   s    = H45 H89 H56H23H78 H:;!HHUC(22r   c                 J    d}t        || j                  j                  z        )=Raise TypeError for types that do not override this property.z=fill type %s has no background color, call .patterned() firstr?   r   rW   r   tmpls     r   r*   z_Fill.back_color   s$     Ot~~66677r   c                 J    d}t        || j                  j                  z        )rj   zIfill type %s has no foreground color, call .solid() or .patterned() firstrk   rl   s     r   r3   z_Fill.fore_color   s(     	 t~~66677r   c                 J    d}t        || j                  j                  z        )z=Raise TypeError for fills that do not override this property.z4fill type %s has no pattern, call .patterned() firstrk   rl   s     r   rH   z_Fill.pattern   s$     Ft~~66677r   c                 J    d}t        || j                  j                  z        )Nz(.type property must be implemented on %s)NotImplementedErrorr   rW   rl   s     r   r=   z
_Fill.type   s!    9!$)@)@"@AAr   )rW   rX   rY   rZ   rf   r\   r*   r3   rH   r=   r^   r_   s   @r   r"   r"      s_    3& 8 8
 8 8 8 8
 B Br   r"   c                       e Zd Zed        Zy)rd   c                 "    t         j                  S r   )r	   PICTUREr+   s    r   r=   z_BlipFill.type   s    r   NrW   rX   rY   r\   r=    r   r   rd   rd      s       r   rd   c                   j    e Zd ZdZd Zed        Zej                  d        Zed        Z	ed        Z
y)r6   z Proxies an `a:gradFill` element.c                      |x| _         | _        y r   )_element	_gradFillr7   s     r   r   z_GradFill.__init__   s    )11r   c                     | j                   j                  }|t        d      | j                   j                  }|y|j                  }|dk(  rd}|S d|z
  }|S )a  Angle in float degrees of line of a linear gradient.

        Read/Write. May be |None|, indicating the angle is inherited from the
        style hierarchy. An angle of 0.0 corresponds to a left-to-right
        gradient. Increasing angles represent clockwise rotation of the line,
        for example 90.0 represents a top-to-bottom gradient. Raises
        |TypeError| when the fill type is not MSO_FILL_TYPE.GRADIENT. Raises
        |ValueError| for a non-linear gradient (e.g. a radial gradient).
        Nnot a linear gradientg             v@)rz   path
ValueErrorlinang)r   r~   r   clockwise_anglecounter_clockwise_angles        r   r@   z_GradFill.gradient_angle   sw     ~~""455 nn  ; ''"c)C 	  '& 160G 	  '&r   c                 ^    | j                   j                  }|t        d      d|z
  |_        y )Nr|   r}   )rz   r   r   r   )r   rC   r   s      r   r@   z_GradFill.gradient_angle  s-    nn  ;455%-r   c                 H    t        | j                  j                               S )z|_GradientStops| object providing access to gradient colors.

        Each stop represents a color between which the gradient smoothly
        transitions.
        )_GradientStopsrz   get_or_add_gsLstr+   s    r   rE   z_GradFill.gradient_stops
  s     dnn==?@@r   c                 "    t         j                  S r   )r	   r>   r+   s    r   r=   z_GradFill.type  s       r   N)rW   rX   rY   rZ   r   r\   r@   r]   r   rE   r=   rv   r   r   r6   r6      sb    *2 ' '>     A A ! !r   r6   c                       e Zd Zed        Zy)re   c                 "    t         j                  S r   )r	   GROUPr+   s    r   r=   z_GrpFill.type      ~~r   Nru   rv   r   r   re   re     s     r   re   c                       e Zd Zed        Zy)r/   c                 "    t         j                  S r   )r	   
BACKGROUNDr+   s    r   r=   z_NoFill.type  s    """r   Nru   rv   r   r   r/   r/     s    # #r   r/   c                       e Zd Zed        Zy)rb   c                      y r   rv   r+   s    r   r=   z_NoneFill.type%  s    r   Nru   rv   r   r   rb   rb   $  s     r   rb   c                        e Zd ZdZ fdZed        Zed        Zed        Z	e	j                  d        Z	ed        Z xZS )rN   z-Provides access to patterned fill properties.c                 F    t         t        |           |x| _        | _        y r   )r   rN   r   ry   	_pattFill)r   rO   r   s     r   r   z_PattFill.__init__-  s    i'))11r   c                 `    | j                   j                         }t        j                  |      S )z;Return |ColorFormat| object that controls background color.)r   get_or_add_bgClrr   from_colorchoice_parent)r   bgClrs     r   r*   z_PattFill.back_color1  '     //122599r   c                 `    | j                   j                         }t        j                  |      S )z;Return |ColorFormat| object that controls foreground color.)r   get_or_add_fgClrr   r   )r   fgClrs     r   r3   z_PattFill.fore_color7  r   r   c                 .    | j                   j                  S )a  Return member of :ref:`MsoPatternType` indicating fill pattern.

        Returns |None| if no pattern has been set; PowerPoint may display the
        default `PERCENT_5` pattern in this case. Assigning |None| will
        remove any explicit pattern setting.
        r   prstr+   s    r   rH   z_PattFill.pattern=  s     ~~"""r   c                 &    || j                   _        y r   r   rJ   s     r   rH   z_PattFill.patternG  s    *r   c                 "    t         j                  S r   )r	   	PATTERNEDr+   s    r   r=   z_PattFill.typeK  s    !!!r   )rW   rX   rY   rZ   r   r   r*   r3   r\   rH   r]   r=   r^   r_   s   @r   rN   rN   *  ss    72 : :
 : :
 # # ^^+ + " "r   rN   c                   B     e Zd ZdZ fdZed        Zed        Z xZ	S )rS   zAProvides access to fill properties such as color for solid fills.c                 8    t         t        |           || _        y r   )r   rS   r   
_solidFill)r   rT   r   s     r   r   z_SolidFill.__init__S  s    j$(*#r   c                 @    t        j                  | j                        S )z3Return |ColorFormat| object controlling fill color.)r   r   r   r+   s    r   r3   z_SolidFill.fore_colorW  s     224??CCr   c                 "    t         j                  S r   )r	   SOLIDr+   s    r   r=   z_SolidFill.type\  r   r   )
rW   rX   rY   rZ   r   r   r3   r\   r=   r^   r_   s   @r   rS   rS   P  s5    K$ D D  r   rS   c                   "    e Zd ZdZd Zd Zd Zy)r   a/  Collection of |GradientStop| objects defining gradient colors.

    A gradient must have a minimum of two stops, but can have as many more
    than that as required to achieve the desired effect (three is perhaps
    most common). Stops are sequenced in the order they are transitioned
    through.
    c                     || _         y r   )_gsLst)r   gsLsts     r   r   z_GradientStops.__init__j  s	    r   c                 2    t        | j                  |         S r   )_GradientStopr   )r   idxs     r   __getitem__z_GradientStops.__getitem__m  s    T[[-..r   c                 ,    t        | j                        S r   )lenr   r+   s    r   __len__z_GradientStops.__len__p  s    4;;r   N)rW   rX   rY   rZ   r   r   r   rv   r   r   r   r   a  s    / r   r   c                   f     e Zd ZdZ fdZed        Zed        Zej                  d        Z xZ
S )r   zQA single gradient stop.

    A gradient stop defines a color and a position.
    c                 :    t         t        |   |       || _        y r   )r   r   r   _gs)r   gsr   s     r   r   z_GradientStop.__init__z  s    mT+B/r   c                 @    t        j                  | j                        S )z3Return |ColorFormat| object controlling stop color.)r   r   r   r+   s    r   colorz_GradientStop.color~  s     22488<<r   c                 .    | j                   j                  S )a=  Location of stop in gradient path as float between 0.0 and 1.0.

        The value represents a percentage, where 0.0 (0%) represents the
        start of the path and 1.0 (100%) represents the end of the path. For
        a linear gradient, these would represent opposing extents of the
        filled area.
        )r   posr+   s    r   positionz_GradientStop.position  s     xx||r   c                 8    t        |      | j                  _        y r   )floatr   r   rB   s     r   r   z_GradientStop.position  s    U|r   )rW   rX   rY   rZ   r   r   r   r\   r   r]   r^   r_   s   @r   r   r   t  sM    
 = =   __$ $r   r   N)#rZ   
__future__r   r   r   r   pptx.compatr   pptx.dml.colorr   pptx.enum.dmlr	   pptx.oxml.dml.fillr
   r   r   r   r   r   pptx.sharedr   	pptx.utilr   objectr   r"   rd   r6   re   r/   rb   rN   rS   r   r   rv   r   r   <module>r      s    ) R R   & "  % "I IX2BF 2Bj   8! 8!vu #e # #" #"L " X  &$L $r   