
    -i                     V    d dl mZ d dlmZ d dlmZ e G d de                      ZdS )    )	dataclass)Clip)Effectc                       e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	eed<   dZ
eed<   dZeed<   dZeed	<   dZeed
<   dedefdZdS )CropaH  Effect to crop a clip to get a new clip in which just a rectangular
    subregion of the original clip is conserved. `x1,y1` indicates the top left
    corner and `x2,y2` is the lower right corner of the cropped region. All
    coordinates are in pixels. Float numbers are accepted.

    To crop an arbitrary rectangle:

    >>> Crop(x1=50, y1=60, x2=460, y2=275)

    Only remove the part above y=30:

    >>> Crop(y1=30)

    Crop a rectangle that starts 10 pixels left and is 200px wide

    >>> Crop(x1=10, width=200)

    Crop a rectangle centered in x,y=(300,400), width=50, height=150 :

    >>> Crop(x_center=300, y_center=400, width=50, height=150)

    Any combination of the above should work, like for this rectangle
    centered in x=300, with explicit y-boundaries:

    >>> Crop(x_center=300, width=400, y1=100, y2=600)

    Nx1y1x2y2widthheightx_centery_centerclipreturnc                      j         r j         j         j         z    _        n" j         r j         j         j         z
   _         j        r j         j         j        z    _        n" j        r j         j         j        z
   _         j        r/ j         j         dz  z
   j         j         dz  z   c _         _         j        r/ j         j        dz  z
   j         j        dz  z   c _         _         j        pd _         j        pd _         j        p|j        d          _         j        p|j        d          _        |	                     fddg          S )zApply the effect to the clip.N   r      c                     | t          j                  t          j                  t          j                  t          j                  f         S )N)intr	   r   r   r
   )frameselfs    S/var/www/html/speakWrite/venv/lib/python3.11/site-packages/moviepy/video/fx/Crop.py<lambda>zCrop.apply.<locals>.<lambda>L   s>    %DGs47||+S\\CLL-HH     mask)apply_to)
r   r   r
   r   r	   r   r   r   sizeimage_transform)r   r   s   ` r   applyz
Crop.apply.   sw   : 	+$'-g
*DGGZ 	+DG/g
*DG; 	,47.g+DGG[ 	,TW0g+DG= 	
Q.
Q. DGTW
 = 	a/a/ DGTW
 ',Q',Q')TYq\')TYq\##    X	 $ 
 
 	
r   )__name__
__module____qualname____doc__r   r   __annotations__r	   r
   r   r   r   r   r   r   r     r   r   r   r      s          8 BNNNBNNNBNNNBNNNE3FCHcHc"
$ "
4 "
 "
 "
 "
 "
 "
r   r   N)dataclassesr   moviepy.Clipr   moviepy.Effectr   r   r&   r   r   <module>r*      s    ! ! ! ! ! !       ! ! ! ! ! ! H
 H
 H
 H
 H
6 H
 H
 H
 H
 H
r   