o
    'h	                     @   s>   d Z dZddlZG dd dZG dd dZG dd	 d	ZdS )
z
This module defines a number of context managers. These are meant to be used
in the context of the with statement (introduced in Python 2.5).
)CGSavedGStateCGTransparencyLayerCGContextPage    Nc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	r   a2  
    Context manager for saving and restoring the graphics state.

    Usage::

        with  CGSavedGState(context):
            statement

    This is equivalent to:
        CGContextSaveGState(context)
        try:
            statement

        finally:
            CGContextRestoreGState(context)
    c                 C   s
   || _ d S N)context)selfr    r   z/Users/merlin/projects/employee-monitoring-system/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_contextmanager.py__init__   s   
zCGSavedGState.__init__c                 C   s   t | j | S r   )QuartzZCGContextSaveGStater   )r   r   r   r	   	__enter__      zCGSavedGState.__enter__c                 C      t | j dS NF)r   ZCGContextRestoreGStater   r   exc_type	exc_valueZexc_tpr   r   r	   __exit__#   r   zCGSavedGState.__exit__N__name__
__module____qualname____doc__r
   r   r   r   r   r   r	   r   
   s
    r   c                   @   *   e Zd ZdZd	ddZdd Zdd ZdS )
r   aV  
    Context manager for working in a transparancylayer.

    Usage::

        with CGTransparencyLayer(context, info [, rect]):
            statement

    This is equivalent to:
        CGContextBeginTransparencyLayer(context, info)
        try:
            statement

        finally:
            CGContextEndTransparencyLayer(context)
    Nc                 C   s   || _ || _|| _d S r   )r   inforect)r   r   r   r   r   r   r	   r
   :   s   
zCGTransparencyLayer.__init__c                 C   s6   | j d u rt| j| j}|S t| j| j | j}|S r   )r   r   ZCGContextBeginTransparencyLayerr   r   Z'CGContextBeginTransparencyLayerWithRect)r   resultr   r   r	   r   ?   s   
zCGTransparencyLayer.__enter__c                 C   r   r   )r   ZCGContextEndTransparencyLayerr   r   r   r   r	   r   H   r   zCGTransparencyLayer.__exit__r   r   r   r   r   r	   r   (   s
    
	r   c                   @   r   )
r   aI  
    Context manager for saving and restoring the graphics state.

    Usage::

        with CGContextPage(context) as mediaRect:
            statement

    This is equivalent to:
        mediaRect = CGContextBeginPage(context, None)
        try:
            statement

        finally:
            CGContextEndPage(context)
    Nc                 C   s   || _ || _d S r   )r   mediaBox)r   r   r   r   r   r	   r
   _   s   
zCGContextPage.__init__c                 C   s   t | j| j}|S r   )r   ZCGContextBeginPager   r   )r   Z	mediaRectr   r   r	   r   c   s   zCGContextPage.__enter__c                 C   r   r   )r   ZCGContextEndPager   r   r   r   r	   r   g   r   zCGContextPage.__exit__r   r   r   r   r   r	   r   M   s
    
r   )r   __all__r   r   r   r   r   r   r   r	   <module>   s    %