§
    `Ò³g!O  ã                   ó   — d Z ddl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 ddlmZ ej        Z ej        e¦  «        Z G d„ de	j        ¦  «        Zd	„ Z	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z G d„ d¦  «        ZdS ))ÚPdfPageÚPdfColorSchemeé    N)ÚPdfiumError)Ú	PdfBitmap)ÚPdfTextPage)Ú	PdfObjectc                   ó  ‡ — e Zd ZdZˆ fd„Zed„ ¦   «         Zed„ ¦   «         Zd„ Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd$d„Zd„ Zd$d„Zd„ Zd$d„Zd„ Zd$d„Zd„ Zd$d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd%d„Zej         fd„Z!d dd!de"j#        dd"fd#„Z$ˆ xZ%S )&r   z¸
    Page helper class.
    
    Attributes:
        raw (FPDF_PAGE): The underlying PDFium page handle.
        pdf (PdfDocument): Reference to the document this page belongs to.
    c                 ó–   •— |||c| _         | _        | _        t          ¦   «                              t
          j        | j        ¦  «         d S ©N)ÚrawÚpdfÚformenvÚsuperÚ__init__r   Ú_close_impl)Úselfr   r   r   Ú	__class__s       €úU/var/www/html/mpstechhub/venv/lib/python3.11/site-packages/pypdfium2/_helpers/page.pyr   zPdfPage.__init__   s>   ø€ Ø+.°°WÐ(ˆŒ�$”(˜DœLÝ‰Œ×Ò�Ô,¨d¬lÑ;Ô;Ð;Ð;Ð;ó    c                 ó\   — |rt          j        | |¦  «         t          j        | ¦  «         d S r   )Úpdfium_cÚFORM_OnBeforeClosePageÚFPDF_ClosePage)r   r   s     r   r   zPdfPage._close_impl"   s4   € àð 	:ÝÔ+¨C°Ñ9Ô9Ð9ÝÔ Ñ$Ô$Ð$Ð$Ð$r   c                 ó   — | j         S r   )r   ©r   s    r   ÚparentzPdfPage.parent)   s   € ð Œxˆr   c                 ó*   — t          j        | ¦  «        S )z`
        Returns:
            float: Page width (horizontal size), in PDF canvas units.
        )r   ÚFPDF_GetPageWidthFr   s    r   Ú	get_widthzPdfPage.get_width/   s   € õ
 Ô*¨4Ñ0Ô0Ð0r   c                 ó*   — t          j        | ¦  «        S )z_
        Returns:
            float: Page height (vertical size), in PDF canvas units.
        )r   ÚFPDF_GetPageHeightFr   s    r   Ú
get_heightzPdfPage.get_height6   s   € õ
 Ô+¨DÑ1Ô1Ð1r   c                 óR   — |                       ¦   «         |                      ¦   «         fS )zb
        Returns:
            (float, float): Page width and height, in PDF canvas units.
        )r   r"   r   s    r   Úget_sizezPdfPage.get_size=   s#   € ð
 —’Ñ Ô  $§/¢/Ñ"3Ô"3Ð4Ð4r   c                 óJ   — t           j        t          j        | ¦  «                 S )zO
        Returns:
            int: Clockwise page rotation in degrees.
        )Úpdfium_iÚRotationToDegreesr   ÚFPDFPage_GetRotationr   s    r   Úget_rotationzPdfPage.get_rotationG   s   € õ
 Ô)­8Ô+HÈÑ+NÔ+NÔPÐPr   c                 óP   — t          j        | t          j        |         ¦  «         dS )z\
        Define the absolute, clockwise page rotation (0, 90, 180, or 270 degrees).
        N)r   ÚFPDFPage_SetRotationr&   ÚRotationToConst)r   Úrotations     r   Úset_rotationzPdfPage.set_rotationN   s%   € õ 	Ô% d­HÔ,DÀXÔ,NÑOÔOÐOÐOÐOr   c                 óê   — t          ¦   «         t          ¦   «         t          ¦   «         t          ¦   «         f\  }}}} || ||||¦  «        }|s|r
 |¦   «         nd S |j        |j        |j        |j        fS r   )Úc_floatÚvalue)	r   Úbox_funcÚfallback_funcÚfallback_okÚleftÚbottomÚrightÚtopÚoks	            r   Ú_get_boxzPdfPage._get_boxU   st   € Ý#*¡9¤9­g©i¬i½¹¼ÅGÁIÄIÐ#MÑ ˆˆf�e˜SØˆX�d˜D &¨%°Ñ5Ô5ˆØð 	>Ø'2Ð<�M�M‘O”O�O¸Ð=Ø”
˜FœL¨%¬+°s´yÐAÐAr   Tc                 óF   — |                       t          j        d„ |¦  «        S )añ  
        Returns:
            (float, float, float, float) | None:
            The page MediaBox in PDF canvas units, consisting of four coordinates (usually x0, y0, x1, y1).
            If MediaBox is not defined, returns ANSI A (0, 0, 612, 792) if ``fallback_ok=True``, None otherwise.
        Note:
            Due to quirks in PDFium's public API, all ``get_*box()`` functions except :meth:`.get_bbox`
            do not inherit from parent nodes in the page tree (as of PDFium 5418).
        c                  ó   — dS )N)r   r   id  i  © r=   r   r   ú<lambda>z&PdfPage.get_mediabox.<locals>.<lambda>i   s   € ÐDT€ r   )r:   r   ÚFPDFPage_GetMediaBox©r   r4   s     r   Úget_mediaboxzPdfPage.get_mediabox^   s"   € ð �}Š}�XÔ:Ð<TÐ<TÐVaÑbÔbÐbr   c                 ó6   — t          j        | ||||¦  «         dS )zn
        Set the page's MediaBox by passing four :class:`float` coordinates (usually x0, y0, x1, y1).
        N)r   ÚFPDFPage_SetMediaBox©r   ÚlÚbÚrÚts        r   Úset_mediaboxzPdfPage.set_mediaboxk   ó#   € õ 	Ô% d¨A¨q°!°QÑ7Ô7Ð7Ð7Ð7r   c                 óN   — |                       t          j        | j        |¦  «        S )zc
        Returns:
            The page's CropBox (If not defined, falls back to MediaBox).
        )r:   r   ÚFPDFPage_GetCropBoxrA   r@   s     r   Úget_cropboxzPdfPage.get_cropboxq   s    € ð
 �}Š}�XÔ9¸4Ô;LÈkÑZÔZÐZr   c                 ó6   — t          j        | ||||¦  «         dS )z)
        Set the page's CropBox.
        N)r   ÚFPDFPage_SetCropBoxrD   s        r   Úset_cropboxzPdfPage.set_cropboxx   ó#   € õ 	Ô$ T¨1¨a°°AÑ6Ô6Ð6Ð6Ð6r   c                 óN   — |                       t          j        | j        |¦  «        S )zc
        Returns:
            The page's BleedBox (If not defined, falls back to CropBox).
        )r:   r   ÚFPDFPage_GetBleedBoxrM   r@   s     r   Úget_bleedboxzPdfPage.get_bleedbox~   s    € ð
 �}Š}�XÔ:¸DÔ<LÈkÑZÔZÐZr   c                 ó6   — t          j        | ||||¦  «         dS )z*
        Set the page's BleedBox.
        N)r   ÚFPDFPage_SetBleedBoxrD   s        r   Úset_bleedboxzPdfPage.set_bleedbox…   rJ   r   c                 óN   — |                       t          j        | j        |¦  «        S )zb
        Returns:
            The page's TrimBox (If not defined, falls back to CropBox).
        )r:   r   ÚFPDFPage_GetTrimBoxrM   r@   s     r   Úget_trimboxzPdfPage.get_trimbox‹   s    € ð
 �}Š}�XÔ9¸4Ô;KÈ[ÑYÔYÐYr   c                 ó6   — t          j        | ||||¦  «         dS )z)
        Set the page's TrimBox.
        N)r   ÚFPDFPage_SetTrimBoxrD   s        r   Úset_trimboxzPdfPage.set_trimbox’   rQ   r   c                 óN   — |                       t          j        | j        |¦  «        S )za
        Returns:
            The page's ArtBox (If not defined, falls back to CropBox).
        )r:   r   ÚFPDFPage_GetArtBoxrM   r@   s     r   Ú
get_artboxzPdfPage.get_artbox˜   s    € ð
 �}Š}�XÔ8¸$Ô:JÈKÑXÔXÐXr   c                 ó6   — t          j        | ||||¦  «         dS )z(
        Set the page's ArtBox.
        N)r   ÚFPDFPage_SetArtBoxrD   s        r   Ú
set_artboxzPdfPage.set_artboxŸ   s#   € õ 	Ô# D¨!¨Q°°1Ñ5Ô5Ð5Ð5Ð5r   c                 ó¨   — t          j        ¦   «         }t          j        | |¦  «        }|st          d¦  «        ‚|j        |j        |j        |j        fS )zz
        Returns:
            The bounding box of the page (the intersection between its media box and crop box).
        z Failed to get page bounding box.)r   ÚFS_RECTFÚFPDF_GetPageBoundingBoxr   r5   r6   r7   r8   )r   Úrectr9   s      r   Úget_bboxzPdfPage.get_bbox¦   sS   € õ
 Ô Ñ"Ô"ˆÝÔ-¨d°DÑ9Ô9ˆØð 	BÝÐ@ÑAÔAÐAØ”	˜4œ;¨¬
°D´HÐ=Ð=r   c                 óš   — t          j        | ¦  «        }|st          d¦  «        ‚t          || ¦  «        }|                      |¦  «         |S )zY
        Returns:
            PdfTextPage: A new text page handle for this page.
        zFailed to load text page.)r   ÚFPDFText_LoadPager   r   Ú_add_kid)r   Úraw_textpageÚtextpages      r   Úget_textpagezPdfPage.get_textpageµ   sQ   € õ
  Ô1°$Ñ7Ô7ˆØð 	;ÝÐ9Ñ:Ô:Ð:Ý˜|¨TÑ2Ô2ˆØ�Š�hÑÔÐØˆr   c                 óò   — |j         rt          d¦  «        ‚|j        r|j        | j        urt          d¦  «        ‚t          j        | |¦  «         |                     ¦   «          | |_         | j        |_        dS )aº  
        Insert a page object into the page.
        
        The page object must not belong to a page yet. If it belongs to a PDF, this page must be part of the PDF.
        
        Position and form are defined by the object's matrix.
        If it is the identity matrix, the object will appear as-is on the bottom left corner of the page.
        
        Parameters:
            pageobj (PdfObject): The page object to insert.
        zAThe pageobject you attempted to insert already belongs to a page.zBThe pageobject you attempted to insert belongs to a different PDF.N)ÚpageÚ
ValueErrorr   r   ÚFPDFPage_InsertObjectÚ_detach_finalizer)r   Úpageobjs     r   Ú
insert_objzPdfPage.insert_objÂ   s   € ð Œ<ð 	bÝÐ`ÑaÔaÐaØŒ;ð 	c˜GœK¨t¬xÐ7Ð7ÝÐaÑbÔbÐbåÔ& t¨WÑ5Ô5Ð5Ø×!Ò!Ñ#Ô#Ð#ØˆŒØ”hˆŒˆˆr   c                 ó¸   — |j         | urt          d¦  «        ‚t          j        | |¦  «        }|st	          d¦  «        ‚d|_         |                     ¦   «          dS )ab  
        Remove a page object from the page.
        As of PDFium 5692, detached page objects may be only re-inserted into existing pages of the same document.
        If the page object is not re-inserted into a page, its ``close()`` method may be called.
        
        Parameters:
            pageobj (PdfObject): The page object to remove.
        zAThe page object you attempted to remove is not part of this page.zFailed to remove pageobject.N)rp   rq   r   ÚFPDFPage_RemoveObjectr   Ú_attach_finalizer)r   rt   r9   s      r   Ú
remove_objzPdfPage.remove_objÚ   sh   € ð Œ<˜tÐ#Ð#ÝÐ`ÑaÔaÐaåÔ+¨D°'Ñ:Ô:ˆØð 	>ÝÐ<Ñ=Ô=Ð=ØˆŒØ×!Ò!Ñ#Ô#Ð#Ð#Ð#r   c                 óP   — t          j        | ¦  «        }|st          d¦  «        ‚dS )zë
        Generate page content to apply additions, removals or modifications of page objects.
        
        If page content was changed, this function should be called once before saving the document or re-loading the page.
        z Failed to generate page content.N)r   ÚFPDFPage_GenerateContentr   )r   r9   s     r   Úgen_contentzPdfPage.gen_contentî   s8   € õ Ô.¨tÑ4Ô4ˆØð 	BÝÐ@ÑAÔAÐAð	Bð 	Br   Né   r   c              #   óä  K  — |rt           j        }t           j        }|}nt           j        }t           j        }| } ||¦  «        }|dk     rt          d¦  «        ‚t          |¦  «        D ]†}	 |||	¦  «        }
|
€t          d¦  «        ‚t          |
| | j        |¬¦  «        }|r	|j	        |v r|V — |j	        t           j
        k    r+||dz
  k     r"|                      |||
|dz   ¬¦  «        E d{V —† Œ‡dS )a?  
        Iterate through the page objects on this page.
        
        Parameters:
            filter (list[int] | None):
                An optional list of page object types to filter (:attr:`FPDF_PAGEOBJ_*`).
                Any objects whose type is not contained will be skipped.
                If None or empty, all objects will be provided, regardless of their type.
            max_depth (int):
                Maximum recursion depth to consider when descending into Form XObjects.
        
        Yields:
            :class:`.PdfObject`: A page object.
        r   z%Failed to get number of page objects.NzFailed to get page object.)rp   r   Úlevelé   )ÚfilterÚ	max_depthÚformr   )r   ÚFPDFFormObj_CountObjectsÚFPDFFormObj_GetObjectÚFPDFPage_CountObjectsÚFPDFPage_GetObjectr   Úranger   r   ÚtypeÚFPDF_PAGEOBJ_FORMÚget_objects)r   r�   r‚   rƒ   r   Úcount_objectsÚ
get_objectr   Ú	n_objectsÚiÚraw_objÚ
helper_objs               r   r‹   zPdfPage.get_objectsù   sN  è è € ð$ ð 	Ý$Ô=ˆMÝ!Ô7ˆJØˆFˆFå$Ô:ˆMÝ!Ô4ˆJØˆFà!�M &Ñ)Ô)ˆ	Ø�qŠ=ˆ=ÝÐEÑFÔFÐFå�yÑ!Ô!ð 	ð 	ˆAà �j ¨Ñ+Ô+ˆGØˆÝ!Ð">Ñ?Ô?Ð?õ # 7°¸4¼8È5ÐQÑQÔQˆJØð !˜Zœ_°Ð6Ð6Ø Ð Ð Ð àŒ¥(Ô"<Ò<Ð<ÀÈÐSTÉÒATÐATØ×+Ò+Ø#Ø )Ø"Ø! A™Ið	 ,ñ ô ð ð ð ð ð ð ð øð	ð 	r   c                 ón   — t          j        | |¦  «        }|t           j        k    rt          d¦  «        ‚|S )a3  
        Attempt to flatten annotations and form fields into the page contents.
        
        Parameters:
            flag (int): PDFium flattening target (:attr:`FLAT_*`)
        Returns:
            int: PDFium flattening status (:attr:`FLATTEN_*`). :attr:`FLATTEN_FAIL` is handled internally.
        z,Failed to flatten annotations / form fields.)r   ÚFPDFPage_FlattenÚFLATTEN_FAILr   )r   ÚflagÚrcs      r   Ú_flattenzPdfPage._flatten-  s8   € õ Ô& t¨TÑ2Ô2ˆØ•Ô&Ò&Ð&ÝÐLÑMÔMÐMØˆ	r   r€   )r   r   r   r   Fc                 ó¾  ‡— t          j        |                      ¦   «         ‰z  ¦  «        }	t          j        |                      ¦   «         ‰z  ¦  «        }
|dv r|
|	}
}	ˆfd„|D ¦   «         }|	|d         z
  |d         z
  }|
|d         z
  |d         z
  }t	          d„ ||fD ¦   «         ¦  «        rt          d¦  «        ‚t          di |¤Ž\  }}}}|�|r|t          j        z  } |||||¬
¦  «        }| 	                    dd|||¦  «         || |d          |d          |	|
t          j        |         |f}|€t          j        |Ž  n|t          j        d¬¦  «        }t          j        |dd„ ¦  «         |                     |¦  «        }t          j        g |¢|‘|‘R Ž }|t          j        k    sJ ‚t          j        | ¦  «         |r| j        rt          j        | j        g|¢R Ž  |S )a¦  
        Rasterize the page to a :class:`.PdfBitmap`.
        
        Parameters:
            
            scale (float):
                A factor scaling the number of pixels per PDF canvas unit. This defines the resolution of the image.
                To convert a DPI value to a scale factor, multiply it by the size of 1 canvas unit in inches (usually 1/72in). [#user_unit]_
                
            rotation (int):
                Additional rotation in degrees (0, 90, 180, or 270).
                
            crop (tuple[float, float, float, float]):
                Amount in PDF canvas units to cut off from page borders (left, bottom, right, top). Crop is applied after rotation.
                
            may_draw_forms (bool):
                If True, render form fields (provided the document has forms and :meth:`~PdfDocument.init_forms` was called).
            
            bitmap_maker (typing.Callable):
                Callback function used to create the :class:`.PdfBitmap`.
                
            color_scheme (PdfColorScheme | None):
                An optional, custom rendering color scheme.
                
            fill_to_stroke (bool):
                If True and rendering with custom color scheme, fill paths will be stroked.
                
            fill_color (tuple[int, int, int, int]):
                Color the bitmap will be filled with before rendering (RGBA values from 0 to 255).
                
            grayscale (bool):
                If True, render in grayscale mode.
                
            optimize_mode (None | str):
                Page rendering optimization mode (None, "lcd", "print").
                
            draw_annots (bool):
                If True, render page annotations.
                
            no_smoothtext (bool):
                If True, disable text anti-aliasing. Overrides ``optimize_mode="lcd"``.
                
            no_smoothimage (bool):
                If True, disable image anti-aliasing.
                
            no_smoothpath (bool):
                If True, disable path anti-aliasing.
                
            force_halftone (bool):
                If True, always use halftone for image stretching.
                
            limit_image_cache (bool):
                If True, limit image cache size.
                
            rev_byteorder (bool):
                If True, render with reverse byte order, leading to ``RGB(A/X)`` output instead of ``BGR(A/X)``.
                Other pixel formats are not affected.
                
            prefer_bgrx (bool):
                If True, prefer four-channel over three-channel pixel formats, even if the alpha byte is unused.
                Other pixel formats are not affected.
                
            force_bitmap_format (int | None):
                If given, override automatic pixel format selection and enforce use of the given format (one of the :attr:`FPDFBitmap_*` constants).
                
            extra_flags (int):
                Additional PDFium rendering flags. May be combined with bitwise OR (``|`` operator).
        
        Returns:
            PdfBitmap: Bitmap of the rendered page.
        
        .. [#user_unit] Since PDF 1.6, pages may define an additional user unit factor. In this case, 1 canvas unit is equivalent to ``user_unit * (1/72)`` inches. PDFium currently does not have an API to get the user unit, so this is not taken into account.
        )éZ   i  c                 ó>   •— g | ]}t          j        |‰z  ¦  «        ‘ŒS r=   )ÚmathÚceil)Ú.0ÚcÚscales     €r   ú
<listcomp>z"PdfPage.render.<locals>.<listcomp>œ  s'   ø€ Ð1Ð1Ð1 q•”	˜!˜E™'Ñ"Ô"Ð1Ð1Ð1r   r   r}   r€   é   c              3   ó"   K  — | ]
}|d k     V — ŒdS )r€   Nr=   )r�   Úds     r   ú	<genexpr>z!PdfPage.render.<locals>.<genexpr>Ÿ  s&   è è € Ð.Ð.˜ˆq�1ŠuÐ.Ð.Ð.Ð.Ð.Ð.r   zCrop exceeds page dimensionsN)ÚformatÚrev_byteorder)ÚversionÚNeedToPauseNowc                 ó   — dS )NFr=   )Ú_s    r   r>   z PdfPage.render.<locals>.<lambda>°  s   € ÀU€ r   r=   )r›   rœ   r   r"   Úanyrq   Ú_parse_renderoptsr   ÚFPDF_CONVERT_FILL_TO_STROKEÚ	fill_rectr&   r,   ÚFPDF_RenderPageBitmapÚIFSDK_PAUSEÚset_callbackÚconvertÚ*FPDF_RenderPageBitmapWithColorScheme_StartÚFPDF_RENDER_DONEÚFPDF_RenderPage_Closer   ÚFPDF_FFLDraw)r   rŸ   r-   ÚcropÚmay_draw_formsÚbitmap_makerÚcolor_schemeÚfill_to_strokeÚkwargsÚ	src_widthÚ
src_heightÚwidthÚheightÚ	cl_formatr¦   Ú
fill_colorÚflagsÚbitmapÚrender_argsÚpauseÚfpdf_csÚstatuss    `                    r   ÚrenderzPdfPage.renderB  s3  ø€ õj ”Y˜tŸ~š~Ñ/Ô/°5Ñ8Ñ9Ô9ˆ	Ý”Y˜tŸšÑ0Ô0°5Ñ8Ñ9Ô9ˆ
Ø�yÐ Ð Ø$.°	�zˆIà1Ð1Ð1Ð1¨DÐ1Ñ1Ô1ˆØ˜d 1œgÑ%¨¨Q¬Ñ/ˆØ˜d 1œgÑ%¨¨Q¬Ñ/ˆÝÐ.Ð.˜u f˜oÐ.Ñ.Ô.Ñ.Ô.ð 	=ÝÐ;Ñ<Ô<Ð<å6GÐ6QÐ6QÈ&Ð6QÐ6QÑ3ˆ	�= *¨eØÐ$¨.Ð$Ø•XÔ9Ñ9ˆEà�˜e V°IÈ]Ð[Ñ[Ô[ˆØ×Ò˜˜A˜u f¨jÑ9Ô9Ð9à˜t d¨1¤g X°°Q´¨x¸ÀJÕPXÔPhÐiqÔPrÐtyÐzˆàÐÝÔ*¨KÐ8Ð8Ð8õ Ô(°Ð3Ñ3Ô3ˆEÝÔ! %Ð)9¸?¸?ÑKÔKÐKà"×*Ò*¨=Ñ9Ô9ˆGÝÔHÐfÈ+ÐfÐW^ÐfÐ`eÐfÐfÐfˆFØ�XÔ6Ò6Ð6Ð6Ð6ÝÔ*¨4Ñ0Ô0Ð0àð 	>˜dœlð 	>ÝÔ! $¤,Ð=°Ð=Ð=Ð=Ð=àˆr   )T)Nr}   Nr   )&Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústaticmethodr   Úpropertyr   r   r"   r$   r)   r.   r:   rA   rI   rM   rP   rT   rW   rZ   r]   r`   rc   rh   rn   ru   ry   r|   r‹   r   ÚFLAT_NORMALDISPLAYr—   r   Ú
new_nativerÉ   Ú__classcell__)r   s   @r   r   r      sS  ø€ € € € € ðð ð<ð <ð <ð <ð <ð
 ð%ð %ñ „\ð%ð ðð ñ „Xðð
1ð 1ð 1ð2ð 2ð 2ð5ð 5ð 5ðQð Qð QðPð Pð PðBð Bð Bðcð cð cð cð8ð 8ð 8ð[ð [ð [ð [ð7ð 7ð 7ð[ð [ð [ð [ð8ð 8ð 8ðZð Zð Zð Zð7ð 7ð 7ðYð Yð Yð Yð6ð 6ð 6ð	>ð 	>ð 	>ð
ð 
ð 
ðð ð ð0$ð $ð $ð(Bð Bð Bð0ð 0ð 0ð 0ðh %Ô7ð ð ð ð ð. ØØØ!Ø$Ô/ØØ"ðxð xð xð xð xð xð xð xr   r   c                 ó‚   — | d         dk     rt           j        S |rt           j        S |rt           j        S t           j        S )Nr¡   éÿ   )r   ÚFPDFBitmap_BGRAÚFPDFBitmap_GrayÚFPDFBitmap_BGRxÚFPDFBitmap_BGR)rÂ   Ú	grayscaleÚprefer_bgrxs      r   Ú_auto_bitmap_formatrÛ   ½  sG   € ð 	�1Œ˜ÒÐÝÔ'Ð'Ø	ð 'ÝÔ'Ð'Ø	ð 'ÝÔ'Ð'åÔ&Ð&r   ©rÔ   rÔ   rÔ   rÔ   FTc                 ó  — |€t          | ||
¦  «        }n|}|t          j        k    rd}	|}|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j	        z  }|	r|t          j
        z  }|rR|                     ¦   «         }|dk    r|t          j        z  }n(|dk    r|t          j        z  }nt          d|› �¦  «        ‚||	| |fS )NFÚlcdÚprintzInvalid optimize_mode )rÛ   r   rÖ   ÚFPDF_GRAYSCALEÚ
FPDF_ANNOTÚFPDF_RENDER_NO_SMOOTHTEXTÚFPDF_RENDER_NO_SMOOTHIMAGEÚFPDF_RENDER_NO_SMOOTHPATHÚFPDF_RENDER_FORCEHALFTONEÚFPDF_RENDER_LIMITEDIMAGECACHEÚFPDF_REVERSE_BYTE_ORDERÚlowerÚFPDF_LCD_TEXTÚFPDF_PRINTINGrq   )rÂ   rÙ   Úoptimize_modeÚdraw_annotsÚno_smoothtextÚno_smoothimageÚno_smoothpathÚforce_halftoneÚlimit_image_cacher¦   rÚ   Úforce_bitmap_formatÚextra_flagsrÁ   rÃ   s                  r   r¬   r¬   Ê  sX  € ð  Ð"Ý'¨
°I¸{ÑKÔKˆ	ˆ	à'ˆ	à•HÔ,Ò,Ð,Øˆà€EØð )Ø•Ô(Ñ(ˆØð %Ø•Ô$Ñ$ˆØð 4Ø•Ô3Ñ3ˆØð 5Ø•Ô4Ñ4ˆØð 4Ø•Ô3Ñ3ˆØð 4Ø•Ô3Ñ3ˆØð 8Ø•Ô7Ñ7ˆØð 2Ø•Ô1Ñ1ˆàð GØ%×+Ò+Ñ-Ô-ˆØ˜EÒ!Ð!Ø•XÔ+Ñ+ˆEˆEØ˜gÒ%Ð%Ø•XÔ+Ñ+ˆEˆEåÐE°mÐEÐEÑFÔFÐFð �m Z°Ð6Ð6r   c                   ó   — e Zd ZdZd„ Zd„ ZdS )r   z�
    Rendering color scheme.
    Each color shall be provided as a list of values for red, green, blue and alpha, ranging from 0 to 255.
    c                 ó6   — t          ||||¬¦  «        | _        d S )N)Úpath_fill_colorÚpath_stroke_colorÚtext_fill_colorÚtext_stroke_color)ÚdictÚcolors)r   Ú	path_fillÚpath_strokeÚ	text_fillÚtext_strokes        r   r   zPdfColorScheme.__init__  s&   € ÝØ%¸Ø%¸ð
ñ 
ô 
ˆŒˆˆr   c           	      ó²   — t          j        ¦   «         }| j                             ¦   «         D ])\  }}t	          ||t          j        ||¦  «        ¦  «         Œ*|S )z\
        Returns:
            The color scheme as :class:`FPDF_COLORSCHEME` object.
        )r   ÚFPDF_COLORSCHEMErû   ÚitemsÚsetattrr&   Úcolor_tohex)r   r¦   rÇ   Úkeyr1   s        r   r²   zPdfColorScheme.convert  s\   € õ
 Ô+Ñ-Ô-ˆØœ+×+Ò+Ñ-Ô-ð 	Nð 	N‰JˆC�Ý�G˜S¥(Ô"6°u¸mÑ"LÔ"LÑMÔMÐMÐMØˆr   N)rÊ   rË   rÌ   rÍ   r   r²   r=   r   r   r   r     s<   € € € € € ðð ð

ð 
ð 
ðð ð ð ð r   r   )rÜ   FNTFFFFFFFNr   )Ú__all__r›   ÚctypesÚloggingÚpypdfium2.rawr   r   Úpypdfium2.internalÚinternalr&   Úpypdfium2._helpers.miscr   Úpypdfium2._helpers.bitmapr   Úpypdfium2._helpers.textpager   Úpypdfium2._helpers.pageobjectsr   r0   Ú	getLoggerrÊ   ÚloggerÚAutoCloseabler   rÛ   r¬   r   r=   r   r   ú<module>r     sa  ðð (€à €€€Ø €€€Ø €€€Ø  Ð  Ð  Ð  Ð  Ð  Ø %Ð %Ð %Ð %Ð %Ð %Ø /Ð /Ð /Ð /Ð /Ð /Ø /Ð /Ð /Ð /Ð /Ð /Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4à
Œ.€Ø	ˆÔ	˜8Ñ	$Ô	$€ðfð fð fð fð fˆxÔ%ñ fô fð fðR
'ð 
'ð 
'ð *ØØØØØØØØ!ØØØ"Øð47ð 47ð 47ð 47ðnð ð ð ð ñ ô ð ð ð r   