o
    g÷§iÏ  ã                   @   sb   d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ G dd	„ d	ƒZdS )
zï
    A conforming reader shall maintain an internal data structure called the graphics state that holds current
    graphics control parameters. These parameters define the global framework within which the graphics
    operators execute.
é    N)ÚDecimal)ÚName)ÚRGBColor)ÚFont)ÚMatrixc                   @   s$   e Zd ZdZdd„ Zi fdd„ZdS )ÚCanvasGraphicsStatea»  
    A conforming reader shall maintain an internal data structure called the graphics state that holds current
    graphics control parameters. These parameters define the global framework within which the graphics
    operators execute.

    EXAMPLE 1
    The f (fill) operator implicitly uses the current colour parameter, and the S (stroke) operator additionally
    uses the current line width parameter from the graphics state.

    A conforming reader shall initialize the graphic state at the beginning of each page with the values specified in
    Table 52 and Table 53. Table 52 lists those graphics state parameters that are device-independent and are
    appropriate to specify in page descriptions. The parameters listed in Table 53 control details of the rendering
    (scan conversion) process and are device-dependent; a page description that is intended to be device-
    independent should not be written to modify these parameters.
    c                 C   sú   t  ¡ | _t  ¡ | _t  ¡ | _tdƒ| _tdƒ| _tdƒ| _tdƒ| _	tdƒ| _
d | _tdƒ| _g | _g | _d | _ttdƒtdƒtdƒƒ| _d | _ttdƒtdƒtdƒƒ| _tdƒ| _d | _d | _tdƒ| _d | _d | _d | _d | _d | _d | _d | _d S )Nr   éd   é   é
   )r   Úidentity_matrixÚctmÚtext_matrixÚtext_line_matrixr   Ú	text_riseÚcharacter_spacingÚword_spacingÚhorizontal_scalingÚleadingÚfontÚ	font_sizeÚpathÚclipping_pathÚnon_stroke_color_spacer   Únon_stroke_colorÚstroke_color_spaceÚstroke_colorÚ
line_widthÚline_capÚ	line_joinÚmiter_limitÚdash_patternÚrendering_intentÚstroke_adjustmentÚ
blend_modeÚ	soft_maskÚalpha_constantÚalpha_source)Úself© r(   úY/home/ubuntu/.local/lib/python3.10/site-packages/borb/pdf/canvas/canvas_graphics_state.pyÚ__init__(   s6   











zCanvasGraphicsState.__init__c                 C   s  t ƒ }t | j|¡|_| jd urt | j|¡|_| jd ur%t | j|¡|_| j|_| j|_| j|_| j	|_	| j
|_
| jd urXt| jtƒrK| j |¡|_t| jtƒrXt | j¡|_| j|_t | j¡|_t | j¡|_t | j¡|_t | j¡|_| j|_| j|_|S )N)r   ÚcopyÚdeepcopyr   r   r   r   r   r   r   r   r   Ú
isinstancer   Ú__deepcopy__r   r   r   r   r   r   r   r   )r'   ÚmemodictÚoutr(   r(   r)   r.   I   s0   


z CanvasGraphicsState.__deepcopy__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r*   r.   r(   r(   r(   r)   r      s    !r   )r4   r+   ÚtypingÚdecimalr   Úborb.io.read.typesr   Úborb.pdf.canvas.color.colorr   Úborb.pdf.canvas.font.fontr   Úborb.pdf.canvas.geometry.matrixr   r   r(   r(   r(   r)   Ú<module>   s   