
    W|h                     h    S SK Jr  S SKJr  S SKrS SKJr  S SKJ	r	  S SK
Jr  \ " S S\	5      5       rg)	    )	dataclass)UnionN)Clip)Effect)	ImageClipc                   T    \ rS rSr% Sr\\\R                  4   \	S'   S\S\4S jr
Srg)	MasksAnd   a  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 R                  [        5      (       a  T R                  R                  T l        [        T R                  [        R
                  5      (       a  UR                  U 4S j5      $ UR                  U 4S j5      $ )zApply the effect to the clip.c                 F   > [         R                  " U TR                  5      $ N)npminimumr   )frameselfs    S/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/video/fx/MasksAnd.py<lambda> MasksAnd.apply.<locals>.<lambda>-   s    bjj@    c                 p   > [         R                  " U " U5      TR                  R                  U5      5      $ r   )r   r   r   	get_frame)r   tr   s     r   r   r   1   s&    RZZaL$//";";A">&r   )
isinstancer   r   imgr   ndarrayimage_transform	transform)r   r   s   ` r   applyMasksAnd.apply%   sj     dooy11"oo11DOdoorzz22''@  >> r   )r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   __annotations__r!   __static_attributes__ r   r   r	   r	      s0    , dBJJ&''$ 4 r   r	   )dataclassesr   typingr   numpyr   moviepy.Clipr   moviepy.Effectr   moviepy.video.VideoClipr   r	   r*   r   r   <module>r1      s2    !    ! - (v ( (r   