Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Neb`Dã @s(dZddlmZddlmZmZmZmZmZm Z m Z ddl m Z m Z ddlmZmZmZmZmZmZmZddlmZd(dd „Zd d „ZGd d „d eƒZGdd„deƒZGdd„deƒZdd„Zdd„Zdd„ZGdd„deeƒZ e!dk�r$dZ"eddƒZ#e#j$e d)dd d!d"dd#�ƒe#j%d$gd%d&d'�dS)*z3.3.0é)Úcolors)ÚisNumberÚ isColorOrNoneÚ isBooleanÚisListOfNumbersÚOneOfÚisListOfColorsÚisNumberOrNone)ÚAttrMapÚ AttrMapValue)ÚDrawingÚGroupÚLineÚRectÚ LineShapeÚ definePathÚ EmptyClipPath)ÚWidgetNcCsz|dkr|d}d}|dkr d}g}||d}xD|t|ƒ|}|dkrV||krVPn|dkrh||krhP|j|ƒq2W|S)z6A range function, that does accept float increments...Nggð?g-Cëâ6?r)ÚlenÚappend)ÚstartÚendÚincÚLÚnext©rúA/tmp/tmp4i9tl1d3/lib64/python/reportlab/graphics/widgets/grids.pyÚfrange s rcCs@g}x6tt|dd…ƒƒD]}|j||d||ƒqW|S)z}Returns a list of distances between adjacent numbers in some input list. E.g. [1, 1, 2, 3, 5, 7] -> [0, 1, 1, 2, 2] Nééÿÿÿÿ)Úrangerr)ÚlistÚdÚirrrÚmakeDistancesList#sr$c@sþeZdZdZeeedd�eedd�eedd�eedd�eed'ƒd d�eed(ƒd d�eed)ƒd d�eedd�eedd�eedd�ee dd�ee dd�ee dd�eedd�ee dd�ee dd�d�Z dd„Z dd„Zdd„Zd*dd„Zd d!„Zd"d#„Zd$d%„Zd&S)+ÚGridaŽThis makes a rectangular grid of equidistant stripes. The grid contains an outer border rectangle, and stripes inside which can be drawn with lines and/or as solid tiles. The drawing order is: outer rectangle, then lines and tiles. The stripes' width is indicated as 'delta'. The sequence of stripes can have an offset named 'delta0'. Both values need to be positive! z!The grid's lower-left x position.)Údescz!The grid's lower-left y position.zThe grid's width.zThe grid's height.ÚverticalÚ horizontalz1Determines if stripes are vertical or horizontal.rrz+Determines if stripes are drawn with lines.z6Determines if stripes are drawn with solid rectangles.z+Determines the width/height of the stripes.z3Determines the stripes initial width/height offset.z%List of deltas to be used cyclically.z:Colors applied cyclically in the right or upper direction.z&Background color for entire rectangle.zColor used for lines.zWidth used for lines.zColor for outer rect stroke.zWidth for outer rect stroke.)ÚxÚyÚwidthÚheightÚ orientationÚuseLinesÚuseRectsÚdeltaÚdelta0Ú deltaStepsÚ stripeColorsÚ fillColorÚ strokeColorÚ strokeWidthÚrectStrokeColorÚrectStrokeWidthcCshd|_d|_d|_d|_d|_d|_d|_d|_d|_g|_ t j |_ t j t jt jg|_t j|_d|_dS)Nrédr'réé)r)r*r+r,r-r.r/r0r1r2rÚwhiter4ÚredÚgreenÚbluer3Úblackr5r6)ÚselfrrrÚ__init__Ysz Grid.__init__cCstddƒ}tƒ}|j|ƒ|S)Nr9)r r%Úadd)rAÚDÚgrrrÚdemojs  z Grid.democCs`t|d|jƒ}t|d|jƒ}|js*|rX|rXt|j|j|j|jƒ}|j|_||_||_|SdSdS)Nr7r8) Úgetattrr5r6r4rr)r*r+r,)rAr5r6ÚrectrrrÚ makeOuterRectrszGrid.makeOuterRectcCs¼|j|j}}|r|}n|}|jr|||jg}d}x`|d||krL|d=P|j|d|j|t|jƒƒ|d}q4Wnt||j|||jƒ}|j||ƒ|jdkr¸|jd|ƒ|S)z1Returns a list of positions where to place lines.rrrrr) r+r,r2r1rrrr0Úinsert)rArÚisXÚwÚhÚlengthÚrr#rrrÚmakeLinePosList~s$ "  zGrid.makeLinePosListcCsÔtƒ}|j|j}}|jdkrÐ|jdkrx|j|jdd�}x–|D]4}t||j||j|ƒ}|j |_ |j |_ |j |ƒq>WnX|jdkrÐ|j|jdd�}x<|D]4}t|j||j||ƒ}|j |_ |j |_ |j |ƒq˜W|S)Nrr')rKr(r) r r+r,r.r-rPr)rr*r5r6rC)rAÚgrouprLrMrOr)Úliner*rrrÚmakeInnerLines™s$     zGrid.makeInnerLinesc Csøtƒ}|j|j}}|jdkrô|j}|jdkr@|j|jdd�}n|jdkrZ|j|jdd�}t |ƒ}d}xŒt t |ƒƒD]|}|jdkr ||} t | |j|||ƒ} n&|jdkrÆ||} t |j| |||ƒ} ||t |ƒ| _ d| _|j| ƒ|d}qtW|S)Nrr')rKr(r)r r+r,r/r3r-rPr)r*r$r rrr4r5rC) rArQrLrMÚcolsrOÚdistr#Újr)Ústriper*rrrÚmakeInnerTiles²s,       zGrid.makeInnerTilescCs8tƒ}|j|jƒƒ|j|jƒƒ|j|jƒdd�|S)NÚ _gridLines)Úname)r rCrIrXrS)rArQrrrÚdrawÓs z Grid.drawN)r'r()rr)rr)r)Ú__name__Ú __module__Ú __qualname__Ú__doc__r r rrrrrr Ú_attrMaprBrFrIrPrSrXr[rrrrr%0sF       !r%c @sleZdZdZeeedd�eedd�eedd�eedd�eddd�edd d�d �Zd d „Zd d„Z dd„Z dS)Ú DoubleGridzFThis combines two ordinary Grid objects orthogonal to each other. z!The grid's lower-left x position.)r&z!The grid's lower-left y position.zThe grid's width.zThe grid's height.NzThe first grid component.zThe second grid component.)r)r*r+r,Úgrid0Úgrid1cCs d|_d|_d|_d|_tƒ}|j|_|j|_|j|_|j|_d|_d|_d|_d|_d|_ g|_ t j |_ t jt jt jg|_t j|_d|_tƒ}|j|_|j|_|j|_|j|_d|_d|_d|_d|_d|_ g|_ t j |_ t jt jt jg|_t j|_d|_||_||_dS)Nrr9r'rr:r()r)r*r+r,r%r-r.r/r0r1r2rr<r4r=r>r?r3r@r5r6rbrc)rAÚg0Úg1rrrrBësHzDoubleGrid.__init__cCstddƒ}tƒ}|j|ƒ|S)Nr9)r rarC)rArDrErrrrFs  zDoubleGrid.democCs†tƒ}|j|j}}|jdkr0|jdkr0||fp6||f}x|D]}|j|jƒƒq>Wx,|D]$}|j|jƒƒ|j|jƒdd�qZW|S)NrrrY)rZ)r rbrcr/rCrIrXrS)rArQrdreÚGrErrrr[$s$  zDoubleGrid.draw) r\r]r^r_r r rr`rBrFr[rrrrraÞs     2rac@sªeZdZdZeeedd�eedd�eedd�eedd�eedƒd d�eed d�eed d�eed d�eed d�eedd�ee dd�d� Z dd„Z dd„Z dd„Z dd„ZdS)Ú ShadedRecta This makes a rectangle with shaded colors between two colors. Colors are interpolated linearly between 'fillColorStart' and 'fillColorEnd', both of which appear at the margins. If 'numShades' is set to one, though, only 'fillColorStart' is used. z!The grid's lower-left x position.)r&z!The grid's lower-left y position.zThe grid's width.zThe grid's height.r'r(z1Determines if stripes are vertical or horizontal.z#The number of interpolating colors.zStart value of the color shade.zEnd value of the color shade.zColor used for border line.zWidth used for lines.z#True if shading reverses in middle.) r)r*r+r,r-Ú numShadesÚfillColorStartÚ fillColorEndr5r6Ú cylinderModecKsVd|_d|_d|_d|_d|_d|_tj|_tj |_ tj |_ d|_ d|_ |j|ƒdS)Nrr9r'r:r;)r)r*r+r,r-rhrZpinkrir@rjr5r6rkZ setProperties)rAÚkwrrrrBKszShadedRect.__init__cCstddƒ}tƒ}|j|ƒ|S)Nr9)r rgrC)rArDrErrrrFYs  zShadedRect.democCsÌ|j|j|j|j|j|jf\}}}}}}|dkr\|dkr\||}| }|jdkr¼||}}n`|dkr�|dkr�||}| }|jdkr¼||}}n,|dkr¼|dkr¼||}| }||}| }||||||fS)z8Flip rectangle's corners if width or height is negative.rr'r()r)r*r+r,rirjr-)rAr)r*r+r,rirjrrrÚ_flipRectCorners`s"(  zShadedRect._flipRectCornerscCs¬tƒ}|jƒ\}}}}}}|j}|jrJ|ds6|d}t|ddƒd} t|ƒ} |jdk} | r†|dkrp|g} qªt||||| ƒ} n$|dkr–|g} nt||||| ƒ} xº| D]²} | rÊt| ||| |ƒpÚt|| ||| ƒ}|j�r,| j | ƒ| k�rt j ||| | | d| ƒ}nt j ||| d| | | ƒ}nt j ||| d| d| ƒ}||_ ||_ d|_|j|ƒq°W|j �r¨|jdk�r¨t||||ƒ}|j |_ |j|_d|_ |j|ƒ|S)Nr;rr'rrr)r rmrhrkÚintÚfloatr-rrÚindexrÚlinearlyInterpolatedColorr4r5r6rC)rArQr)r*rLrMÚc0Úc1rhZ halfNumShadesÚnumr'ÚVÚvrWÚcolrHrrrr[rsD  ( zShadedRect.drawN)r'r()r\r]r^r_r r rrrrr`rBrFrmr[rrrrrg4s"         rgcCsP|dkr|gSg}|dkrL|d}x(t|ƒD]}|jtj||d||ƒƒq,W|S)z7Return a range of intermediate colors between c0 and c1rr)r rrrq)rrrsÚnÚCZlimr#rrrÚ colorRange�srzcCsFd}d}x |D]\}}||7}||7}qWtt|ƒƒ}||||fS)z(compute average point of a set of pointsr)ror)ÚPZcxÚcyr)r*rxrrrÚcentroid©s  r}cCsüddlm}m}m}t|ƒ\}}|d|}||ƒ||ƒ} } | | ||fdd„} | | ||fdd„} tt| |ƒƒ} | jƒ| d| d }}tt| |ƒƒ} | jƒ| d| d }}||||_|_ ||||_ |_ t | | | | ||fd �}|j |ƒ|S) aU given P a sequence P of x,y coordinate pairs and an angle in degrees find the centroid of P and the axis at angle theta through it find the extreme points of P wrt axis parallel distance and axis orthogonal distance. Then compute the least rectangle that will still enclose P when rotated by angle. The class R r)ÚpiÚcosÚsing€f@cSs |\}}||||||S)Nr)ÚxyÚsÚcÚx0Úy0r)r*rrrÚparallelAxisDistÁsz.rotatedEnclosingRect..parallelAxisDistcSs |\}}||||||S)Nr)r�r‚rƒr„r…r)r*rrrÚorthogonalAxisDistÄsz0rotatedEnclosingRect..orthogonalAxisDistr)Ú transformrr)Úmathr~rr€r}r!ÚmapÚsortr)r+r*r,r rC)r{ÚanglerHr~rr€r„r…Úthetar‚rƒr†r‡rZa0Za1Zb0Zb1rErrrÚrotatedEnclosingRect³s"    rŽc @sVeZdZeeeedd�eeƒeeƒeedd�eedd�ee ƒd�Z dd„Z dd „Z d S) Ú ShadedPolygonz Shading angle)r&z#The number of interpolating colors.z#True if shading reverses in middle.)ZBASErŒrirjrhrkÚpointscKsDd|_tj|_tj|_d|_d|_dddddd g|_t j ||ƒdS) NéZré2rr;érrr) rŒrr=rir>rjrkrhr�rrB)rArlrrrrBÝszShadedPolygon.__init__cCs|j}tt|fdd„tdt|ƒdƒƒƒ}td|dgdd„|dd…Dƒd gddd �}d|_tƒ}|j|ƒ|j }d }|d krŠd}n|dkršd}d}t dd|d�}xdD]}t ||t ||ƒƒq®W|jt |||ƒƒ|jtƒ|jƒ}d|_|j|_|j|_|j|ƒ|S)NcSs||||dfS)Nrr)r#r{rrrÚèsz$ShadedPolygon.draw..rr;ÚmoveTocSsg|] }d|‘qS)ÚlineTo)r–r)Ú.0r)rrrú ész&ShadedPolygon.draw..rZ closePath)r4r5r'é´r‘ér()r6r5r-rirjrhrk)r•)r‘rš)rirjrhrk)r�r!rŠr rrZ isClipPathr rCrŒrgÚsetattrrGrŽrÚcopyr5r6)rAr{ÚpathrErŒr-rHÚkrrrr[æs2"*     zShadedPolygon.drawN) r\r]r^r rr rrrrr`rBr[rrrrr�Ós     r�Ú__main__é-éxé é<énrr‘r’)r�r5r6rŒrhrkZgifZshobjz/tmp)ÚformatsZfnRootZoutDir)NN)r¢r¢r£r£r¤r¢)&Ú __version__Z reportlab.librZreportlab.lib.validatorsrrrrrrr Zreportlab.lib.attrmapr r Zreportlab.graphics.shapesr r rrrrrZreportlab.graphics.widgetbaserrr$r%rargrzr}rŽr�r\rŒrDrCÚsaverrrrÚs( $$   /Vi   .