
    Q?ho                          S r SrSS jrSS jrg)z3.4.34z;Utility functions to position and resize boxes within boxesc                 ~    US;  a  US;   a  XS-  -  n OX-  n US;  a  US;   a  XS-  -  nOX-  nU(       a  XX#4$ X4$ )zagiven rectangle controlled by x,y width and height return 
the corner corresponding to the anchornwwswncs       @r   r
   se)r   r	   e )xywidthheightanchordimss         H/var/www/html/env/lib/python3.13/site-packages/reportlab/lib/boxstuff.py
rectCornerr      s\     _$]"rMAJA_$]"NAKA!%A0A50    c	                    Sn	Uc  UnUc  UnUS:  a  U* nX$-  nUS:  a  U* nX5-  nU (       ag  [        U5      n[        U5      n[        U[        U5      -  U[        U5      -  5      n	Un
UnX-  S-
  nX-  S-
  nU(       d  [        X#X-
  X-
  U5      u  p#U(       a*  US;  a  X1S;   a  US-  OU-  nUS;  a  X!S;   a  US-  OU-  nX#XEU	4$ )	a,  This function helps position an image within a box.

It first normalizes for two cases:
- if the width is None, it assumes imWidth
- ditto for height
- if width or height is negative, it adjusts x or y and makes them positive

Given
(a) the enclosing box (defined by x,y,width,height where x,y is the         lower left corner) which you wish to position the image in, and
(b) the image size (imWidth, imHeight), and
(c) the 'anchor point' as a point of the compass - n,s,e,w,ne,se etc         and c for centre,

this should return the position at which the image should be drawn,
as well as a scale factor indicating what scaling has happened.

It returns the parameters which would be used to draw the image
without any adjustments:

    x,y, width, height, scale

used in canvas.drawImage and drawInlineImage
g      ?    g:0yE>r   )r   r	   r   r   r   r   )absminfloatr   )preserver   r   r   r   r   imWidthimHeight
anchorAtXYscaleowidthoheights               r   aspectRatioFixr%      s   2 E}~Qw	
ax	g,x=E%.(h)?@d"$ a&,w~fEDA(56AA(}4r%?Au$$r   N)r   F)F)__version____doc__r   r%   r   r   r   <module>r(      s    I1?%r   