U
    a+d                     @   s2   d dl mZ d dlmZ ddlmZ dddZdS )	    )apply_to_mask)CompositeVideoClip   )cropNc                 C   s   |dk	rJ|\}}}}| j tf| j|d| j||f}	t| |	gS |dk	r|\}}}}| j tf| ||f}
| j|d| j}	t|	|
gS |dk	r| j|d| j|}	t| |	gS dS )a'   Freezes one region of the clip while the rest remains animated.
    
    You can choose one of three methods by providing either `region`,
    `outside_region`, or `mask`.

    Parameters
    -----------

    t
      Time at which to freeze the freezed region.

    region
      A tuple (x1, y1, x2, y2) defining the region of the screen (in pixels)
      which will be freezed. You can provide outside_region or mask instead.

    outside_region
      A tuple (x1, y1, x2, y2) defining the region of the screen (in pixels)
      which will be the only non-freezed region.

    mask
      If not None, will overlay a freezed version of the clip on the current clip,
      with the provided mask. In other words, the "visible" pixels in the mask
      indicate the freezed region in the final picture.

    N)t)Zfxr   Zto_ImageClipZset_durationdurationZset_positionr   Zset_mask)Zclipr   ZregionZoutside_regionmaskx1y1Zx2y2freezeZanimated_region r   B/tmp/pip-unpacked-wheel-0yp4gafk/moviepy/video/fx/freeze_region.pyfreeze_region   s4    r   )r   NNN)Zmoviepy.decoratorsr   Z,moviepy.video.compositing.CompositeVideoClipr   r   r   r   r   r   r   <module>   s   