§
    7?ÄjÔ
  ã                   ój   — 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
dS )é    )Ú	dataclassN)ÚClip)ÚEffect)Ú	ImageClipc                   ó’   — 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efd„Zdedefd„ZdS )ÚMarginaK  Draws an external margin all around the frame.

    Parameters
    ----------

    margin_size : int, optional
      If not ``None``, then the new clip has a margin size of
      size ``margin_size`` in pixels on the left, right, top, and bottom.

    left : int, optional
      If ``margin_size=None``, margin size for the new clip in left direction.

    right : int, optional
      If ``margin_size=None``, margin size for the new clip in right direction.

    top : int, optional
      If ``margin_size=None``, margin size for the new clip in top direction.

    bottom : int, optional
      If ``margin_size=None``, margin size for the new clip in bottom direction.

    color : tuple, optional
      Color of the margin.

    opacity : float, optional
      Opacity of the margin. Setting this value to 0 yields transparent margins.
    NÚmargin_sizer   ÚleftÚrightÚtopÚbottom)r   r   r   Úcolorç      ð?ÚopacityÚclipc                 óä  ‡ ‡‡‡— ‰ j         dk    r"‰j        €‰j        s‰                     ¦   «         Š‰ j        �!‰ j        x‰ _        x‰ _        x‰ _        ‰ _        ˆˆ fd„Št          ‰t          ¦  «        rb ‰‰j        ‰j        ¦  «        Š‰j        ‰‰ j        ‰ j        ‰j        z   …‰ j        ‰ j        ‰j        z   …f<   ‰                     ˆfd„¦  «        S ˆˆ fd„}‰                     |¦  «        S )zAdd margins to the clip.r   Nc                 ó^  •— | ‰j         z   ‰j        z   |‰j        z   ‰j        z   }}‰j        rL||f}t          j        ‰j        ||f¦  «                             t          ¦  «         
                    |¦  «        }n4||df}t          j        ‰j        ||f¦  «         
                    |¦  «        }|S )Né   )r
   r   r   r   Úis_maskÚnpÚtiler   ÚastypeÚfloatÚreshaper   )ÚwÚhÚnew_wÚnew_hÚshapeÚbgr   Úselfs         €€úHC:\Projects\Historical\venv\Lib\site-packages\moviepy/video/fx/Margin.pyÚmake_bgz"Margin.add_margin.<locals>.make_bg8   s¦   ø€ Ø˜tœy™=¨4¬:Ñ5°q¸4¼8±|ÀdÄkÑ7Q�5ˆEØŒ|ð HØ ˜�Ý”W˜Tœ\¨E°5¨>Ñ:Ô:×AÒAÅ%ÑHÔH×PÒPÐQVÑWÔW��à  qÐ)�Ý”W˜TœZ¨%°¨Ñ8Ô8×@Ò@ÀÑGÔG�ØˆIó    c                 ó   •— ‰S )N© )ÚpicÚims    €r"   ú<lambda>z#Margin.add_margin.<locals>.<lambda>E   s   ø€ °B€ r$   c                 ó¤   •—  | |¦  «        }|j         d d…         \  }} ‰||¦  «        }||‰j        ‰j        |z   …‰j        ‰j        |z   …f<   |S )Né   )r   r   r
   )Ú	get_frameÚtr'   r   r   r(   r#   r!   s         €€r"   Úfilterz!Margin.add_margin.<locals>.filterI   s`   ø€ Ø�i ‘l”l�Ø”y  ! ”}‘��1Ø�W˜Q ‘]”]�ØIL��4”8˜dœh¨™lÐ*¨D¬I¸¼	ÀA¹Ð,EÐEÑFØ�	r$   )r   Úmaskr   Ú	with_maskr	   r
   r   r   r   Ú
isinstancer   r   r   ÚimgÚimage_transformÚ	transform)r!   r   r.   r(   r#   s   `` @@r"   Ú
add_marginzMargin.add_margin0   s  øøøø€ àŒL˜CÒÐ d¤iÐ&7À$Ä,Ð&7Ø—>’>Ñ#Ô#ˆDàÔÐ'Ø>BÔ>NÐNˆDŒIÐN˜œ
ÐN T¤X°´ð	ð 	ð 	ð 	ð 	ð 	õ �d�IÑ&Ô&ð 	*Ø�˜œ ¤Ñ(Ô(ˆBØOSÌxˆBˆtŒx˜$œ( T¤VÑ+Ð+¨T¬Y¸¼ÀTÄVÑ9KÐ-KÐKÑLØ×'Ò'¨¨¨¨Ñ7Ô7Ð7ðð ð ð ð ð ð —>’> &Ñ)Ô)Ð)r$   Úreturnc                 ó€   — |                       |¬¦  «        }|j        r |                       |j        ¬¦  «        |_        |S )zApply the effect to the clip.)r   )r5   r/   )r!   r   s     r"   ÚapplyzMargin.applyR   s=   € ð �Š DˆÑ)Ô)ˆàŒ9ð 	8ØŸš¨T¬Y˜Ñ7Ô7ˆDŒIàˆr$   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   ÚintÚ__annotations__r
   r   r   r   r   Útupler   r   r   r5   r8   r&   r$   r"   r   r   
   sÄ   € € € € € € ðð ð8 €K�ÐÐÑØ€Dˆ#€M€M�MØ€Eˆ3€N€N�NØ€Cˆ€L€L�LØ€FˆC€O€O�OØ€Eˆ5ÐÐÑØ€GˆUÐÐÑð *˜tð  *ð  *ð  *ð  *ðD˜$ð  4ð ð ð ð ð ð r$   r   )Údataclassesr   Únumpyr   Úmoviepy.Clipr   Úmoviepy.Effectr   Úmoviepy.video.VideoClipr   r   r&   r$   r"   ú<module>rE      s£   ðØ !Ð !Ð !Ð !Ð !Ð !à Ð Ð Ð à Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ø -Ð -Ð -Ð -Ð -Ð -ð ðOð Oð Oð Oð OˆVñ Oô Oñ „ðOð Oð Or$   