
    i                     R    d dl Zd dlmZ 	 d dlmZ dZd ZddZ	y# e$ r dZY w xY w)	    N)apply_to_mask)ImageTc                 v    t        j                  t        j                  |       j	                  |||            S )N)expandresample)nparrayr   	fromarrayrotate)picangler   r   s       U/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/moviepy/video/fx/rotate.pypil_rotaterr      s8    xx-44U6>F 5 H I 	I    Fc                     t         j                  t         j                  t         j                  d   t	        d      sfd| j
                  rddgng dfd}| j                  |dg	      S )
a  
    Change unit to 'rad' to define angles as radians.
    If the angle is not one of 90, 180, -90, -180 (degrees) there will be
    black borders. You can make them transparent with

    >>> newclip = clip.add_mask().rotate(72)

    Parameters
    ===========

    clip
      A video clip

    angle
      Either a value or a function angle(t) representing the angle of rotation

    unit
      Unit of parameter `angle` (either `deg` for degrees or `rad` for radians)

    resample
      One of "nearest", "bilinear", or "bicubic".

    expand
      Only applIf False, the clip will maintain the same True, the clip will be resized so that the whole
    )bilinearnearestbicubic__call__c                     S )N )tas    r   <lambda>zrotate.<locals>.<lambda>0   s    ! r      r   )r   r      c                 ^    |      } | |      }dk(  rd|z  dt         j                  z  z  }|dk(  rrt        j                  |      d d d   S |dk(  r#r!t        j                  |      d d d d df   S |dv rr|d d dd d df   S t        st	        d	      t        ||
      S )Nradg     v@r   Z   )axesi)   iLzqWithout "Pillow" installed, only angles 90, -90,180 are supported, please install "Pillow" withpip install pillow)r   r   )r   pi	transpose	PIL_FOUND
ValueErrorr   )	gfr   r   imr   r   r   transpounits	       r   flzrotate.<locals>.fl4   s    !HU5=a255!ArEv<<1$B$77f&<<1!DbD&99;Fdd4R4i=  2 3 3 r1xGGr   mask)apply_to)r   BILINEARNEARESTBICUBIChasattrismaskr+   )clipr   r*   r   r   r+   r   r)   s    ```` @@r   r   r      su    6 "NN == ==**24H 5*%F{{qeGH H* 7727))r   )degr   T)
numpyr   moviepy.decoratorsr   PILr   r%   r   ImportErrorr   r   r   r   <module>r9      s9     ,II;*  Is    &&