
    zvg                    \    d dl mZ d dlZd dlmZmZ ddlmZ  G d d          ZdZ	d	Z
d
ZdS )    )annotationsN)IOTYPE_CHECKING   )EpsImagePluginc                  j    e Zd ZdZd"d#dZd"d$d
Zd%dZd&dZd'dZd(dZ	d)dZ
erddlmZ 	 d"d*d!ZdS )+PSDrawzi
    Sets up printing to the given file. If ``fp`` is omitted,
    ``sys.stdout.buffer`` is assumed.
    NfpIO[bytes] | NonereturnNonec                :    |st           j        j        }|| _        d S N)sysstdoutbufferr
   )selfr
   s     G/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/PIL/PSDraw.py__init__zPSDraw.__init__"   s     	#"B    id
str | Nonec                    | j                             d           | j                             t                     | j                             t                     | j                             d           i | _        dS )z=Set up printing of a document. (Write PostScript DSC header.)sD   %!PS-Adobe-3.0
save
/showpage { } def
%%EndComments
%%BeginDocument
s   %%EndProlog
N)r
   write	EDROFF_PSVDI_PSisofont)r   r   s     r   begin_documentzPSDraw.begin_document'   sk     	!	
 	
 	
 	i   f&''')+r   c                    | j                             d           t          | j         d          r| j                                          dS dS )z-Ends printing. (Write PostScript DSC footer.)s%   %%EndDocument
restore showpage
%%End
flushN)r
   r   hasattrr    )r   s    r   end_documentzPSDraw.end_document7   sH    ABBB47G$$ 	GMMOOOOO	 	r   fontstrsizeintc                    t          |d          }|| j        vr)| j                            d||fz             d| j        |<   | j                            d||fz             dS )z~
        Selects which font to use.

        :param font: A PostScript font name
        :param size: Size in points.
        UTF-8s#   /PSDraw-%s ISOLatin1Encoding /%s E
r   s   /F0 %d /PSDraw-%s F
N)bytesr   r
   r   )r   r#   r%   
font_bytess       r   setfontzPSDraw.setfont=   sx     4))
T\))GMM7:z:RR   ()DL$.$
1CCDDDDDr   xy0tuple[int, int]xy1c                J    | j                             dg ||R z             dS )z
        Draws a line between the two points. Coordinates are given in
        PostScript point coordinates (72 points per inch, (0, 0) is the lower
        left corner of the page).
        s   %d %d %d %d Vl
Nr
   r   )r   r,   r.   s      r   linezPSDraw.lineN   s.     	)LcLCLL899999r   boxtuple[int, int, int, int]c                @    | j                             d|z             dS )z
        Draws a rectangle.

        :param box: A tuple of four integers, specifying left, bottom, width and
           height.
        s   %d %d M 0 %d %d Vr
Nr0   )r   r2   s     r   	rectanglezPSDraw.rectangleV   s$     	-344444r   xytextc                   t          |d          }d                    |                    d                    }d                    |                    d                    }| j                            d||fz   z             dS )z
        Draws text at the given position. You must use
        :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
        r(   s   \(   (s   \)   )s   %d %d M (%s) S
N)r)   joinsplitr
   r   )r   r6   r7   
text_bytess       r   r7   zPSDraw.text_   sx    
 4))
[[!1!1$!7!788
[[!1!1$!7!788
)R:--?@AAAAAr   r   )ImageimImage.Imagedpi
int | Nonec                   |s|j         dk    rd}nd}|j        d         dz  |z  }|j        d         dz  |z  }t          |d         |d         z
            }t          |d         |d         z
            }||k    r
||z  |z  }|}||k    r
||z  |z  }|}||z
  dz  |d         z   }||z
  dz  |d         z   }	| j                            d	||	fz             ||f|j        k    r?||j        d         z  }
||j        d         z  }| j                            d
|
|fz             t          j        || j        dd           | j                            d           dS )z,Draw a PIL image, centered in the given box.1   d   r   H   r         s   gsave
%f %f translate
s   %f %f scale
 s
   
grestore
N)moder%   floatr
   r   r   _save)r   r2   r?   rA   xyxmaxymaxdxdysxsys               r   imagezPSDraw.imagel   s}   
  	w#~~GAJOc!GAJOc!SVc!f_%%SVc!f_%%t88D1AAt88D1AAQh!^c!f$Qh!^c!f$1RH<===q6RWRWQZBRWQZBGMM*b"X5666R"a000o&&&&&r   r   )r
   r   r   r   )r   r   r   r   )r   r   )r#   r$   r%   r&   r   r   )r,   r-   r.   r-   r   r   )r2   r3   r   r   )r6   r-   r7   r$   r   r   )r2   r3   r?   r@   rA   rB   r   r   )__name__
__module____qualname____doc__r   r   r"   r+   r1   r5   r7   r   rJ   r>   rV    r   r   r	   r	      s         
    
, , , , ,    E E E E": : : :5 5 5 5B B B B   RV' ' ' ' ' ' 'r   r	   s  /S { show } bind def
/P { moveto show } bind def
/M { moveto } bind def
/X { 0 rmoveto } bind def
/Y { 0 exch rmoveto } bind def
/E {    findfont
        dup maxlength dict begin
        {
                1 index /FID ne { def } { pop pop } ifelse
        } forall
        /Encoding exch def
        dup /FontName exch def
        currentdict end definefont pop
} bind def
/F {    findfont exch scalefont dup setfont
        [ exch /setfont cvx ] cvx bind def
} bind def
s  /Vm { moveto } bind def
/Va { newpath arcn stroke } bind def
/Vl { moveto lineto stroke } bind def
/Vc { newpath 0 360 arc closepath } bind def
/Vr {   exch dup 0 rlineto
        exch dup 0 exch rlineto
        exch neg 0 rlineto
        0 exch neg rlineto
        setgray fill } bind def
/Tm matrix def
/Ve {   Tm currentmatrix pop
        translate scale newpath 0 0 .5 0 360 arc closepath
        Tm setmatrix
} bind def
/Vf { currentgray exch setgray fill setgray } bind def
s  /landscape false def
/errorBUF 200 string def
/errorNL { currentpoint 10 sub exch pop 72 exch moveto } def
errordict begin /handleerror {
    initmatrix /Courier findfont 10 scalefont setfont
    newpath 72 720 moveto $error begin /newerror false def
    (PostScript Error) show errorNL errorNL
    (Error: ) show
        /errorname load errorBUF cvs show errorNL errorNL
    (Command: ) show
        /command load dup type /stringtype ne { errorBUF cvs } if show
        errorNL errorNL
    (VMstatus: ) show
        vmstatus errorBUF cvs show ( bytes available, ) show
        errorBUF cvs show ( bytes used at level ) show
        errorBUF cvs show errorNL errorNL
    (Operand stargck: ) show errorNL /ostargck load {
        dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL
    } forall errorNL
    (Execution stargck: ) show errorNL /estargck load {
        dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL
    } forall
    end showpage
} def end
)
__future__r   r   typingr   r   rJ   r   r	   r   r   ERROR_PSr[   r   r   <module>r_      s   " # " " " " " 



 $ $ $ $ $ $ $ $      o' o' o' o' o' o' o' o'~	:
2r   