
    g                     D    d dl mZ d dlZd dlmZ e G d de             Zy)    )	dataclassN)Effectc                   4    e Zd ZU dZdZeed<   dZeed<   d Z	y)BlackAndWhitezDesaturates the picture, makes it black and white.
    Parameter RGB allows to set weights for the different color
    channels.
    If RBG is 'CRT_phosphor' a special set of values is used.
    preserve_luminosity maintains the sum of RGB to 1.
    NRGBTpreserve_luminosityc                 &   | j                   	g d| _         | j                   dk(  r	g d| _         dt        j                  | j                         z  | j                  rt	        | j                         ndz  \  fd}|j                  |      S )zApply the effect to the clip.)   r
   r
   CRT_phosphor)g333333?gjq?gL
F%u?g      ?r
   c                     | d d d d df   z  | d d d d df   z  z   | d d d d df   z  z   } t        j                  d| gz        j                  d      S )Nr   r
         uint8)npdstackastype)imBGRs    g/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/moviepy/video/fx/BlackAndWhite.pyfilterz#BlackAndWhite.apply.<locals>.filter"   s\    R1a[1r!Q'{?2QAq!G_DB99Q"X&--g66    )r   r   arrayr   sumimage_transform)selfclipr   r   r   r   s      @@@r   applyzBlackAndWhite.apply   s    88 DH88~%/DH hhtxx ! $ 8 8s488}aA 	1a	7 ##F++r   )
__name__
__module____qualname____doc__r   str__annotations__r   boolr    r   r   r   r      s"     CO $$,r   r   )dataclassesr   numpyr   moviepy.Effectr   r   r'   r   r   <module>r+      s)    !  ! ,F , ,r   