§
    ^j™  ã            	       óŠ   — d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ eddee         d	eeddf         fd
„¦   «         ZdS )aq  
Win32 resources as handy context managers.

These are intended to help keep loader code clean & stable at the price
of a tiny bit of execution speed. Performance-critical code should avoid
using these helpers in favor of direct win32 API calls.

Before::

    def loader_function(arg):
        context_handle = user32.GetResource(None)

        result = calculation(arg)

        # Easily forgotten!
        user32.ReleaseResource(context_handle)

        return result

After::

    def loader_function(arg):

        with resource_context() as context_handle:
            result = calculation(arg)

        return result

é    )Úcontextmanager)ÚOptionalÚ	Generator)ÚHANDLE)ÚWinError)Ú_user32NÚwindow_handleÚreturnc              #   óò   K  — t          j        | ¦  «        x}st          ¦   «         ‚	 |V — t          j        d|¦  «        st          ¦   «         ‚dS # t          j        d|¦  «        st          ¦   «         ‚w xY w)a2  
    A Windows device context wrapped as a context manager.

    Args:
        window_handle: A specific window handle to use, if any.
    Raises:
        WinError: Raises if a device context cannot be acquired or released
    Yields:
        HANDLE: the managed drawing context handle to auto-close.

    N)Úuser32ÚGetDCr   Ú	ReleaseDC)r	   Ú_dcs     ú]/home/agentuser/manim-venv/lib/python3.11/site-packages/pyglet/libs/win32/context_managers.pyÚdevice_contextr   %   s‹   è è € õ ”< Ñ.Ô.Ð.ˆCð Ý‰jŒjÐðØˆ	ˆ	ˆ	åÔ  cÑ*Ô*ð 	Ý‘*”*Ðð	ð 	øvÔ  cÑ*Ô*ð 	Ý‘*”*ÐÐÐÐÐs   ¨A Á%A6)N)Ú__doc__Ú
contextlibr   Útypingr   r   Úctypes.wintypesr   Úctypesr   Úpyglet.libs.win32r   r   Úintr   © ó    r   ú<module>r      s¿   ððð ð: &Ð %Ð %Ð %Ð %Ð %Ø &Ð &Ð &Ð &Ð &Ð &Ð &Ð &Ø "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /ð ðð  (¨3¤-ð ¸9ÀVÈTÐSWÐEWÔ;Xð ð ð ñ „ðð ð r   