
    iK                         d Z ddlZd Zd Zd Z G d d      Zedk(  rKddlZeej                  _        eej                  _        ej                  j                  j                          yy)	zpygame.camera.Camera implementation using the videocapture module for windows.

http://videocapture.sourceforge.net/

Binary windows wheels:
  https://www.lfd.uci.edu/~gohlke/pythonlibs/#videocapture
    Nc                      dgS )z[Always only lists one camera.

    Functionality not supported in videocapture module.
    r    r       c/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/pygame/_camera_vidcapture.pylist_camerasr      s    
 3Jr   c                  @    	 dd l } | a y # t        $ r ddlm }  Y | a y w xY w)Nr   vidcap)r
   ImportErrorVideoCapture)vcs    r   initr      s*    . F  .-F.s   	 c                      d a y Nr	   r   r   r   quitr   '   s    Fr   c                   N    e Zd ZddZd Zd Zd Zd Zd Zd Z	d Z
dd
ZddZy	)Camerac                 |    t         j                  ||      | _        |\  }}| j                  j                  ||       y)a  device:  VideoCapture enumerates the available video capture devices
                 on your system.  If you have more than one device, specify
                 the desired one here.  The device number starts from 0.

        show_video_window: 0 ... do not display a video window (the default)
                           1 ... display a video window

                         Mainly used for debugging, since the video window
                         can not be closed or moved around.
        N)r
   new_Devdevsetresolution)selfdevicesizemodeshow_video_windowwidthheights          r   __init__zCamera.__init__.   s4     >>&*;<vuf-r   c                 8    | j                   j                          y)zDisplays a dialog containing the property page of the capture filter.

        For VfW drivers you may find the option to select the resolution most
        likely here.
        N)r   displaycapturefilterpropertiesr   s    r   !display_capture_filter_propertiesz(Camera.display_capture_filter_properties=   s     	//1r   c                 8    | j                   j                          y)zDisplays a dialog containing the property page of the capture pin.

        For WDM drivers you may find the option to select the resolution most
        likely here.
        N)r   displaycapturepinpropertiesr"   s    r   display_capture_pin_propertiesz%Camera.display_capture_pin_propertiesE   s     	,,.r   c                 <    | j                   j                  ||       y)z-Sets the capture resolution. (without dialog)N)r   r   )r   r   r   s      r   set_resolutionzCamera.set_resolutionM   s    uf-r   c                 6    | j                   j                         S )z/Returns a string containing the raw pixel data.)r   	getbufferr"   s    r   
get_bufferzCamera.get_bufferQ   s    xx!!##r   c                      yzNot implemented.Nr   r"   s    r   startzCamera.startU       r   c                      yr-   r   )r   kwargss     r   set_controlszCamera.set_controlsX   r/   r   c                      yr-   r   r"   s    r   stopzCamera.stop[   r/   r   Nc                 $    | j                  |      S ) )get_surface)r   	dest_surfs     r   	get_imagezCamera.get_image^   s    	**r   c                     | j                         \  }}}|syt        j                  j                  |||fd      }t        j                  j                  |dd      }|r|j                  |d       |S |}|S )zReturns a pygame Surface.NBGRr      )r   r   )r+   pygameimage
frombuffer	transformflipblit)r   r8   abufferr   r   surfs         r   r7   zCamera.get_surfaceb   sw    !%!2||&&wG$$T1a0NN4(  Ir   )r   )i  i  RGBr   r   )__name__
__module____qualname__r   r#   r&   r(   r+   r.   r2   r4   r9   r7   r   r   r   r   r   ,   s4    .2/.$+r   r   __main__)__doc__r=   r   r   r   r   rF   pygame.examples.cameracameraexamplesmainr   r   r   <module>rO      sk    $
B BJ z!!FMM!-FMM
OO! r   