U
    Ñtœd:  ã                   @   sL   d dl mZ d dlmZmZ d dlmZ d dlmZ dZ	G dd„ deƒZ
dS )	é    )Úpi)ÚTupleÚUnion)ÚAbstractDrawer)ÚBoundingBox)ÚAbstractCairoDrawerc                   @   st   e Zd ZU dZeed< epddœdd„Zeedœdd	„ƒZej	d
d	„ ƒZde
e
eeee
df f e
ddœdd„ZdS )r   a^  Abstract class that serves as a base class for anything that
    draws on a Cairo context within a given bounding box.

    A subclass of L{AbstractCairoDrawer} is guaranteed to have an
    attribute named C{context} that represents the Cairo context
    to draw on, and an attribute named C{bbox} for the L{BoundingBox}
    of the drawing area.
    Ú_bboxN)Úbboxc                 C   s   || _ d| _|dk	r|| _dS )a¯  Constructs the drawer and associates it to the given
        Cairo context and the given L{BoundingBox}.

        @param context: the context on which we will draw
        @param bbox:    the bounding box within which we will draw.
                        Can be anything accepted by the constructor
                        of L{BoundingBox} (i.e., a 2-tuple, a 4-tuple
                        or a L{BoundingBox} object).
        N)Úcontextr   r	   )Úselfr
   r	   © r   úR/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/igraph/drawing/cairo/base.pyÚ__init__   s    
zAbstractCairoDrawer.__init__)Úreturnc                 C   s   | j S )zIThe bounding box of the drawing area where this drawer will
        draw.)r   )r   r   r   r   r	   &   s    zAbstractCairoDrawer.bboxc                 C   s    t |tƒst|ƒ| _n|| _dS )zNSets the bounding box of the drawing area where this drawer
        will draw.N)Ú
isinstancer   r   )r   r	   r   r   r   r	   ,   s    
r   é   .)ÚxÚyÚcolorÚsizer   c                 C   sŒ   t |tƒr,ddddddg}||t|ƒ  }nt|ƒdkrB|d }n|}| j}| ¡  |j|Ž  | |||d	 d
dt ¡ | ¡  | 	¡  dS )aõ  Marks the given point with a small circle on the canvas.
        Used primarily for debugging purposes.

        @param x: the X coordinate of the point to mark
        @param y: the Y coordinate of the point to mark
        @param color: the color of the marker. It can be a
          3-tuple (RGB components, alpha=0.5), a 4-tuple
          (RGBA components) or an index where zero means red, 1 means
          green, 2 means blue and so on.
        @param size: the diameter of the marker.
        )é   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   é   )g      à?g       @r   é   N)
r   ÚintÚlenr
   ÚsaveZset_source_rgbaÚarcr   ÚfillÚrestore)r   r   r   r   r   ÚcolorsZcolor_tupleÚctxr   r   r   Ú_mark_point5   s    


zAbstractCairoDrawer._mark_point)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   Úpropertyr	   ÚsetterÚfloatr   r   r   r!   r   r   r   r   r   
   s    
	
  ûúr   N)Úmathr   Útypingr   r   Zigraph.drawing.baseclassesr   Zigraph.drawing.utilsr   Ú__all__r   r   r   r   r   Ú<module>   s
   