
    i                     :    d dl Zd dlmZ d dlmZ e	 	 dd       Zy)    N)apply_to_mask)	ImageClipc                    	
 dk7  r( j                    j                  s j                          ||xxx fd
t         t              r` 
 j
                   j                        	 j                  	 j                  z    j
                  z   f<    j                  	fd      S 
fd} j                  |      S )a  
    Draws an external margin all around the frame.
    
    :param mar: if not ``None``, then the new clip has a margin of
        size ``mar`` in pixels on the left, right, top, and bottom.
        
    :param left, right, top, bottom: width of the margin in pixel
        in these directions.
        
    :param color: color of the margin.
    
    :param mask_margin: value of the mask on the margin. Setting
        this value to 0 yields transparent margins.
    
          ?c                    | 	z   z   |z   z   }}j                   r@||f}t        j                  
||f      j                  t              j                  |      }|S ||df}t        j                  ||f      j                  |      }|S )N   )ismasknptileastypefloatreshape)whnew_wnew_hshapebgbottomclipcolorleftopacityrighttops         U/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/moviepy/video/fx/margin.pymake_bgzmargin.<locals>.make_bg    s    4x%'S6)9u;;ENE777UEN3u  	 E1%E/77>B	    c                     S )N )picims    r   <lambda>zmargin.<locals>.<lambda>0   s     r   c                 p     | |      }|j                   d d \  }} ||      }|||z   |z   f<   |S )N   )r   )	gftr!   r   r   r"   r   r   r   s	         r   flzmargin.<locals>.fl4   sN    Q%C))BQ-CAa1B-0Bs37{DM)*Ir   )
maskr	   add_mask
isinstancer   r   r   imgfl_imager(   )r   marr   r   r   r   r   r   r(   r"   r   s   ` `````` @@r   marginr/      s    & 	3TYY.}}
&)))u)sV
 
 $	"dffTVV$37883sTVV|T$-//0}}]++	 wwr{r   )Nr   r   r   r   )r   r   r   r   )numpyr
   moviepy.decoratorsr   moviepy.video.VideoClipr   r/   r    r   r   <module>r3      s(     , - 01032 2r   