










|
Drawing
 Drawing in a desktop window can be performed efficiently in BASIC when the Drawfile module is used
You can download the application from here.
- Create a drawing application as before except place the work-area origin at the lower left-hand corner of the window
- Add the initial event-handler
DEF PROCDealWith_InitialEvent
PROCLoadFile("<Obey$Dir>.DrawFile")
ENDPROC
DEF PROCLoadFile(file$)
SYS "OS_File",20,file$ TO ,,,,length%
DIM drawfile length%
SYS "OS_File",12,file$,drawfile
ENDPROC
|
The procedure LoadFile loads a file named “DrawFile” - stored in the top level of the application's directory - into memory
- Add the Redraw event handler
DEF PROCDealWith_WindowRedraw(window,xo%,yo%)
PROCUtils_RedrawDrawfile(drawfile,length%,xo%,yo%)
ENDPROC
|
The procedure Utils_RedrawDrawfile is an AppBasic utility which draws the current sub-rectangle required by the DealWith_WindowRedraw handler. This utility takes care of scaling etc. and calls the SWI DrawFile_Render for you. It is very efficient, allowing BASIC programs to display complex drawings on the desktop without too great a time penalty.
|