Iyonix Select Acorn RISCOS 4 Home About Toolbox Examples Maillist Downloads
AppBasic

Toolbar


bar/gif
General
Hello world 1
Hello world 2
Min app
Bin
Window
Slot machine
Drawing
Colour menu
Drawing
Clock

Drawing

drawing2/gif
Drawing in a desktop window can be performed efficiently in BASIC when the Drawfile module is used

You can download the application from here.
  1. Create a drawing application as before except place the work-area origin at the lower left-hand corner of the window
  2. 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
  3. 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.