>Module DrawLib ----------------------------------------------------------------------- DrawFile Handling Routines (version 1.07 19-Apr-96) This library contains routines that handle the creation and display of DrawFiles. ----------------------------------------------------------------------- Public Methods Supported: FNshell_DrawLoadFile FNshell_DrawGetFileSize FNshell_DrawTextCoord PROCshell_DrawCreateFile PROCshell_DrawOutlineFont PROCshell_DrawSetPathWidth PROCshell_DrawSetPathColour PROCshell_DrawSetPathNoColour PROCshell_DrawSetFillColour PROCshell_DrawSetNoFillColour PROCshell_DrawStartGroup PROCshell_DrawEndGroup PROCshell_DrawDestroyFile PROCshell_DrawSaveFile PROCshell_DrawEllipse PROCshell_DrawCircle PROCshell_DrawBox PROCshell_DrawPathStart PROCshell_DrawPathDrawTo PROCshell_DrawPathEnd PROCshell_DrawPathCloseLine PROCshell_DrawLine PROCshell_DrawSetFont PROCshell_DrawInitFont PROCshell_DrawSetUnitsMM PROCshell_DrawSetUnitsCM PROCshell_DrawSetUnitsIN PROCshell_DrawSetUnitsOS PROCshell_DrawSetUnitsPT PROCshell_DrawSetPathPattern PROCshell_DrawGetBoundingBox PROCshell_DrawRenderFile PROCshell_DrawSetJoinStyleNone PROCshell_DrawSetJoinStyleRound PROCshell_DrawSetJoinStyleBevelled PROCshell_DrawSetEndCapNone PROCshell_DrawSetEndCapRound PROCshell_DrawSetEndCapSquare PROCshell_DrawSetEndCapTriangle PROCshell_DrawSetStartCapNone PROCshell_DrawSetStartCapRound PROCshell_DrawSetStartCapSquare PROCshell_DrawSetStartCapTriangle PROCshell_DrawSetScale PROCshell_DrawGetScale PROCshell_DrawResizeWindow PROCshell_DrawScaleToWindow PROCshell_DrawSpriteArea Responses to events raised by other modules Private Methods Supported: FNshell_DrawFontName PROCshell_DrawPutString PROCshell_DrawPutCoords PROCshell_DrawPutWord PROCshell_DrawUpdateObjectBBox PROCshell_DrawUpdateBounds PROCshell_DrawUpdateGroupBounds PROCshell_DrawTextSpace ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Public routines.. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: T$*|Start PROCshell_DrawCreateFile shell_DrawCreateFile( buffer%) creator$,style_blk%,trans_matrix% EvntShell drawfiles in memory have a 60 byte 'pre-header' which keeps track of current settings. The 'pre-header' must not be saved to disk as the file will not be a valid drawfile! Z*buffer% = shell_HeapBlockFetch(60+24) [Ibuffer%!00 = -1 : Number of current outline font (-1 if none) \:buffer%!04 = 60 : Size of EvntShell pre-header ]Sbuffer%!08 = 0 : File offset to next free address (from start of file) ^O|(buffer%+12)=1814.1732: Current unit multiplier factor (real nr, 5 bytes) _1buffer%!20 = 7 : Current path colour `1buffer%!24 = -1 : Current fill colour aNbuffer%!28 = 0 : File offset to start of current group definition b0buffer%!32 = 0 : Current path width c-buffer%!36 = 0 : Current end cap dMbuffer%!40 = -1 : Number of outline fonts declared (-1 if none) eVbuffer%!44 = -1 : File offset to start of font table (-1 if no font table) fEbuffer%!48 = 0 : Pointer to path style description block g,buffer%!52 = shell_HeapBlockFetch(24) hG$(buffer% + (buffer%!04))= "Draw" : Required to tag as a drawfile i>buffer%!(buffer%!04 + 4) = 201 : Major version number j>buffer%!(buffer%!04 + 8) = 0 : Minor version number kW$(buffer% + (buffer%!04 + 12)) = shell_StringPadTrailing( shell_GetAppName," ",11) lLbuffer%!08 = buffer%!04 + 24 : 24 is length of DrawFile so far... Set extent words of DrawFile to be 0,0,1,1... shell_DrawPutWord(0,buffer%) shell_DrawPutWord(0,buffer%) shell_DrawPutWord(0,buffer%) shell_DrawPutWord(0,buffer%) r*buffer%!48 = shell_HeapBlockFetch(16) style_blk% = buffer%!48 style_blk%!00 = 0 style_blk%!04 = 0 style_blk%!08 = 0 style_blk%!12 = 0 x*buffer%!52 = shell_HeapBlockFetch(24) trans_matrix% = buffer%!52 z)trans_matrix%!00 = 1 << 16 : x scale {*trans_matrix%!04 = 0 : rotation |*trans_matrix%!08 = 0 : rotation })trans_matrix%!12 = 1 << 16 : y scale ~3trans_matrix%!16 = 0 : x position offset 3trans_matrix%!20 = 0 : y position offset "DRW_PATH_START% = buffer%!8 DRW_PATH_SCALE_FAC = 1 DRW_PATH_XMIN = 0 DRW_PATH_YMIN = 0 DRW_PATH_XMAX = 0 DRW_PATH_YMAX = 0 #*|Stop PROCshell_DrawCreateFile %*|Start PROCshell_DrawOutlineFont shell_DrawOutlineFont( buffer%, text$, ptsize, pthigh, xorigin ,yorigin ) start%,ptr%,lx%,by%,rx%,ty%,font%,scl_fac scl_fac = |(buffer%+12) font% = !buffer% text$ <> "" 3 buffer% = shell_HeapBlockExtend(buffer%,256) # ptr% = buffer% + buffer%!8 start% = ptr% / !ptr% = 1 : Text object D ptr% += 24 : Skip size, object bounds for now # lx% = (xorigin * scl_fac) # by% = (yorigin * scl_fac) PROCshell_Tracef0("DEBUG::font is "+STR$font%) PROCshell_Tracef0("DEBUG::font is "+FNshell_DrawFontName(buffer%,font%)) "Font_FindFont",, shell_DrawFontName(buffer%,font%),ptsize * 16, pthigh * 16 handle% "Font_SetFont",handle% "Font_StringBBox",,text$ ,r1%,r2%,r3%,r4% "Font_LoseFont",handle% PROCshell_Tracef0("DEBUG::r1% = "+STR$r1%) PROCshell_Tracef0("DEBUG::r2% = "+STR$r2%) PROCshell_Tracef0("DEBUG::r3% = "+STR$r3%) PROCshell_Tracef0("DEBUG::r4% = "+STR$r4%) & rx% = lx% + ((r3%/1000)*640) & ty% = by% + ((r4%/1000)*640) PROCshell_Tracef0("DEBUG::lx%="+STR$lx%) PROCshell_Tracef0("DEBUG::by%="+STR$by%) PROCshell_Tracef0("DEBUG::rx%="+STR$rx%) PROCshell_Tracef0("DEBUG::ty%="+STR$ty%) shell_DrawPutCoords(start% + 8,lx%,by%,rx%,ty%) ' !ptr% = buffer%!20 :ptr% += 4 ' !ptr% = buffer%!24 :ptr% += 4 ' !ptr% = font% :ptr% += 4 ' !ptr% = ptsize * 640 :ptr% += 4 ' !ptr% = pthigh * 640 :ptr% += 4 1 !ptr% = xorigin * |(buffer%+12):ptr% += 4 1 !ptr% = yorigin * |(buffer%+12):ptr% += 4 shell_DrawPutString(text$,ptr%) start%!4 = ptr% - start% shell_DrawUpdateBounds(buffer%,lx%,by%,rx%,ty%) > buffer% = shell_HeapBlockExtend(buffer%,start%!4 - 256) buffer%!8 += start%!4 $*|Stop PROCshell_DrawOutlineFont &*|Start PROCshell_DrawSetPathWidth shell_DrawSetPathWidth(buffer%,width) 1buffer%!32 = ((width * |(buffer%+12)) + 0.5) %*|Stop PROCshell_DrawSetPathWidth '*|Start PROCshell_DrawSetPathColour shell_DrawSetPathColour( buffer%, R%, G%, B% ) ( ( R% = -1 ) ( G% = -1 ) ( B% = -1 ) ) shell_DrawSetPathNoColour( buffer% ) buffer%?20 = 0 buffer%?21 = R% buffer%?22 = G% buffer%?23 = B% &*|Stop PROCshell_DrawSetPathColour )*|Start PROCshell_DrawSetPathNoColour shell_DrawSetPathNoColour( buffer% ) buffer%!20 = -1 (*|Stop PROCshell_DrawSetPathNoColour '*|Start PROCshell_DrawSetFillColour shell_DrawSetFillColour( buffer%, R%, G%, B% ) ( ( R% = -1 ) ( G% = -1 ) ( B% = -1 ) ) shell_DrawSetNoFillColour( buffer% ) buffer%?24 = 0 buffer%?25 = R% buffer%?26 = G% buffer%?27 = B% &*|Stop PROCshell_DrawSetFillColour )*|Start PROCshell_DrawSetNoFillColour shell_DrawSetNoFillColour( buffer% ) buffer%!24 = -1 (*|Stop PROCshell_DrawSetNoFillColour $*|Start PROCshell_DrawStartGroup shell_DrawStartGroup( buffer%,name$) next% buffer%!28 > 0 shell_DrawEndGroup( buffer% ) Kbuffer%!28 = buffer%!08: Store file offset to current group definition PROCshell_Tracef0("DEBUG::bb_offset = "+STR$~buffer%!28) shell_DrawPutWord(06,buffer%) : Object type 6 (group) shell_DrawPutWord(36,buffer%) : Current size of group object shell_DrawPutWord(-1,buffer%) : Bounding box xmin shell_DrawPutWord(-1,buffer%) : Bounding box ymin shell_DrawPutWord(1,buffer%) : Bounding box xmax shell_DrawPutWord(1,buffer%) : Bounding box ymax 0buffer% = shell_HeapBlockExtend(buffer%,12) "next% = buffer% + buffer%!08 $next% = name$ Abuffer%!08 += 12 : Update file offset to next free address.. #*|Stop PROCshell_DrawStartGroup "*|Start PROCshell_DrawEndGroup shell_DrawEndGroup( buffer% ) start% buffer%!28 > 0 % start% = buffer% + (buffer%!28) / start%!4 = (buffer% + buffer%!8) - start% buffer%!28 = 0 !*|Stop PROCshell_DrawEndGroup #%*|Start PROCshell_DrawDestroyFile shell_DrawDestroyFile( buffer% ) shell_HeapBlockExists(buffer%!48) shell_HeapBlockReturn(buffer%!48) shell_HeapBlockReturn( buffer% ) )$*|Stop PROCshell_DrawDestroyFile -"*|Start PROCshell_DrawSaveFile shell_DrawSaveFile(buffer%,file$) Add some error trapping here... X% = (file$) PROCshell_Tracef0("DEBUG::size is "+STR$(buffer%!8 - buffer%!4)) "OS_GBPB",2,X%,buffer% + (buffer%!4),buffer%!8 - buffer%!4 ("SetType "+file$+ " &AFF") 8!*|Stop PROCshell_DrawSaveFile < *|Start FNshell_DrawLoadFile shell_DrawLoadFile( name$ ) buff%, X%, size% shell_DrawCreateFile( buff% ) @,buff%!8 -= 40 : don't need the header.. A$size% = shell_FileLength(name$) B/buff% = shell_HeapBlockExtend(buff%,size%) X% = ( name$ ) "OS_GBPB", 4, X%, buff% + buff%!4, size% buff%!8 = size% + buff%!4 shell_DrawSetScale( buff%, 1, 1 ) = buff% *|Stop FNshell_DrawLoadFile N!*|Start PROCshell_DrawEllipse shell_DrawEllipse( buffer%,X,Y,Xm,Ym) start%,A,B,C,D,E,K,Xs,Ys start% = buffer%!8 X = X * |(buffer%+12) Y = Y * |(buffer%+12) Xm = Xm * |(buffer%+12) Ym = Ym * |(buffer%+12) PROCshell_Tracef0("DEBUG::X="+STR$X) PROCshell_Tracef0("DEBUG::Y="+STR$Y) PROCshell_Tracef0("DEBUG::Xm="+STR$Xm) PROCshell_Tracef0("DEBUG::Ym="+STR$Ym) Xm >= Ym A = Xm / Xm / 10 + 0.5 Xm / Ym < 2 A = 0.7 Xm / Ym > 4.5 A = 0.95 Xs = A * Xm _( Ys = (1 - Xs * Xs / Xm / Xm) * Ym Ym > Xm A = Ym / Xm / 10 + 0.5 Ym / Xm < 2 A = 0.7 Ym / Xm > 4.5 A = 0.95 Ys = A * Ym f( Xs = (1 - Ys * Ys / Ym / Ym) * Xm B = Ym + (Ym - Ys) / 3 i%K = Xs * Xs + (B - Ys) * (B - Ys) j.C = ( (4 * Xs * Xs + 12 * K) - 2 * Xs) / 6 D = Xm + (Xm - Xs) / 3 l%K = Ys * Ys + (D - Xs) * (D - Xs) m.E = ( (4 * Ys * Ys + 12 * K) - 2 * Ys) / 6 shell_DrawPutWord(2,buffer%) : Object type 2 (path) shell_DrawPutWord(0,buffer%) : Size of object (dummy value) shell_DrawPutWord(X - Xm,buffer%): Set size of bounding box xmin shell_DrawPutWord(Y - Ym,buffer%): Set size of bounding box ymin shell_DrawPutWord(X + Xm,buffer%): Set size of bounding box xmax shell_DrawPutWord(Y + Ym,buffer%): Set size of bounding box ymax shell_DrawUpdateBounds(buffer%,X - Xm,Y - Ym,X + Xm,Y + Ym) shell_DrawPutWord(buffer%!24,buffer%) : Fill colour shell_DrawPutWord(buffer%!20,buffer%) : Path colour shell_DrawPutWord(buffer%!32,buffer%) : Path width shell_DrawPutWord(00,buffer%) : Pattern shell_DrawPutWord(2,buffer%) : Absolute move shell_DrawPutWord(X + Xs,buffer%) : x start shell_DrawPutWord(Y - Ys,buffer%) : y start shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X + C,buffer%) shell_DrawPutWord(Y - B,buffer%) shell_DrawPutWord(X - C,buffer%) shell_DrawPutWord(Y - B,buffer%) shell_DrawPutWord(X - Xs,buffer%) shell_DrawPutWord(Y - Ys,buffer%) shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X - D,buffer%) shell_DrawPutWord(Y - E,buffer%) shell_DrawPutWord(X - D,buffer%) shell_DrawPutWord(Y + E,buffer%) shell_DrawPutWord(X - Xs,buffer%) shell_DrawPutWord(Y + Ys,buffer%) shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X - C,buffer%) shell_DrawPutWord(Y + B,buffer%) shell_DrawPutWord(X + C,buffer%) shell_DrawPutWord(Y + B,buffer%) shell_DrawPutWord(X + Xs,buffer%) shell_DrawPutWord(Y + Ys,buffer%) shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X + D,buffer%) shell_DrawPutWord(Y + E,buffer%) shell_DrawPutWord(X + D,buffer%) shell_DrawPutWord(Y - E,buffer%) shell_DrawPutWord(X + Xs,buffer%) shell_DrawPutWord(Y - Ys,buffer%) shell_DrawPutWord(0,buffer%) : End of path J!(buffer% + start% + 4) = buffer%!8 - start% : Store size of object *|Stop PROCshell_DrawEllipse *|Start PROCshell_DrawCircle shell_DrawCircle( buffer%,X,Y,R) start%,A,B,C,style_blk% style_blk% = buffer%!48 start% = buffer%!8 X = X * |(buffer%+12) Y = Y * |(buffer%+12) R = R * |(buffer%+12) A = R / B = A + R / 2.544 C = A - R / 2.544 shell_DrawPutWord(2,buffer%) : Object type 2 (path) shell_DrawPutWord(0,buffer%) : Size of object (dummy value) shell_DrawPutWord(X - R,buffer%) : Set size of bounding box xmin shell_DrawPutWord(Y - R,buffer%) : Set size of bounding box ymin shell_DrawPutWord(X + R,buffer%) : Set size of bounding box xmax shell_DrawPutWord(Y + R,buffer%) : Set size of bounding box ymax shell_DrawUpdateBounds(buffer%,X - R,Y - R,X + R,Y + R) shell_DrawPutWord(buffer%!24,buffer%) : Fill colour shell_DrawPutWord(buffer%!20,buffer%) : Path colour shell_DrawPutWord(buffer%!32,buffer%) : Path width shell_DrawPutWord(style_blk%!0,buffer%) : Style word (style_blk%?0 1 << 7) <> 0 shell_DrawPutWord(style_blk%!04,buffer%) : Offset to pattern start shell_DrawPutWord(style_blk%!08,buffer%) : Nr of elements in pattern shell_DrawPutWord(style_blk%!12,buffer%) : Length of dash element shell_DrawPutWord(2,buffer%) : Absolute move shell_DrawPutWord(X + A,buffer%) : x start shell_DrawPutWord(Y - A,buffer%) : y start shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X + C,buffer%) shell_DrawPutWord(Y - B,buffer%) shell_DrawPutWord(X - C,buffer%) shell_DrawPutWord(Y - B,buffer%) shell_DrawPutWord(X - A,buffer%) shell_DrawPutWord(Y - A,buffer%) shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X - B,buffer%) shell_DrawPutWord(Y - C,buffer%) shell_DrawPutWord(X - B,buffer%) shell_DrawPutWord(Y + C,buffer%) shell_DrawPutWord(X - A,buffer%) shell_DrawPutWord(Y + A,buffer%) shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X - C,buffer%) shell_DrawPutWord(Y + B,buffer%) shell_DrawPutWord(X + C,buffer%) shell_DrawPutWord(Y + B,buffer%) shell_DrawPutWord(X + A,buffer%) shell_DrawPutWord(Y + A,buffer%) shell_DrawPutWord(6,buffer%) shell_DrawPutWord(X + B,buffer%) shell_DrawPutWord(Y + C,buffer%) shell_DrawPutWord(X + B,buffer%) shell_DrawPutWord(Y - C,buffer%) shell_DrawPutWord(X + A,buffer%) shell_DrawPutWord(Y - A,buffer%) shell_DrawPutWord(0,buffer%) : End of path J!(buffer% + start% + 4) = buffer%!8 - start% : Store size of object *|Stop PROCshell_DrawCircle *|Start PROCshell_DrawBox shell_DrawBox( buffer%,x0,y0,width,height) start%,scl_fac, style_blk% start% = buffer%!8 style_blk% = buffer%!48 scl_fac = |(buffer%+12) x0 = x0 * scl_fac y0 = y0 * scl_fac width = width * scl_fac height = height * scl_fac shell_DrawPutWord(2,buffer%) : Object type 2 (path) shell_DrawPutWord(0,buffer%) : Size of object (dummy value) shell_DrawPutWord(x0,buffer%) : Set size of bounding box xmin shell_DrawPutWord(y0,buffer%) : Set size of bounding box ymin shell_DrawPutWord(x0 + width,buffer%) : Set size of bounding box xmax shell_DrawPutWord(y0 + height,buffer%) : Set size of bounding box ymax shell_DrawUpdateBounds(buffer%,x0,y0,x0 + width,y0 + height) shell_DrawPutWord(buffer%!24,buffer%) : Fill colour shell_DrawPutWord(buffer%!20,buffer%) : Path colour shell_DrawPutWord(buffer%!32,buffer%) : Path width shell_DrawPutWord(style_blk%!0,buffer%): Style shell_DrawPutWord(02,buffer%) : Absolute move shell_DrawPutWord(x0,buffer%) : x start shell_DrawPutWord(y0,buffer%) : y start shell_DrawPutWord(08,buffer%) : Draw to absolute position shell_DrawPutWord(x0,buffer%) shell_DrawPutWord(y0 + height,buffer%) shell_DrawPutWord(08,buffer%) shell_DrawPutWord(x0 + width,buffer%) shell_DrawPutWord(y0 + height,buffer%) shell_DrawPutWord(08,buffer%) shell_DrawPutWord(x0 + width,buffer%) shell_DrawPutWord(y0,buffer%) shell_DrawPutWord(08,buffer%) shell_DrawPutWord(x0,buffer%) shell_DrawPutWord(y0,buffer%) shell_DrawPutWord(00,buffer%) : End of path G!(buffer% + start% + 4) = buffer%!8 - start%: Store size of object *|Stop PROCshell_DrawBox :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Path Object :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: #*|Start PROCshell_DrawPathStart shell_DrawPathStart( buffer%, x_coord, y_coord ) style_blk% style_blk% = buffer%!48 Set up Module Globals.. !"DRW_PATH_START% = buffer%!8 "*DRW_PATH_SCALE_FAC = |( buffer% + 12 ) #*x_coord = x_coord * DRW_PATH_SCALE_FAC $*y_coord = y_coord * DRW_PATH_SCALE_FAC DRW_PATH_XMIN = x_coord DRW_PATH_YMIN = x_coord DRW_PATH_XMAX = y_coord DRW_PATH_YMAX = y_coord DRW_PATH_XMIN = x_coord DRW_PATH_YMIN = y_coord DRW_PATH_XMAX = -&7FFFFFFF DRW_PATH_YMAX = -&7FFFFFFF shell_DrawPutWord( 2,buffer% ) : Object type 2 (path) shell_DrawPutWord( 0,buffer% ) : Size of object (dummy value) shell_DrawPutWord( DRW_PATH_XMIN, buffer% ) : Set size of bounding box xmin shell_DrawPutWord( DRW_PATH_YMIN, buffer% ) : Set size of bounding box ymin shell_DrawPutWord( DRW_PATH_XMAX, buffer% ) : Set size of bounding box xmax shell_DrawPutWord( DRW_PATH_YMAX, buffer% ) : Set size of bounding box ymax shell_DrawPutWord( buffer%!24, buffer% ) : Fill colour shell_DrawPutWord( buffer%!20, buffer% ) : Path colour shell_DrawPutWord( buffer%!32, buffer% ) : Path width shell_DrawPutWord( style_blk%!0, buffer% ) : Style shell_DrawPutWord( 02,buffer% ) : Absolute move shell_DrawPutWord( x_coord, buffer% ) : x start shell_DrawPutWord( y_coord, buffer% ) : y start <"*|Stop PROCshell_DrawPathStart @$*|Start PROCshell_DrawPathDrawTo shell_DrawPathDrawTo( buffer%, x_coord, y_coord ) shell_DrawPutWord( 08, buffer% ) : Draw to absolute position C*x_coord = x_coord * DRW_PATH_SCALE_FAC D*y_coord = y_coord * DRW_PATH_SCALE_FAC shell_DrawPutWord( x_coord, buffer% ) shell_DrawPutWord( y_coord, buffer% ) shell_DrawUpdateObjectBBox( buffer%, x_coord, y_coord ) J#*|Stop PROCshell_DrawPathDrawTo N!*|Start PROCshell_DrawPathEnd shell_DrawPathEnd( buffer% ) shell_DrawPutWord( 00, buffer% ) Store size of object.. RD!( buffer% + DRW_PATH_START% + 4 ) = buffer%!8 - DRW_PATH_START% shell_DrawUpdateBounds( buffer%, DRW_PATH_XMIN, DRW_PATH_YMIN, DRW_PATH_XMAX, DRW_PATH_YMAX ) V *|Stop PROCshell_DrawPathEnd Z'*|Start PROCshell_DrawPathCloseLine shell_DrawPathCloseLine( buffer% ) shell_DrawPutWord( 05, buffer% ) shell_DrawPutWord( 00, buffer% ) Store size of object.. _D!( buffer% + DRW_PATH_START% + 4 ) = buffer%!8 - DRW_PATH_START% shell_DrawUpdateBounds( buffer%, DRW_PATH_XMIN, DRW_PATH_YMIN, DRW_PATH_XMAX, DRW_PATH_YMAX ) c&*|Stop PROCshell_DrawPathCloseLine *|Start PROCshell_DrawLine shell_DrawLine( buffer%,x0,y0,x1,y1) start%,pat_blk%,scl_fac,style_blk%,p_width%,cap_width%,cap_len% cap_width2%,cap_len2%,bbox_xmin,bbox_xmax,bbbox_ymin,bbox_ymax scl_fac = |(buffer%+12) start% = buffer%!8 nHx0 = x0 * scl_fac : Convert to draw units using stored scale factor y0 = y0 * scl_fac x1 = x1 * scl_fac y1 = y1 * scl_fac p_width% = buffer%!32 style_blk% = buffer%!48 x0 > x1 bbox_xmin = x1 bbox_xmax = x0 bbox_xmin = x0 bbox_xmax = x1 y0 > y1 bbox_ymin = y1 bbox_ymax = y0 bbox_ymin = y0 bbox_ymax = y1 PROCshell_Tracef0("DEBUG:: "+STR$(style_blk%?0 AND (1 << 2))) PROCshell_Tracef0("DEBUG:: "+STR$(style_blk%?0 AND (1 << 3))) (style_blk%?0 %1100) (style_blk%?0 %110000) <> 0 Triangular end caps on the path, check the widths.. (style_blk%?0 %1100) 9 cap_width% = style_blk%?2: 1/16ths of path width 9 cap_len% = style_blk%?3: 1/16ths of path width 3 cap_width% = (cap_width% * (p_width% / 16)) 3 cap_len% = (cap_len% * (p_width% / 16)) (style_blk%?0 %110000) : cap_width2% = style_blk%?4: 1/16ths of path width : cap_len2% = style_blk%?5: 1/16ths of path width 5 cap_width2% = (cap_width2% * (p_width% / 16)) 5 cap_len2% = (cap_len2% * (p_width% / 16)) cap_width2% > cap_width% cap_width% = cap_width2% cap_len2% > cap_len% cap_len% = cap_len2% PROCshell_Tracef0("DEBUG:: cap_width% = "+STR$cap_width%) PROCshell_Tracef0("DEBUG:: cap_len% = "+STR$cap_len%) shell_DrawPutWord(2,buffer%) : Object type 2 (path) shell_DrawPutWord(0,buffer%) : Size of object (dummy value) shell_DrawPutWord(bbox_xmin-cap_len%,buffer%) : Set size of bounding box xmin shell_DrawPutWord(bbox_ymin-(p_width%/2)-cap_width%,buffer%) : Set size of bounding box ymin shell_DrawPutWord(bbox_xmax+cap_len%,buffer%) : Set size of bounding box xmax shell_DrawPutWord(bbox_ymax+(p_width%/2)+cap_width%,buffer%) : Set size of bounding box ymax shell_DrawUpdateBounds(buffer%,x0,y0,x1,y1): Update DrawFile bounding box shell_DrawPutWord(buffer%!24,buffer%) : Fill colour (-1 = do not fill) shell_DrawPutWord(buffer%!20,buffer%) : Path colour (-1 = no outline) shell_DrawPutWord(buffer%!32,buffer%) : Path width shell_DrawPutWord(style_blk%!0,buffer%) : Style word (style_blk%?0 1 << 7) <> 0 shell_DrawPutWord(style_blk%!04,buffer%) : Offset to pattern start shell_DrawPutWord(style_blk%!08,buffer%) : Nr of elements in pattern shell_DrawPutWord(style_blk%!12,buffer%) : Length of dash element shell_DrawPutWord(02,buffer%) : Absolute move shell_DrawPutWord(x0,buffer%) : x start shell_DrawPutWord(y0,buffer%) : y start shell_DrawPutWord(08,buffer%) : Draw to absolute position shell_DrawPutWord(x1,buffer%) : x finish shell_DrawPutWord(y1,buffer%) : y finish shell_DrawPutWord(00,buffer%) : End of path J!(buffer% + start% + 4) = buffer%!8 - start% : Store size of object *|Stop PROCshell_DrawLine !*|Start PROCshell_DrawSetFont shell_DrawSetFont(buffer%,font$) ft_start%,ft_end%,f_handle%,ptr%,name$,found% found% = f_handle% = 0 font$ = "" - !buffer% = 0 : Font 0 is system font.. Search font table to find internal font handle of requested font ft_start% = buffer%!44 ft_start% = -1 99,"No fonts have been initialised for this drawfile" F ft_start% += buffer% : Now points to start of font table object PROCshell_Tracef0("DEBUG::font table size is = "+STR$(ft_start%!4)) * ft_end% = ft_start%!4 + ft_start% ptr% = ft_start% + 8 & ft_handle% = ?ptr% : ptr% += 1 & name$ = shell_GetString(ptr%) V PROCshell_Tracef0("DEBUG::font name found ("+STR$ft_handle%+") '"+name$+"'") ptr% += name$ + 1 ptr% 4 <> 0 ptr% +=1 name$ = font$ ) found% = : ptr% = ft_end% + 1 R PROCshell_Tracef0("DEBUG::font name match, handle is "+STR$ft_handle%) 0 PROCshell_Tracef0("DEBUG::NO MATCH") ptr% >= ft_end% found% !buffer% = ft_handle% PROCshell_Tracef0("DEBUG::Setting font handle to "+STR$(!buffer%)) 99,"Font '"+font$+"' has not been initialised" *|Stop PROCshell_DrawSetFont "*|Start PROCshell_DrawInitFont shell_DrawInitFont( buffer%,font_name$) ft_start%,ptr%,def_start% shell_Fonts_FontIsAvailable(font_name$,12,12) 6 buffer% = shell_HeapBlockExtend(buffer%,256) B ptr% = buffer% + buffer%!8 : Next address in file.. def_start% = ptr% buffer%!40 = -1 J This routine hasn't been called before, so create new font table T buffer%!44 = buffer%!8 : Store file offset to start of font table D !ptr% = 0:ptr% += 4 : Create font table object D !ptr% = 0:ptr% += 4 : Skip object size for now ? buffer%!40 = 0 : Nr of defined fonts J ft_start% = buffer% + buffer%!44 : Start of font table definition @ buffer%!40 += 1 : Increment font count T ?ptr% = buffer%!40 : Store internal font handle (starts at 1) F $(ptr%+1) = font_name$ : Store textual name of font ptr% += (font_name$) + 2 G ?(ptr% - 1) = 0 : Terminate name with CHR$(0) ptr% 4 <> 0 : Pad with trailing spaces to a word boundary ?ptr% = 0 ptr% += 1 L ft_start%!04 = ptr% - ft_start% : Update size of font table object C buffer%!08 += ptr% - def_start% : Update size of DrawFile Finally shrink heap block.. H buffer% = shell_HeapBlockExtend(buffer%,(ptr% - ft_start%) - 256) h void% = shell_MessageWindow( shell_MessageOneArg("SHELLMSG31",font_name$),0, shell_GetAppName,"") !*|Stop PROCshell_DrawInitFont $*|Start PROCshell_DrawSetUnitsMM shell_DrawSetUnitsMM( buffer% ) |(buffer% + 12) = 1814.1732 #*|Stop PROCshell_DrawSetUnitsMM $*|Start PROCshell_DrawSetUnitsCM shell_DrawSetUnitsCM( buffer% ) |(buffer% + 12) = 18141.732 #*|Stop PROCshell_DrawSetUnitsCM $*|Start PROCshell_DrawSetUnitsIN shell_DrawSetUnitsIN( buffer% ) |(buffer% + 12) = 46080 #*|Stop PROCshell_DrawSetUnitsIN #$*|Start PROCshell_DrawSetUnitsOS shell_DrawSetUnitsOS( buffer% ) |(buffer% + 12) = 256 (#*|Stop PROCshell_DrawSetUnitsOS ,$*|Start PROCshell_DrawSetUnitsPT shell_DrawSetUnitsPT( buffer% ) |(buffer% + 12) = 640 1#*|Stop PROCshell_DrawSetUnitsPT 5(*|Start PROCshell_DrawSetPathPattern shell_DrawSetPathPattern(buffer%,dashed%,offset,nr_el%,len) pat_blk%,scl_fac pat_blk% = buffer%!48 scl_fac = |(buffer% + 12) :$pat_blk%?0 = pat_blk%?0 1 << 7 dashed% = 0 <& pat_blk%?0 = pat_blk%?0 1 << 7 >"pat_blk%!04 = offset * scl_fac pat_blk%!08 = nr_el% @"pat_blk%!12 = len * scl_fac C'*|Stop PROCshell_DrawSetPathPattern G(*|Start PROCshell_DrawGetBoundingBox shell_DrawGetBoundingBox(buffer%, xpos, ypos, width, height,os_units%) drawfile_start%,drawfile_size%,bbox_blk%,trans_matrix%,div% J*drawfile_start% = buffer% + buffer%!4 K,drawfile_size% = buffer%!8 - buffer%!4 L!trans_matrix% = buffer%!52 trans_matrix%!20 = 0 trans_matrix%!24 = 0 O)bbox_blk% = shell_HeapBlockFetch(16) os_units% <> 0 div% = 256 div% = 1 "DrawFile_BBox",0,drawfile_start%,drawfile_size%,trans_matrix%,bbox_blk% R"xpos = (bbox_blk%!00) / div% S"ypos = (bbox_blk%!04) / div% T0width = (bbox_blk%!08 - bbox_blk%!00)/ div% U0height = (bbox_blk%!12 - bbox_blk%!04)/ div% shell_HeapBlockReturn(bbox_blk%) X'*|Stop PROCshell_DrawGetBoundingBox \#*|Start FNshell_DrawGetFileSize shell_DrawGetFileSize( buffer% ) = buffer%!8 - buffer%!4 `"*|Stop FNshell_DrawGetFileSize h$*|Start PROCshell_DrawRenderFile shell_DrawRenderFile(buffer%,x%,y%,q%,bound%) drawsc%,draw%,drawlen% bound%=-1 bound% = 1 bound% = 0 drawsc% = buffer%!52 m"draw% = buffer% + buffer%!4 n$drawlen% = buffer%!8 - buffer%!4 drawsc%!16 = x% * 256 drawsc%!20 = y% * 256 "DrawFile_Render",bound%,draw%,drawlen%,drawsc%,q% + 28 drawsc%!16 = 0 drawsc%!20 = 0 v#*|Stop PROCshell_DrawRenderFile *|Start PROCshell_DrawRenderFile DEF PROCshell_DrawRenderFile(buffer%,x%,y%,x_scl,y_scl,q%,bound%) LOCAL drawsc%,draw%,drawlen% IF bound%=-1 THEN bound% = 1 ELSE bound% = 0 drawsc% = FNshell_HeapBlockFetch(24) draw% = buffer% + buffer%!4 drawlen% = buffer%!8 - buffer%!4 !drawsc% = INT(65536 * x_scl) drawsc%!04 = 0 drawsc%!08 = 0 drawsc%!12 = INT(65536 * y_scl) drawsc%!16 = x% * 256 drawsc%!20 = y% * 256 SYS "DrawFile_Render",bound%,draw%,drawlen%,drawsc%,q% + 28 PROCshell_HeapBlockReturn(drawsc%) ENDPROC *|Stop PROCshell_DrawRenderFile !*|Start FNshell_DrawTextCoord shell_DrawTextCoord(v%,r%,scale%) = (v% * scale% + r% +scale% / 2) / scale% *|Stop FNshell_DrawTextCoord **|Start PROCshell_DrawSetJoinStyleNone shell_DrawSetJoinStyleNone( buffer% ) style_blk% style_blk% = buffer%!48 =style_blk%?0 = style_blk%?0 ( 1 << 0 ) : unset bit 0 =style_blk%?0 = style_blk%?0 ( 1 << 1 ) : unset bit 1 )*|Stop PROCshell_DrawSetJoinStyleNone +*|Start PROCshell_DrawSetJoinStyleRound shell_DrawSetJoinStyleRound( buffer% ) style_blk% style_blk% = buffer%!48 >style_blk%?0 = style_blk%?0 1 << 0 : set bit 0 =style_blk%?0 = style_blk%?0 ( 1 << 1 ) : unset bit 1 **|Stop PROCshell_DrawSetJoinStyleRound .*|Start PROCshell_DrawSetJoinStyleBevelled shell_DrawSetJoinStyleBevelled( buffer% ) style_blk% style_blk% = buffer%!48 =style_blk%?0 = style_blk%?0 ( 1 << 0 ) : unset bit 0 >style_blk%?0 = style_blk%?0 1 << 1 : set bit 1 -*|Stop PROCshell_DrawSetJoinStyleBevelled '*|Start PROCshell_DrawSetEndCapNone shell_DrawSetEndCapNone( buffer% ) style_blk% style_blk% = buffer%!48 6style_blk%?0 = style_blk%?0 1 << 2 : set bit 2 6style_blk%?0 = style_blk%?0 1 << 3 : set bit 3 7style_blk%?0 = style_blk%?0 1 << 2 : unset bit 2 7style_blk%?0 = style_blk%?0 1 << 3 : unset bit 3 &*|Stop PROCshell_DrawSetEndCapNone (*|Start PROCshell_DrawSetEndCapRound shell_DrawSetEndCapRound( buffer% ) style_blk% style_blk% = buffer%!48 6style_blk%?0 = style_blk%?0 1 << 2 : set bit 2 6style_blk%?0 = style_blk%?0 1 << 3 : set bit 3 7style_blk%?0 = style_blk%?0 1 << 3 : unset bit 3 '*|Stop PROCshell_DrawSetEndCapRound )*|Start PROCshell_DrawSetEndCapSquare shell_DrawSetEndCapSquare( buffer% ) style_blk% style_blk% = buffer%!48 6style_blk%?0 = style_blk%?0 1 << 2 : set bit 2 6style_blk%?0 = style_blk%?0 1 << 3 : set bit 3 7style_blk%?0 = style_blk%?0 1 << 2 : unset bit 2 (*|Stop PROCshell_DrawSetEndCapSquare +*|Start PROCshell_DrawSetEndCapTriangle shell_DrawSetEndCapTriangle(buffer%,width%,len%) style_blk%,path_width% !path_width% = buffer%!32 / 16 style_blk% = buffer%!48 %width% = width% * |(buffer% + 12) %len% = len% * |(buffer% + 12) 6style_blk%?0 = style_blk%?0 1 << 2 : set bit 2 6style_blk%?0 = style_blk%?0 1 << 3 : set bit 3 'style_blk%?2 = width% / path_width% 'style_blk%?3 = len% / path_width% PROCshell_Tracef0("DEBUG:: path width is "+STR$path_width%) **|Stop PROCshell_DrawSetEndCapTriangle )*|Start PROCshell_DrawSetStartCapNone shell_DrawSetStartCapNone( buffer% ) style_blk% style_blk% = buffer%!48 6style_blk%?0 = style_blk%?0 1 << 4 : set bit 4 6style_blk%?0 = style_blk%?0 1 << 5 : set bit 5 7style_blk%?0 = style_blk%?0 1 << 4 : unset bit 4 7style_blk%?0 = style_blk%?0 1 << 5 : unset bit 5 (*|Stop PROCshell_DrawSetStartCapNone **|Start PROCshell_DrawSetStartCapRound shell_DrawSetStartCapRound( buffer% ) style_blk% style_blk% = buffer%!48 6style_blk%?0 = style_blk%?0 1 << 4 : set bit 4 6style_blk%?0 = style_blk%?0 1 << 5 : set bit 5 7style_blk%?0 = style_blk%?0 1 << 5 : unset bit 5 )*|Stop PROCshell_DrawSetStartCapRound +*|Start PROCshell_DrawSetStartCapSquare shell_DrawSetStartCapSquare( buffer% ) style_blk% style_blk% = buffer%!48 6style_blk%?0 = style_blk%?0 1 << 4 : set bit 4 6style_blk%?0 = style_blk%?0 1 << 5 : set bit 5 7style_blk%?0 = style_blk%?0 1 << 4 : unset bit 4 **|Stop PROCshell_DrawSetStartCapSquare -*|Start PROCshell_DrawSetStartCapTriangle shell_DrawSetStartCapTriangle(buffer%,width%,len%) style_blk%,path_width% style_blk% = buffer%!48 $!path_width% = buffer%!32 / 16 %%width% = width% * |(buffer% + 12) &%len% = len% * |(buffer% + 12) '6style_blk%?0 = style_blk%?0 1 << 4 : set bit 4 (6style_blk%?0 = style_blk%?0 1 << 5 : set bit 5 )'style_blk%?2 = width% / path_width% *'style_blk%?3 = len% / path_width% PROCshell_Tracef0("DEBUG:: path width is "+STR$path_width%) .,*|Stop PROCshell_DrawSetStartCapTriangle 2"*|Start PROCshell_DrawSetScale shell_DrawSetScale(buffer%,xscl,yscl) matrix% matrix% = buffer%!52 6 matrix%!00 = (65536 * xscl) 7 matrix%!12 = (65536 * yscl) :!*|Stop PROCshell_DrawSetScale >"*|Start PROCshell_DrawGetScale shell_DrawGetScale(buffer%, xscl, yscl) matrix% matrix% = buffer%!52 B xscl = matrix%!00 / 65536 C yscl = matrix%!12 / 65536 F!*|Stop PROCshell_DrawGetScale J&*|Start PROCshell_DrawResizeWindow shell_DrawResizeWindow(buffer%,wh%,lm%,bm%,rm%,tm%) xpos,ypos,width,height shell_DrawGetBoundingBox(buffer%,xpos,ypos,width,height, shell_WindowResize(wh%,0,- (tm% + bm% + height + ypos),width + lm% + rm%,0,0) Q%*|Stop PROCshell_DrawResizeWindow U'*|Start PROCshell_DrawScaleToWindow shell_DrawScaleToWindow(buffer%,wh%,lm%,bm%,rm%,tm%, xscl, yscl) xpos,ypos,width,height,w_blk%,w_width%,w_height%,o_xscl,o_yscl shell_DrawSetScale(buffer%,o_xscl,o_yscl) shell_DrawSetScale(buffer%,1,1) shell_DrawGetBoundingBox(buffer%,xpos,ypos,width,height, ['w_blk% = shell_HeapBlockFetch(36) !w_blk% = wh% "Wimp_GetWindowState",,w_blk% ^Aw_width% = (w_blk%!12 - w_blk%!04 + w_blk%!20) - (lm% + rm%) _Aw_height% = (w_blk%!16 - w_blk%!08 + w_blk%!24) - (tm% + bm%) `*xscl = (w_width% / (width - 0)) a*yscl = (w_height% / (height - 0)) PROCshell_Tracef0(">>> "+STR$w_width%) PROCshell_Tracef0(">>> "+STR$width) PROCshell_Tracef0(">>> "+STR$w_height%) PROCshell_Tracef0(">>> "+STR$height) PROCshell_Tracef0(">>> xscl "+STR$xscl) PROCshell_Tracef0(">>> yscl "+STR$yscl) shell_HeapBlockReturn(w_blk%) shell_DrawSetScale(buffer%,o_xscl,o_yscl) l&*|Stop PROCshell_DrawScaleToWindow p$*|Start PROCshell_DrawSpriteArea shell_DrawSpriteArea( buffer%, area_size%, sprite_area% ) first extend the drawfile buffer to hold the sprite.. tYbuffer% = shell_HeapBlockExtend( buffer%, area_size% + shell_SpritesGetHeaderSize ) set up a sprite area within this block.. w/sprite_area% = buffer% + ( buffer%!4 ) + 48 shell_SpriteAreaInit( sprite_area%, area_size% + shell_SpritesGetHeaderSize ) z$buffer%!8 += ( area_size% + 24 ) ~#*|Stop PROCshell_DrawSpriteArea ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Responses to events raised by other modules.. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Private module routines ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: #*|Start PROCshell_DrawPutString shell_DrawPutString(S$, ptr%) $ptr% = S$ ptr% += ?ptr% = 0 ptr% += 1 ptr% 4 = 0 "*|Stop PROCshell_DrawPutString #*|Start PROCshell_DrawPutCoords shell_DrawPutCoords(start%,lx%,by%,rx%,ty%) start%!00 = lx% start%!04 = by% start%!08 = rx% start%!12 = ty% "*|Stop PROCshell_DrawPutCoords !*|Start PROCshell_DrawPutWord shell_DrawPutWord(k%, buffer%) next% /buffer% = shell_HeapBlockExtend(buffer%,4) next% = buffer% + buffer%!08 !next% = k% buffer%!08 += 4 *|Stop PROCshell_DrawPutWord **|Start PROCshell_DrawUpdateObjectBBox shell_DrawUpdateObjectBBox( buffer%, x_coord, y_coord ) x_coord < DRW_PATH_XMIN DRW_PATH_XMIN = x_coord x_coord > DRW_PATH_XMAX DRW_PATH_XMAX = x_coord y_coord < DRW_PATH_YMIN DRW_PATH_YMIN = y_coord y_coord > DRW_PATH_YMAX DRW_PATH_YMAX = y_coord 7!( buffer% + DRW_PATH_START% + 08 ) = DRW_PATH_XMIN 7!( buffer% + DRW_PATH_START% + 12 ) = DRW_PATH_YMIN 7!( buffer% + DRW_PATH_START% + 16 ) = DRW_PATH_XMAX 7!( buffer% + DRW_PATH_START% + 20 ) = DRW_PATH_YMAX )*|Stop PROCshell_DrawUpdateObjectBBox &*|Start PROCshell_DrawUpdateBounds shell_DrawUpdateBounds(buffer%,x0,y0,x1,y1) bb_start% #bb_start% = buffer% + buffer%!4 x0 > x1 x0,x1 y0 > y1 y0,y1 (bb_start% + 32) = 0 !(bb_start% + 36) = 0 !(bb_start% + 24) = x0 !(bb_start% + 28) = y0 !(bb_start% + 32) = x1 !(bb_start% + 36) = y1 x0 < !(bb_start% + 24) !(bb_start% + 24) = x0 y0 < !(bb_start% + 28) !(bb_start% + 28) = y0 x1 > !(bb_start% + 32) !(bb_start% + 32) = x1 y1 > !(bb_start% + 36) !(bb_start% + 36) = y1 buffer%!28 > 0 shell_DrawUpdateGroupBounds(buffer%,x0,y0,x1,y1) %*|Stop PROCshell_DrawUpdateBounds +*|Start PROCshell_DrawUpdateGroupBounds shell_DrawUpdateGroupBounds(buffer%,x0,y0,x1,y1) bb_start% $bb_start% = buffer% + buffer%!28 PROCshell_Tracef0("DEBUG::bb_offset = "+STR$~buffer%!28) PROCshell_Tracef0("DEBUG::current x0 = "+STR$(!(bb_start% + 08))) !(bb_start% + 08) = -1 !(bb_start% + 08) = x0 x0 < !(bb_start% + 08) !(bb_start% + 08) = x0 !(bb_start% + 12) = -1 !(bb_start% + 12) = y0 y0 < !(bb_start% + 12) !(bb_start% + 12) = y0 x1 > !(bb_start% + 16) !(bb_start% + 16) = x1 y1 > !(bb_start% + 20) !(bb_start% + 20) = y1 PROCshell_Tracef0("DEBUG::x0 = "+STR$x0) PROCshell_Tracef0("DEBUG::y0 = "+STR$y0) PROCshell_Tracef0("DEBUG::x1 = "+STR$x1) PROCshell_Tracef0("DEBUG::y1 = "+STR$y1) PROCshell_Tracef0("") PROCshell_Tracef0("DEBUG::x0 = "+STR$(!(bb_start%+8))) **|Stop PROCshell_DrawUpdateGroupBounds *|Start FNshell_DrawFontName shell_DrawFontName(ptr%,font%) ft_table%,ft_end%,df_start%,font$,p%,ft_handle%,found% ptr%!44 = -1 99,"No fonts have been initialised for this drawfile" df_start% = ptr% + ptr%!4 ft_table% = ptr%!44 + ptr% PROCshell_Tracef0("DEBUG::ft_table% = &"+STR$~ft_table%) PROCshell_Tracef0("DEBUG::df_start% = &"+STR$~df_start%) font% = 0 font$ = "System Font" PROCshell_Tracef0("DEBUG::font table size is = "+STR$(ft_table%!4)) * ft_end% = ft_table%!4 + ft_table% p% = ft_table% + 8 " ft_handle% = ?p% : p% += 1 $ font$ = shell_GetString(p%) p% += font$ + 1 4 <> 0 p% +=1 ft_handle% = font% ' found% = : p% = ft_end% + 1 p% >= ft_end% found% = 0 99,"Font not found in font table" = font$ *|Stop FNshell_DrawFontName ##*|Start PROCshell_DrawTextSpace shell_DrawTextSpace(ptr%,text$,font%,ptsize,pthigh, lx%, by%, rx%, ty%) handle%,xscale%,yscale%,r1%,r2%,r3%,r4% font% > 0 "Font_FindFont",, shell_DrawFontName(ptr%,font%),ptsize * 16, pthigh * 16 handle% "Font_SetFont",handle% "Font_StringBBox",,text$ ,r1%,r2%,r3%,r4% "Font_ReadScaleFactor" ,xscale%,yscale% "Font_LoseFont",handle% ,1 ty% = shell_DrawTextCoord(by%,r4%,yscale%) -1 rx% = shell_DrawTextCoord(lx%,r3%,xscale%) .1 by% = shell_DrawTextCoord(by%,r2%,yscale%) /1 lx% = shell_DrawTextCoord(lx%,r1%,xscale%) 1) rx% = lx% + ptsize * 2.5 * (text$) ty% = by% + pthigh * 2.5 6"*|Stop PROCshell_DrawTextSpace