o
    i                     @   s   d Z ddlZddlmZ G dd dZG dd deZG dd	 d	eZG d
d deZG dd deZ	G dd deZ
G dd de
ZG dd deZG dd deZG dd deZG dd de
Zeeee	eeeegZdddZdS )z/Contains classes for generating hatch patterns.    N)Pathc                   @   s   e Zd ZdZdS )HatchPatternBasez#The base class for a hatch pattern.N)__name__
__module____qualname____doc__ r   r   K/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/hatch.pyr      s    r   c                   @      e Zd Zdd Zdd ZdS )HorizontalHatchc                 C   .   t |d|d | | _| jd | _d S )N-+   intcount	num_linesnum_verticesselfhatchdensityr   r   r	   __init__      zHorizontalHatch.__init__c                 C   s   t jdd| jddd\}}||d 7 }d|dd ddf< ||dd dd	f< d|d	d ddf< ||d	d dd	f< tj|dd d< tj|d	d d< d S 
N              ?FT)retstepg       @r   r      nplinspacer   r   MOVETOLINETOr   verticescodesstepsstepsizer   r   r	   set_vertices_and_codes      
z&HorizontalHatch.set_vertices_and_codesNr   r   r   r   r*   r   r   r   r	   r          r   c                   @   r
   )VerticalHatchc                 C   r   )N|r   r   r   r   r   r   r	   r      r   zVerticalHatch.__init__c                 C   s   t jdd| jddd\}}||d 7 }||dd ddf< d|dd dd	f< ||d	d ddf< d|d	d dd	f< tj|dd d< tj|d	d d< d S r   r    r%   r   r   r	   r*   "   r+   z$VerticalHatch.set_vertices_and_codesNr,   r   r   r   r	   r.      r-   r.   c                   @   r
   )NorthEastHatchc                 C   L   t |d|d |d | | _| jr!| jd d | _d S d| _d S )N/xXr   r   r   r   r   r   r   r	   r   /   s    
zNorthEastHatch.__init__c                 C   s   t dd| jd }d| |dd ddf< d| |dd ddf< d| |dd ddf< d| |dd ddf< tj|dd d< tj|dd d< d S Ng      g      ?r   r   r   r   r   r    r   r&   r'   r(   r   r   r	   r*   7      z%NorthEastHatch.set_vertices_and_codesNr,   r   r   r   r	   r0   .   s    r0   c                   @   r
   )SouthEastHatchc                 C   r1   )N\r3   r4   r   r   r   r   r   r   r   r	   r   B   s   
zSouthEastHatch.__init__c                 C   s   t dd| jd }d| |dd ddf< d| |dd ddf< d| |dd ddf< d| |dd ddf< tj|dd d< tj|dd d< d S r5   r    r6   r   r   r	   r*   K   r7   z%SouthEastHatch.set_vertices_and_codesNr,   r   r   r   r	   r8   A   s    	r8   c                   @   s    e Zd ZdZdd Zdd ZdS )ShapesFc                 C   sh   | j dkrd| _d| _d S | j d d | j d  | j d | j   | _| jt| j | jr.dnd | _d S )Nr   r   r   )num_rows
num_shapesr   lenshape_verticesfilledr   r   r   r	   r   X   s   


zShapes.__init__c                 C   s  d| j  }| j| | j }| js|d d d d }| j}t|}d}t| j d D ]]}	|	d dkr<tdd| j d }
nt|d d|d  | j }
|	| }|
D ]5}|||f |||| < ||||| < ||7 }| js|||f |||| < ||||| < ||7 }qPq)d S )Nr   g?r   r   r   )	r;   r>   sizer?   shape_codesr=   ranger!   r"   )r   r&   r'   offsetr>   inner_verticesrB   
shape_sizecursorrowcolsrow_poscol_posr   r   r	   r*   c   s6   
zShapes.set_vertices_and_codesN)r   r   r   r?   r   r*   r   r   r   r	   r:   U   s    r:   c                   @   s   e Zd Zdd ZdS )Circlesc                 C   s*   t  }|j| _|j| _t| || d S )N)r   unit_circler&   r>   r'   rB   r:   r   r   r   r   pathr   r   r	   r      s   zCircles.__init__N)r   r   r   r   r   r   r   r	   rL   ~   s    rL   c                   @      e Zd ZdZdd ZdS )SmallCirclesg?c                 C   "   | d| | _t| || d S )Nor   r;   rL   r   r   r   r   r	   r         zSmallCircles.__init__Nr   r   r   rA   r   r   r   r   r	   rQ          rQ   c                   @   rP   )LargeCirclesgffffff?c                 C   rR   )NOrT   r   r   r   r	   r      rU   zLargeCircles.__init__NrV   r   r   r   r	   rX      rW   rX   c                   @      e Zd ZdZdZdd ZdS )SmallFilledCirclesg?Tc                 C   rR   )N.rT   r   r   r   r	   r      rU   zSmallFilledCircles.__init__Nr   r   r   rA   r?   r   r   r   r   r	   r[          r[   c                   @   rZ   )StarsgUUUUUU?Tc                 C   s\   | d| | _td}|j| _tjt| jtj	tj
d| _tj| jd< t| || d S )N*   )dtyper   )r   r;   r   unit_regular_starr&   r>   r!   fullr=   r$   	code_typerB   r#   r:   r   rN   r   r   r	   r      s   
zStars.__init__Nr]   r   r   r   r	   r_      r^   r_      c           
         s   t    fddtD }tdd |D }|dkr"ttdS t|df}t|tj}d}|D ]$}|jdkrX||||j  }||||j  }	|||	 ||j7 }q4t||S )z
    Given a hatch specifier, *hatchpattern*, generates Path to render
    the hatch in a unit square.  *density* is the number of lines per
    unit square.
    c                    s   g | ]}| qS r   r   ).0
hatch_typer   hatchpatternr   r	   
<listcomp>   s    zget_path.<locals>.<listcomp>c                 S   s   g | ]}|j qS r   )r   )rg   patternr   r   r	   rk      s    r   )r   r   r   )	r   _hatch_typessumr   r!   emptyre   r   r*   )
rj   r   patternsr   r&   r'   rG   rl   vertices_chunkcodes_chunkr   ri   r	   get_path   s$   


rs   )rf   )r   numpyr!   matplotlib.pathr   r   r   r.   r0   r8   r:   rL   rQ   rX   r[   r_   rm   rs   r   r   r   r	   <module>   s0    )	