
    g                     h    d dl mZ d dlmZ d dlZd dlmZ d dlm	Z	 d dl
mZ e G d de	             Zy)	    )	dataclass)UnionN)Clip)Effect)	ImageClipc                   J    e Zd ZU dZeeej                  f   ed<   dedefdZ	y)MasksAndaN  Returns the logical 'and' (minimum pixel color values) between two masks.

    The result has the duration of the clip to which has been applied, if it has any.

    Parameters
    ----------

    other_clip ImageClip or np.ndarray
      Clip used to mask the original clip.

    Examples
    --------

    .. code:: python

        clip = ColorClip(color=(255, 0, 0), size=(1, 1))      # red
        mask = ColorClip(color=(0, 255, 0), size=(1, 1))      # green
        masked_clip = clip.with_effects([vfx.MasksAnd(mask)]) # black
        masked_clip.get_frame(0)
        [[[0 0 0]]]
    
other_clipclipreturnc                     t         j                  t              r j                  j                   _        t         j                  t        j
                        r|j                   fd      S |j                   fd      S )zApply the effect to the clip.c                 D    t        j                  | j                        S N)npminimumr
   )frameselfs    b/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/moviepy/video/fx/MasksAnd.py<lambda>z MasksAnd.apply.<locals>.<lambda>-   s    bjj@     c                 n    t        j                   | |      j                  j                  |            S r   )r   r   r
   	get_frame)r   tr   s     r   r   z MasksAnd.apply.<locals>.<lambda>1   s(    RZZaL$//";";A">& r   )
isinstancer
   r   imgr   ndarrayimage_transform	transform)r   r   s   ` r   applyzMasksAnd.apply%   sd     dooy1"oo11DOdoorzz2''@  >> r   N)
__name__
__module____qualname____doc__r   r   r   r   __annotations__r    r   r   r	   r	      s0    , dBJJ&''$ 4 r   r	   )dataclassesr   typingr   numpyr   moviepy.Clipr   moviepy.Effectr   moviepy.video.VideoClipr   r	   r%   r   r   <module>r,      s2    !    ! - (v ( (r   