home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / dubmodule / DUBmodule / DUBmodSWIs < prev   
Text File  |  1996-03-24  |  75KB  |  1,846 lines

  1.  
  2. DUBmodSWIs:
  3.   SWI calls for DrawUtilsB module V1.00 (1 Mar 96)
  4.   -------------------------------------------------
  5.  
  6. Introduction
  7. ============
  8.  
  9. This module provides a number of SWI calls concerned with the creation and -
  10. to a lesser extent - editing of drawfiles. The module can handle all of the
  11. standard object types used by !Draw (up to V0.99 - RISC OS 3.5) but does not
  12. currently support unknown object types.
  13.  
  14. The SWI calls are:
  15.    Name                  Number      Name                     Number
  16.    -------------------   ------      ----------------------   ------
  17.  
  18.    DF_LastErrorB         &4CCC0      DF_StartTextArea         &4CCCD
  19.    DF_InitialiseFile     &4CCC1      DF_DefineTextArea        &4CCCE
  20.    DF_SelectFont         &4CCC2      DF_WriteTextArea         &4CCCF
  21.    DF_WriteText          &4CCC3      DF_EndTextArea           &4CCD0
  22.    DF_PathStart          &4CCC4      DF_StartTaggedObject     &4CCD1
  23.    DF_PathMove           &4CCC5      DF_EndTaggedObject       &4CCD2
  24.    DF_PathDraw           &4CCC6      DF_StartGroup            &4CCD3
  25.    DF_PathCurve          &4CCC7      DF_EndGroup              &4CCD4
  26.    DF_PathClose          &4CCC8      DF_CompleteFile          &4CCD5
  27.    DF_PathTextOutline    &4CCC9      DF_AbortObject           &4CCD6
  28.    DF_PathEnd            &4CCCA      DF_BufferReSized         &4CCD7
  29.    DF_PreLoadSprite      &4CCCB      DF_SetUnits              &4CCD8
  30.    DF_SpriteLoaded       &4CCCC      DF_SetOrigin             &4CCD9
  31.                                      DF_TransformObject       &4CCDA
  32.                                      DF_ShiftObject           &4CCDB
  33.                                      DF_PrevObjBBox           &4CCDC
  34.  
  35.  
  36. The module should only be used with RISC OS version 3.1 or later.
  37.  
  38.  
  39. Overview
  40. ========
  41.  
  42. Control block & free position offset
  43. ------------------------------------
  44. To allow the module to function in a multitasking environment, it needs to
  45. store information about the emerging drawfile in memory rather than within
  46. its own workspace. This 'scratchpad' area is termed the control block, and
  47. occupies the first 1024 bytes of the buffer allocated for the drawfile. Most
  48. of the swi calls require a pointer to the buffer, which is therefore a
  49. pointer to the control block, with the drawfile proper located immediately
  50. after it. The control block is largely invisible to the calling application,
  51. but you must remember not to include it when saving the drawfile.
  52.  
  53. In most cases the module does not record the address of the next free
  54. location in the drawfile (i.e. where the next entry will be made) but
  55. instead receives and returns a value in R2 which is termed the 'free
  56. position offset'. This is the distance in bytes from the start of the buffer
  57. to the next free location, and is therefore equal to the current drawfile
  58. size plus 1024 bytes for the control block. Thus there is only one actual
  59. pointer (to the buffer itself), which simplifies relocation of the buffer in
  60. memory.
  61.  
  62. For example, to create and save a simple drawfile containing a line from
  63. (x1%,y1%) to (x2%,y2%) in Basic with coordinates in draw units, you could
  64. use:
  65.  
  66. DIM buff% 2048
  67. buff_size% = 2048
  68. source_id$ = "MyProg" : REM name of application producing the drawfile
  69. page_size% = &501     : REM code for A4 landscape paper
  70. fpo% = 0              : REM free position offset variable
  71.  
  72. SYS "DF_InitialiseFile,,buff%,,buff_size%,source_id$,page_size%,0,0 TO,,fpo%
  73. SYS "DF_PathStart",,buff%,fpo%,<parameters for style etc> TO,,fpo%
  74. SYS "DF_PathMove",,buff%,fpo%,,x1%,y1% TO,,fpo%
  75. SYS "DF_PathDraw",,buff%,fpo%,,x2%,y2% TO,,fpo%
  76. SYS "DF_PathEnd",,buff%,fpo% TO,,fpo%
  77. SYS "DF_CompleteFile,,buff%,fpo% TO,,fpo%
  78.  
  79. SYS "OS_File",10,<Full pathname for drawfile>,&AFF,,(buff%+1024),(buff%+fpo%)
  80.  
  81. Each swi call requires a pointer to the buffer in R1. DF_InitialiseFile sets
  82. up the control block (1024 bytes), writes the drawfile header (40 bytes) and
  83. options object (88 bytes) specifying A4 landscape paper and returns in R2
  84. the free position offset as fpo% which is therefore 1024+40+88 bytes. This
  85. value is supplied to DF_PathStart which writes the path object header and
  86. returns an incremented value for fpo%, which is supplied in turn to
  87. DF_PathMove and so on.
  88.  
  89.  
  90. The calls DF_PathMove/Draw/Curve/Close are included mainly for consistency
  91. and it is usually more efficient to write the necessary values directly into
  92. the drawfile and increment the fpo% value manually. For example
  93.  
  94. SYS "DF_PathStart",,buff%,fpo%,<parameters for style etc> TO,,fpo%
  95. buff%!fpo%      = 2 : buff%!(fpo%+ 4) = x1% : buff%!(fpo%+ 8) = y1%
  96. buff%!(fpo%+12) = 8 : buff%!(fpo%+16) = x2% : buff%!(fpo%+20) = y2%
  97. fpo% += 24
  98. SYS "DF_PathEnd",,buff%,fpo% TO,,fpo%
  99.  
  100. or you could use an actual pointer (p%) as follows
  101.  
  102. SYS "DF_PathStart",,buff%,fpo%,<parameters for style etc> TO,,fpo%
  103. p% = buff% + fpo%
  104. !p%   = 2 : p%!4  = x1% : p%!8  = y1%
  105. p%!12 = 8 : p%!16 = x2% : p%!20 = y2%
  106. fpo% = p%+24-buff% : REM or just fpo% += 24
  107. SYS "DF_PathEnd",,buff%,fpo% TO,,fpo%
  108.  
  109. The same method can be used to insert parts of other object types, although
  110. it is probably only useful for path objects.
  111.  
  112.  
  113. An incomplete drawfile can be saved for later completion simply by saving it
  114. with its control block. When these are restored the source application can
  115. continue where it left off. A complete drawfile can be loaded for extension
  116. by allocating a buffer of suitable size, calling DF_InitialiseFile to set up
  117. the control block, loading the drawfile (at address = buffer + 1024 bytes)
  118. and finally setting the free position offset value equal to the drawfile
  119. size + 1024 bytes.
  120.  
  121.  
  122. Coordinate units & transformation matrices
  123. ------------------------------------------
  124. Since the module is accessed by swi calls, all numeric parameters supplied
  125. and results returned are signed 32 bit integers (as used in Basic, C etc).
  126. Thus coordinates must be given as integer values. However, the module can
  127. convert from other (integer) coordinates to draw units according to a units
  128. code passed in R7 to DF_InitialiseFile (this can be changed later using
  129. DF_SetUnits). Currently the module recognizes the following:
  130.  
  131.     Code   Units
  132.     ----   -----------------
  133.      0     draw units
  134.      1     draw units
  135.      2     OS units
  136.      3     millipoints
  137.      4     millimeters
  138.      5     1/10ths millimeter
  139.      6     1/1000ths millimeter
  140.  
  141. An unrecognized units code defaults to draw units.
  142.  
  143. The selected units are used for all coordinates except those for
  144. DF_TransformObject, DF_ShiftObject and translation entries in transformation
  145. matrices.
  146.  
  147. Since 1 draw unit = 1/640th of a point (1 point = 1/72nd of an inch), then 1
  148. millimeter = 1814.173 draw units. OS units are used for the screen display
  149. (e.g. a mode 12 screen measures 1280 x 1024 OS units, and notionally 1 OS
  150. unit = 400 millipoints = 256 draw units.
  151.  
  152.  
  153. Several swi calls require (or can accept) a transformation matrix to specify
  154. scaling and/or rotation and/or translation; this is a 24 byte block with
  155. (usually) the format:
  156.  
  157.     block%!0  = 65536 * xscale *  COS(angle)
  158.     block%!4  = 65536 * xscale *  SIN(angle)
  159.     block%!8  = 65536 * yscale * -SIN(angle)
  160.     block%!12 = 65536 * yscale *  COS(angle)
  161.     block%!16 = x.translation
  162.     block%!20 = y.translation
  163.  
  164. Other formats can be used to distort objects in various ways. In effect,
  165. horizontal and vertical scaling is applied first (xscale, yscale), then
  166. rotation (angle) and finally translation (horizontal and/or vertical shift).
  167. The translation entries are always treated as being in draw units.
  168.  
  169.  
  170. Parameters passed by pointer
  171. ----------------------------
  172. Various calls accept a pointer to a block of memory containing data (e.g. a
  173. list of fonts, font name, text string or transformation matrix). The block
  174. must be in the user area (address > &8000).
  175.  
  176.  
  177. Font names and text strings
  178. ---------------------------
  179. Font names and text strings can be terminated by char 0, 10 or 13 (with the
  180. possible exception of DF_WriteTextArea).
  181.  
  182.  
  183. Complete and incomplete objects
  184. -------------------------------
  185. Group, tagged, path, sprite and text area objects are created by two or more
  186. calls to the module. The initial call writes the object header with size = 0
  187. and an inverted bounding box (xmin = ymin = large positive value, xmax =
  188. ymax = large negative value). Until the appropriate end-object call is
  189. issued such objects are obviously incomplete. When the end-object call is
  190. issued, the object is verified (to some extent) and if no error is found the
  191. proper size and bounding box values are are written to the header (and the
  192. object is complete).
  193.  
  194. Once a path object is initiated (DF_PathStart), the module will only accept
  195. path-related calls (DF_PathMove/Draw/Curve/Close/TextOutline) until
  196. DF_PathEnd is called.
  197.  
  198. Initiating a sprite object (DF_PreLoadSprite) can only be followed by
  199. DF_SpriteLoaded.
  200.  
  201. Once a text area is initiated, the module will only accept text area-related
  202. calls (with some restrictions on their order) until DF_EndTextArea is
  203. called.
  204.  
  205. These restrictions do not apply to certain non-object specific calls
  206. (DF_BufferResized, DF_SetUnits, DF_SetOrigin) which can be issued at any
  207. time.
  208.  
  209. An incomplete path, sprite or text area object can be abandoned by calling
  210. DF_AbortObject. This restores the control block and free position offset to
  211. their state immediately before the object was started. There is no facility
  212. to abort a group object or tagged object.
  213.  
  214.  
  215. Error reporting
  216. ---------------
  217. Wherever possible, the module checks for an error condition before altering
  218. the drawfile, so that in the event of an error (e.g. insufficient buffer
  219. space or incorrect parameters for an swi call) the drawfile is left
  220. unaltered and the call can be repeated after appropriate corrective action.
  221. This is not always possible (e.g. for path objects created by direct entry
  222. as described above or for sprite objects loaded from disc), and
  223. alternatively or additionally the module will verify an object on its
  224. completion (e.g. DF_PathEnd, DF_SpriteLoaded). If an error is returned in
  225. these circumstances corrective action may be possible but it would probably
  226. be easier to abandon the object (with DF_AbortObject) and redo it.
  227.  
  228. The method of error reporting is similar (not identical) to that used by the
  229. DrawUtilsA module and depends on bit 0 of the control flags parameter passed
  230. in R0 for all swi calls except DF_LastErrorB (which ignores R0).
  231.  
  232. If the bit is clear, any error results in a non-zero error code being
  233. returned in R0 (R0 = 0 means no error) with the other registers unchanged.
  234. The calling application should therefore check R0 after each call to the
  235. module. 
  236.  
  237. If the bit is set, the module may return a (non-zero) pointer to an os error
  238. block resulting in an error which (e.g.) can be trapped in Basic with an ON
  239. ERROR statement (you can also use the 'X' form of the swi). There is only
  240. one error number (same as the module base chunk value, &4CCC0) and the error
  241. text is 
  242.      DrawUtils(B) module error: &code, tag, position, offset
  243.  
  244. Here, code is the error code in hexadecimal (as indicated by the ampersand),
  245. tag is the tag type of the object containing the error, position is the
  246. location of the object in bytes from the start of the drawfile and offset is
  247. the location of the error-causing sequence in bytes from the start of the
  248. object.
  249.  
  250. With either method, a call to DF_LastErrorB immediately after the error is
  251. returned (before any other calls which would overwrite the module's internal
  252. status block) will give the code, tag, position and offset values in R0 -
  253. R3.
  254.  
  255. Most errors are detected by examination of the entry parameters etc before
  256. altering the drawfile, and therefore the error is not actually in the
  257. drawfile. Thus in most cases tag = position = offset = 0 (if tag is zero
  258. then so are the others). An offset value is only returned for path object
  259. errors. The swi calls which can return non-zero tag, position and offset
  260. values are DF_EndPath (checks path object structure), DF_SpriteLoaded
  261. (checks sprite object structure), DF_TransformObject & DF_ShiftObject
  262. (checks path object structure if applied to a path object and scans through
  263. the drawfile to check group & tagged object bounding boxes) and
  264. DF_CompleteFile (also scans through the drawfile to check group & tagged
  265. object bounding boxes).
  266.  
  267.  
  268.  
  269. SWI calls
  270. =========
  271.  
  272. For all SWI calls-
  273.     Interupts are enabled
  274.     Fast interupts are enabled
  275.     Processor is in SVC mode
  276.     SWI is not re-entrant
  277.  
  278.  
  279.  
  280. DF_LastErrorB  (SWI &4CCC0)
  281. ===========================
  282.  
  283. Purpose: return contents of module error status block.
  284.  
  285. On entry:   registers unused
  286.  
  287. On exit:    R0    = error code
  288.             R1    = tag of type of object containing error
  289.             R2    = position of object
  290.             R3    = offset to error sequence
  291.  
  292. This call returns details of the last error to occur for any of the other
  293. module SWI calls; see the explanation of error reporting above for details.
  294. If there was no error then R0 = 0 and the other registers are undefined.
  295.  
  296.  
  297.  
  298. DF_InitialiseFile  (SWI &4CCC1)
  299. ===============================
  300.  
  301. Purpose: initialise the control block and write the drawfile header
  302. (optionally with an options object and/or font table object).
  303.  
  304. On entry:   R0    = control flags
  305.             R1    = pointer to buffer for control block and
  306.                     drawfile (must be in user area, address > &8000 and
  307.                     word-aligned)
  308.             R2    = unused
  309.             R3    = size of buffer (minimum 2048 bytes)
  310.             R4    = pointer to source identification string
  311.             R5    = page size code
  312.             R6    = pointer to font list for font table object
  313.             R7    = units code
  314.  
  315.    control flags: bit   meaning when set
  316.                   ----  ----------------
  317.                    0    determines method of error reporting
  318.                   1-31  reserved (should be zero)
  319.  
  320. On exit:    R0    = error code or zero
  321.             R1    = preserved
  322.             R2    = free position offset
  323.             R3    = buffer size (may be altered to a multiple of 4)
  324.             R4    = preserved
  325.             R5    = page size code (may be altered to a recognized value)
  326.             R6    = number of fonts written to font table object
  327.             R7    = units code (may be altered to a recognized value)
  328.  
  329. See 'Overview' above for an explanation of error reporting, the control
  330. block and the free position offset value passed and returned in R2.
  331.  
  332.  
  333. Buffer size
  334. -----------
  335. The minimum size for the buffer is 2048 bytes, and the module uses the first
  336. 1024 bytes as the control block. The module needs to know the size of the
  337. buffer so it can check the amount of free space before writing to the
  338. drawfile.
  339.  
  340.  
  341. Souce identification string
  342. ---------------------------
  343. The source identification string (R4) is a text string (maximum 12
  344. characters, terminated by ascii 0, 10 or 13) which usually identifies the
  345. application which created the drawfile. A maximum of 12 characters will be
  346. copied into the drawfile header or the string will be padded with spaces to
  347. a length of 12 characters.
  348.  
  349.  
  350. Page size code & options object creation
  351. ----------------------------------------
  352. If the page size code (R5) is non-zero, an options object is added with the
  353. appropriate page size code entry and the default options for !Draw (e.g.
  354. rectangular cm 1 x 2 grid, etc). The page size code is the paper 'A' size
  355. plus 1 multiplied by 256 plus 1 for landscape orientation (e.g. A4 portrait
  356. = &500, A4 landscape = &501, A5 landscape = &601). An unrecognized code
  357. defaults to A0 paper. The page size code can be changed later with
  358. DF_CompleteFile. If the page size code is zero then an options object is not
  359. inserted (and there is no facility to add one later).
  360.  
  361.  
  362. Font table creation
  363. -------------------
  364. If R6 is non-zero it is used as a pointer to a block containing a list of
  365. fonts for inclusion in the font table object. The format of the list is
  366.  
  367.   block +  0          1st font name 
  368.         + 40          2nd font name
  369.         + ((n-1)*40)  nth font name
  370.         + (n*40)      null string terminator
  371.  
  372. Font names can be terminated by ascii 0, 10 or 13. Each font must exist. The
  373. fonts are written into the font table with numbering starting at 1. If a
  374. font in the list is already included in the font table object then it is
  375. ignored (i.e. there will not be duplication in the font table object because
  376. !Draw doesn't like this). Thus the fonts may not be numbered according to
  377. their location in the list. The actual number of fonts written into the font
  378. table object is returned in R6.
  379.  
  380. Note that even if text objects will subsequently be included in the
  381. drawfile, it is not essential to specify a list of fonts when initialising
  382. the file since the module will insert or extend the font table object if
  383. necessary when DF_WriteText or DF_WriteTextArea (with a '\F' sequence) is
  384. called.
  385.  
  386.  
  387. Units code
  388. ----------
  389. See 'Overview' above for an explanation of coordinate units and the units
  390. code passed in R7.
  391.  
  392.  
  393.  
  394. DF_SelectFont  (SWI &4CCC2)
  395. ===========================
  396.  
  397. Purpose: select a font, size and colours for subsequent use by DF_WriteText
  398. and DF_PathTextOutline.
  399.  
  400. On entry:   R0    = control flags
  401.             R1    = pointer to buffer for control block and drawfile
  402.             R2    = unused
  403.             R3    = font number (1 - 255) or pointer to font name
  404.             R4    = horizontal size (in 256ths of a point)
  405.             R5    = vertical size (in 256ths of a point)
  406.             R6    = foreground colour (as &BBGGRR00)
  407.             R7    = background colour (as &BBGGRR00)
  408.  
  409.    control flags: bit   meaning when set
  410.                   ----  ----------------
  411.                    0    determines method of error reporting
  412.                   1-31  reserved (should be zero)
  413.  
  414. On exit:    R0    = error code or zero
  415.             R1-R7 = preserved
  416.  
  417. This call selects a font, size and colours for subsequent use by
  418. DF_WriteText and DF_PathTextOutline. The selection remains in effect until
  419. changed by another call to DF_SelectFont.
  420.  
  421. The font can be specified by its number in the font table object (allowable
  422. values 1 - 255 inclusive) providing it is already listed in the font table,
  423. or by name (which must exist and can be terminated by ascii 0, 10 or 13).
  424. The minimum horizontal and vertical size is 1 pt.
  425.  
  426.  
  427.  
  428. DF_WriteText  (SWI &4CCC3)
  429. ==========================
  430.  
  431. Purpose: add a text object or transformed text object to the drawfile.
  432.  
  433. On entry:   R0    = control flags
  434.             R1    = pointer to buffer for control block and drawfile
  435.             R2    = free position offset
  436.             R3    = pointer to text string
  437.             R4    = x.position
  438.             R5    = y.position
  439.             R6    = rotation value or pointer to transformation matrix
  440.  
  441.    control flags: bit   meaning when set
  442.                   ----  ----------------
  443.                    0    determines method of error reporting
  444.                   1-2   determines interpretation of R6
  445.                   3-31  reserved (should be zero)
  446.  
  447. On exit:    R0    = error code or zero
  448.             R1    = preserved
  449.             R2    = incremented free position offset 
  450.             R3-R6 = preserved
  451.             R7    = increase in font table object size
  452.  
  453. See 'Overview' above for an explanation of error reporting, the control
  454. block and the free position offset value passed and returned in R2.
  455.  
  456.  
  457. Font selection & colours
  458. ------------------------
  459. A font, size and colours must have been selected with DF_SelectFont before
  460. using this call. The module does not support use of the system font (but you
  461. can use System.Fixed and System.Medium fonts). The background colour is
  462. passed to the font manager when the drawfile is rendered so that an
  463. anti-aliasing palette can be set up (there is no 'rub-out' box behind the
  464. text - the text is just overlaid on whatever forms the background).
  465.  
  466.  
  467. Text string
  468. -----------
  469. The text string must contain only printable characters (codes 32-126 and
  470. 128-255 inclusive) and can be terminated by ascii 0, 10 or 13.
  471.  
  472.  
  473. Coordinates
  474. -----------
  475. The x- and y-coordinates (R4 and R5) are in whatever units are currently
  476. selected and determine the location of the start of the string baseline (an
  477. imaginary underline - descenders such as 'g' and 'y' - go below this line).
  478.  
  479.  
  480. Rotation or transformation
  481. --------------------------
  482. If R6 is zero a (non-transformed) text object is created. Otherwise, a
  483. transformed text object is created and R6 is interpreted as follows:
  484.  
  485. •if R0 bit 2 is set, R6 is a pointer to a transformation matrix; the
  486.  translation entries in the matrix (which are in draw units) are added to
  487.  the x- and y-position values in R4 and R5 after these have been converted
  488.  to draw units.
  489.  
  490. •if R0 bit 2 is clear, R6 is a rotation angle in 256ths of a degree (R0 bit
  491.  1 clear) or 65536ths of a radian (R0 bit 1 set) and a transformation matrix
  492.  is generated from this angle.
  493.  
  494. Scaling and/or rotation do not affect the location of the start of the
  495. string baseline. DF_TransformObject provides a more flexible way of
  496. transforming an object.
  497.  
  498. A text object can be created with a 'unit' transformation matrix - i.e.
  499. xscale = yscale = 1, rotation = 0, x- and y-translation = 0 - and
  500. transformed later with DF_TransformObject. The overall effect is the same,
  501. but this method would avoid the need to reposition any objects following the
  502. text object to allow insertion of the transformation matrix (although the
  503. module will do this if necessary).
  504.  
  505.  
  506. Font table entry
  507. ----------------
  508. If the selected font is not already listed in the font table object, the
  509. font table is extended (or one is inserted); since the font table is located
  510. near the start of the drawfile, everything following it is moved upwards in
  511. memory by an amount which is returned (in bytes) in R7. This may be useful
  512. if you have previously recorded the position of an object relative to the
  513. start of the buffer (e.g. for a subsequent call to DF_ShiftObject or
  514. DF_TransformObject). The free position offset value returned in R2 is
  515. automatically adjusted to include any increase in font table size.
  516.  
  517.  
  518.  
  519. DF_PathStart  (SWI &4CCC4)
  520. ==========================
  521.  
  522. Purpose: initiate a path object by writing the object header to the
  523. drawfile.
  524.  
  525. On entry:   R0    = control flags
  526.             R1    = pointer to buffer for control block and drawfile
  527.             R2    = free position offset
  528.             R3    = line colour (as &BBGGRR00); use -1 for none
  529.             R4    = fill colour (as &BBGGRR00); use -1 for none
  530.             R5    = line width (in draw units)
  531.             R6    = dash pattern (use 0 for no dash pattern)
  532.             R7    = join style and winding rule
  533.             R8    = end cap styles
  534.  
  535.    control flags: bit   meaning when set
  536.                   ----  ----------------
  537.                    0    determines method of error reporting
  538.                   1-31  reserved (should be zero)
  539.  
  540. On exit:    R0    = error code or zero
  541.             R1    = preserved
  542.             R2    = incremented free position offset 
  543.             R3-R8 = preserved
  544.  
  545. See 'Overview' above for an explanation of error reporting, the control
  546. block and the free position offset value passed and returned in R2.
  547.  
  548.  
  549. Dash pattern
  550. ------------
  551. The dash pattern parameter passed in R6 can be 0 (no dash pattern), 1-4 (for
  552. standard patterns as used by !Draw), or a pointer to a block containing a
  553. pattern definition. As an example, the definition for pattern 4 (long/short
  554. dash) is:
  555.  
  556.     block%!0  = 0     : initial gap length (draw units, must be >= 0)
  557.     block%!4  = 4     : number of entries following (multiple of 2, max = 8)
  558.     block%!8  = &2400 : line length }
  559.     block%!12 = &900  : gap  length } draw units,
  560.     block%!16 = &900  : line length } must be > 0
  561.     block%!20 = &900  : gap  length }
  562.  
  563.  
  564. Join style and winding rule
  565. ---------------------------
  566. The join style and winding rule parameter (R7) uses bits 0 and 1 for the
  567. style and bit 8 for the winding rule. Possible join styles are:
  568.  
  569.     0 = mitred (default for unrecognized value)
  570.     1 = round
  571.     2 = bevelled
  572.  
  573. If bit 8 is set the winding rule is non-zero, otherwise it is even-odd.
  574.  
  575.  
  576. End cap styles
  577. --------------
  578. The end cap styles parameter passed in R8 is a bitfield as follows:
  579.  
  580.     bits  0- 7  leading  cap style
  581.     bits  8-15  trailing cap style
  582.     bits 16-23  triangular cap width  } if appropriate, in 16ths of the
  583.     bits 24-31  triangular cap length } line width, maximum = 255
  584.  
  585. Possible styles are:
  586.  
  587.     0 = butt cap (default for unrecognized value)
  588.     1 = round cap
  589.     2 = projecting square cap
  590.     3 = triangular cap
  591.  
  592. Therefore the R8 parameter could be calculated as:
  593.   cap_style1% + (cap_style2% << 8) + (tri_cap_wid% << 16) + (tri_cap_len% << 24)
  594.  
  595. If leading and trailing triangular caps are selected they must have equal
  596. width and length.
  597.  
  598.  
  599. Path structure
  600. --------------
  601. A completed path object consists of the object header followed by one or
  602. more subpaths. Each subpath must start with a move (component tag = 2),
  603. which must be followed by at least one draw (tag = 8) or curve (tag = 6)
  604. component. A subpath can optionally end with a close (tag = 5, e.g. for a
  605. square, circle etc). A move (tag = 2) to start a new subpath automatically
  606. ends the preceeding subpath. The final subpath must be followed by an end
  607. marker (tag = 0).
  608.  
  609.  
  610. Subsequent path-related calls
  611. -----------------------------
  612. After this call, the module will only accept DF_PathMove/Draw/Curve/Close/
  613. TextOutline until DF_PathEnd is called (or the path object is abandoned with
  614. DF_AbortObject). To allow the calling application to insert path data
  615. directly into the drawfile, there is no restriction on the order of these
  616. calls (although DF_PathEnd will check that the path structure is valid).
  617.  
  618.  
  619.  
  620. DF_PathMove, DF_PathDraw, DF_PathCurve, DF_PathClose  (SWI &4CCC5 - 8)
  621. ======================================================================
  622.  
  623. Purpose: add a component to a path object.
  624.  
  625. On entry:   R0    = control flags
  626.             R1    = pointer to buffer for control block and drawfile
  627.             R2    = free position offset
  628.             R3    = unused
  629.             R4    = x-coordinate } these are unused 
  630.             R5    = y-coordinate } for DF_PathClose
  631.  
  632.    control flags: bit   meaning when set
  633.                   ----  ----------------
  634.                    0    determines method of error reporting
  635.                    1    do not write 0 for curve control point coordinates
  636.                   2-31  reserved (should be zero)
  637.  
  638. On exit:    R0    = error code or zero
  639.             R1    = preserved
  640.             R2    = incremented free position offset 
  641.             R3-R5 = preserved
  642.  
  643. See 'Overview' above for an explanation of error reporting, the control
  644. block and the free position offset value passed and returned in R2.
  645.  
  646.  
  647. Coordinates
  648. -----------
  649. The x- and y-coordinates (R4 and R5) are in whatever units are currently
  650. selected. DF_PathClose does not use any coordinates.
  651.  
  652.  
  653. Bezier curve segments
  654. ---------------------
  655. For a curve segment, the coordinates should be that of a point on the curve;
  656. the module can calculate the appropriate control point coordinates for a
  657. standard bezier curve as would be entered free-hand in !Draw. Curve segments
  658. can be mixed with move/draw/close segments subject to the rules of path
  659. structure described under DF_PathStart. The control point coordinates are
  660. calculated when DF_PathEnd is called. At this stage the module writes zero
  661. for each control point coordinate unless R0 bit 1 is set, in which case it
  662. does not write anything (it skips over the appropriate memory locations).
  663.  
  664.  
  665.  
  666. DF_PathTextOutline  (SWI &4CCC9)
  667. ================================
  668.  
  669. Purpose: obtain the outline for a text string and write this as a sub-path.
  670.  
  671. On entry:   R0    = control flags
  672.             R1    = pointer to buffer for control block and drawfile
  673.             R2    = free position offset
  674.             R3    = pointer to text string
  675.             R4    = x.position
  676.             R5    = y.position
  677.             R6    = rotation value or pointer to transformation matrix
  678.  
  679.    control flags: bit   meaning when set
  680.                   ----  ----------------
  681.                    0    determines method of error reporting
  682.                   1-2   determines interpretation of R6
  683.                   3-31  reserved (should be zero)
  684.  
  685. On exit:    R0    = error code or zero
  686.             R1    = preserved
  687.             R2    = incremented free position offset 
  688.             R3-R6 = preserved
  689.  
  690. See 'Overview' above for an explanation of error reporting, the control
  691. block and the free position offset value passed and returned in R2.
  692.  
  693.  
  694. Note that this call creates a complete subpath starting with a move; it
  695. could be used (e.g.) as shown below. Text outlines usually give rise to
  696. quite complex path structures and it is recommended that only short text
  697. strings be used. Examples:
  698.  
  699.   DF_PathStart
  700.   DF_PathMove            1st subpath
  701.   DF_PathDraw/Curve etc       "
  702.   DF_PathTextOutline     2nd subpath
  703.   DF_PathMove            3rd subpath
  704.   DF_PathDraw/Curve etc       "
  705.   DF_PathEnd             end of path object
  706.  
  707. or just
  708.  
  709.   DF_PathStart
  710.   DF_PathTextOutline
  711.   DF_PathEnd
  712.  
  713.  
  714. Path style
  715. ----------
  716. This call will change the path style attributes in the object header; join
  717. style is set to mitred and end-cap styles are set to butt.
  718.  
  719.  
  720. Font selection
  721. --------------
  722. A font, size and colours must have been selected with DF_SelectFont before
  723. using this call (the colours have no effect - the actual colours used are
  724. specified in the path object header). The module does not support use of the
  725. system font (but you can use System.Fixed and System.Medium fonts).
  726.  
  727.  
  728. Text string
  729. -----------
  730. The text string can contain the escape sequences listed below which are
  731. recognized by the Font Manager and can be terminated with ascii 0, 10 or 13.
  732. Each entry is a single byte.
  733.  
  734.    9, dx_low, dx_middle, dx_high (horizontal move)
  735.   11, dy_low, dy_middle, dy_high (vertical move)
  736.   17, foreground colour } colour is determined by the path object
  737.   18, background colour } header - these have no effect
  738.   21, comment string (ending with any ctrl character)
  739.   25, underline_position, underline_thickness
  740.   26, font_handle (to change font, handles must have been assigned
  741.       beforehand)
  742.  
  743.  
  744. Coordinates
  745. -----------
  746. The x- and y-coordinates (R4 and R5) are in whatever units are currently
  747. selected and determine the location of the start of the string baseline (an
  748. imaginary underline - descenders such as 'g' and 'y' - go below this line).
  749.  
  750.  
  751. Rotation or transformation
  752. --------------------------
  753. If R6 is non-zero it is interpreted as follows:
  754.  
  755. •if R0 bit 2 is set, R6 is a pointer to a transformation matrix; the
  756.  translation entries in the matrix (which are in draw units) are added to
  757.  the x- and y-position values in R4 and R5 after these have been converted
  758.  to draw units.
  759.  
  760. •if R0 bit 2 is clear, R6 is a rotation angle in 256ths of a degree (R0 bit
  761.  1 clear) or 65536ths of a radian (R0 bit 1 set) and a transformation matrix
  762.  is generated from this angle.
  763.  
  764. Scaling and/or rotation do not affect the location of the start of the
  765. string baseline.
  766.  
  767.  
  768.  
  769. DF_PathEnd  (SWI &4CCCA)
  770. ========================
  771.  
  772. Purpose: complete a path object.
  773.  
  774. On entry:   R0    = control flags
  775.             R1    = pointer to buffer for control block and drawfile
  776.             R2    = free position offset
  777.  
  778.    control flags: bit   meaning when set
  779.                   ----  ----------------
  780.                    0    determines method of error reporting
  781.                    1    only write control point coordinate values if
  782.                         existing values (x & y) are both zero
  783.                    2    never write control point coordinates
  784.                         (takes precedence over bit 1)
  785.                    3-31 reserved (should be zero)
  786.  
  787. On exit:    R0    = error code or zero
  788.             R1    = preserved
  789.             R2    = incremented free position offset 
  790.  
  791. See 'Overview' above for an explanation of error reporting, the control
  792. block and the free position offset value passed and returned in R2.
  793.  
  794.  
  795. This call adds the end-of-path marker, verifies the path structure, and (if
  796. no error is found) writes the object size and correct bounding box values to
  797. the object header. Optionally, control point coordinates can be calculated
  798. for bezier curve segments using the standard method (e.g. as used when
  799. entering a curve free-hand in !Draw); this means that you define the curve
  800. by means of points on the curve.
  801.  
  802. If R0 bit 2 is set, no control point coordinates are calculated; this would
  803. be used if the calling application had calculated these itself or if the
  804. path did not contain any curve segments (this saves a little time).
  805. Otherwise-
  806.  
  807. •if R0 bit 1 is set the module will only write control point coordinates if
  808.  the existing values (both x & y) are zero; this would be used if the
  809.  calling application calculated some of the control point coordinates but
  810.  wanted the module to do the others (which would initially be written as cx
  811.  = cy = 0 when the path curve component was written to the drawfile).
  812.  
  813. •if R0 bit 1 is clear control point coordinates are calculated and written
  814.  for all curve segments in the path.
  815.  
  816. A curve segment contains two control points (i.e. cx1,cy1 and cx2,cy2) which
  817. - in regard to the comments above - are treated completely separately.
  818.  
  819.  
  820.  
  821. DF_PreLoadSprite  (SWI &4CCCB)
  822. ==============================
  823.  
  824. Purpose: write a sprite object header to the drawfile and prepare to load a
  825. sprite file.
  826.  
  827. On entry:   R0    = control flags
  828.             R1    = pointer to buffer for control block and drawfile
  829.             R2    = free position offset
  830.             R3    = unused
  831.             R4    = bounding box xmin }
  832.             R5    =      "       ymin } in whatever units are
  833.             R6    =      "       xmax } currently selected
  834.             R7    =      "       ymax }
  835.             R8    = rotation value or pointer to transformation matrix
  836.  
  837.  
  838.    control flags: bit   meaning when set
  839.                   ----  ----------------
  840.                    0    determines method of error reporting
  841.                   1-2   determines interpretation of R8
  842.                   3-31  reserved (should be zero)
  843.  
  844. On exit:    R0    = error code or zero
  845.             R1    = preserved
  846.             R2    = incremented free position offset 
  847.             R3-R8 = preserved
  848.  
  849. See 'Overview' above for an explanation of error reporting, the control
  850. block and the free position offset value passed and returned in R2.
  851.  
  852.  
  853. If R8 is zero, a non-transformed sprite object will be created. When the
  854. drawfile is rendered, the sprite will be scaled to exactly fit the bounding
  855. box defined by R4-R7; it is essential that xmax > xmin and ymax > ymin.
  856.  
  857. If R8 is non-zero, its interpretation depends on bits 1 and 2 of R0 as
  858. follows:
  859.  
  860. •if R0 bit 2 is set, R8 is a pointer to a transformation matrix. The final
  861.  size of the sprite (when the drawfile is rendered) depends on the sprite
  862.  itself and the x- and y-scale factors in the matrix, and so the xmax and
  863.  ymax values (R6 & R7) are ignored. The xmin and ymin values (R4 & R5)
  864.  determine the location of the (pre-transformation) bottom-left corner of
  865.  the sprite (which is unaffected by scaling and/or rotation). The
  866.  translation entries in the matrix are in draw units and are added to the R4
  867.  & R5 coordinates (after the latter have been converted to draw units).
  868.  
  869. •if R0 bit 2 is clear, R8 is a rotation angle in 256ths of a degree (R0 bit
  870.  1 clear) or 65536ths of a radian (R0 bit 1 set). The sprite is scaled to
  871.  fit the bounding box defined by R4-R7 (must have xmax > xmin and ymax >
  872.  ymin) and rotated by the specified angle about its bottom-left corner.
  873.  
  874. A sprite object can be created with a 'unit' transformation matrix - i.e.
  875. xscale = yscale = 1, rotation = 0, x- and y-translation = 0 - and
  876. transformed later with DF_TransformObject. The overall effect is the same,
  877. but this method would avoid the need to reposition any objects following the
  878. sprite object to allow insertion of the transformation matrix (although the
  879. module will do this if necessary).
  880.  
  881. The portion of the buffer after the sprite object header is initialised as a
  882. sprite area (at address = buffer + free position offset after this call);
  883. this is a temporary measure in preparation for loading a sprite file. For
  884. example, you could use:
  885.  
  886.   SYS "DF_PreLoadSprite",1,buff%,fpo%,,xmin%,ymin%,xmax%,ymax%,0 TO,,fpo%
  887.   address% = buff% + fpo%
  888.   SYS "OS_SpriteOp",(10+256),address%,<full pathname of sprite file>
  889.   SYS "DF_SpriteLoaded",1,buff%,fpo% TO,,fpo%
  890.  
  891. Before loading the sprite file, you should check the amount of free buffer
  892. space (total buffer size minus free position offset value) against the file
  893. size. A sprite file consists of a header followed by one or more sprites; if
  894. there is more than one then only the first is incorporated into the
  895. drawfile.
  896.  
  897.  
  898.  
  899. DF_SpriteLoaded  (SWI &4CCCC)
  900. =============================
  901.  
  902. Purpose: complete a sprite object.
  903.  
  904. On entry:   R0    = control flags
  905.             R1    = pointer to buffer for control block and drawfile
  906.             R2    = free position offset
  907.  
  908.    control flags: bit   meaning when set
  909.                   ----  ----------------
  910.                    0    determines method of error reporting
  911.                   1-31  reserved (should be zero)
  912.  
  913. On exit:    R0    = error code or zero
  914.             R1    = preserved
  915.             R2    = incremented free position offset 
  916.  
  917. See 'Overview' above for an explanation of error reporting, the control
  918. block and the free position offset value passed and returned in R2.
  919.  
  920. This call expects to find the sprite object header (24 or 48 bytes) followed
  921. by a standard sprite area control block (initialised by DF_PreLoadSprite and
  922. updated on loading the sprite file) followed by the sprite. The module
  923. obtains the location and size of the sprite from the control area and moves
  924. it down in memory overwriting the control area. The sprite is then verified
  925. and (if no error is found) the correct size and bounding box values are
  926. written to the sprite object header.
  927.  
  928.  
  929.  
  930. DF_StartTextArea  (SWI &4CCCD)
  931. ==============================
  932.  
  933. Purpose: initiate a text area object.
  934.  
  935. On entry:   R0    = control flags
  936.             R1    = pointer to buffer for control block and drawfile
  937.             R2    = free position offset
  938.             R3    = unused
  939.             R4    = initial text foreground colour (as &BBGGRR00)
  940.             R5    = initial text background colour (as &BBGGRR00)
  941.  
  942.    control flags: bit   meaning when set
  943.                   ----  ----------------
  944.                    0    determines method of error reporting
  945.                   1-31  reserved (should be zero)
  946.  
  947. On exit:    R0    = error code or zero
  948.             R1    = preserved
  949.             R2    = incremented free position offset 
  950.             R3-R5 = preserved
  951.  
  952. See 'Overview' above for an explanation of error reporting, the control
  953. block and the free position offset value passed and returned in R2.
  954.  
  955. This call writes the header for a text area object. It must be followed by
  956. at least one call to DF_DefineTextArea to define the text column object(s)
  957. (the rectangular areas over which the text is formatted).
  958.  
  959. The DrawUtilsA module provides a call - DF_TextAreaExtent - which finds the
  960. actual area occupied by the text in a text area object. This allows some
  961. degree of automation of sizing and positioning of the text column objects
  962. (the rectangular areas over which the text is formatted). After completing
  963. the text area object, DF_TextAreaExtent could be called and the text column
  964. object coordinates then adjusted manually (the bounding box entries in the
  965. text area object header should be adjusted accordingly).
  966.  
  967.  
  968.  
  969. DF_DefineTextArea  (SWI &4CCCE)
  970. ===============================
  971.  
  972. Purpose: add a text column object to a text area object to define a
  973. rectangular area over which the text will be formatted.
  974.  
  975. On entry:   R0    = control flags
  976.             R1    = pointer to buffer for control block and drawfile
  977.             R2    = free position offset
  978.             R3    = unused
  979.             R4    = area xmin }  in whatever units are
  980.             R5    =      ymin }  currently selected
  981.             R6    =      xmax }  (must have xmax > xmin
  982.             R7    =      ymax }   and ymax > ymin)
  983.  
  984.    control flags: bit   meaning when set
  985.                   ----  ----------------
  986.                    0    determines method of error reporting
  987.                   1-31  reserved (should be zero)
  988.  
  989. On exit:    R0    = error code or zero
  990.             R1    = preserved
  991.             R2    = incremented free position offset 
  992.             R3-R7 = preserved
  993.  
  994. See 'Overview' above for an explanation of error reporting, the control
  995. block and the free position offset value passed and returned in R2.
  996.  
  997. This call can be followed only by another call to DF_DefineTextArea or to
  998. DF_WriteTextArea.
  999.  
  1000.  
  1001.  
  1002. DF_WriteTextArea  (SWI &4CCCF)
  1003. ==============================
  1004.  
  1005. Purpose: add text to a text area object.
  1006.  
  1007. On entry:   R0    = control flags
  1008.             R1    = pointer to buffer for control block and drawfile
  1009.             R2    = free position offset (optional - see below)
  1010.             R3    = pointer to text string
  1011.  
  1012.    control flags: bit   meaning when set
  1013.                   ----  ----------------
  1014.                    0    determines method of error reporting.
  1015.                    1    text string terminator is ascii 0, else is
  1016.                         ascii 0, 10 or 13.
  1017.                    2    on entry, use free position offset in R2.
  1018.                    3    on exit, return free position offset in R2.
  1019.                   4-31  reserved (should be zero).
  1020.  
  1021. On exit:    R0    = error code or zero
  1022.             R1    = preserved
  1023.             R2    = incremented free position offset - see below 
  1024.             R3-R6 = preserved
  1025.             R7    = increase in font table object size (for '\F' sequence)
  1026.  
  1027. See 'Overview' above for an explanation of error reporting, the control
  1028. block and the free position offset value passed and returned in R2.
  1029.  
  1030. This call can only be followed by another call to DF_WriteTextArea or one to
  1031. DF_EndTextArea.
  1032.  
  1033.  
  1034. Free position offset
  1035. --------------------
  1036. This call is unusual in that by default the module does not use the free
  1037. position offset passed and returned in R2, but instead uses an internal
  1038. offset value (stored in the drawfile control block area) which is set up by
  1039. a call to DF_DefineTextArea, and which is updated automatically with each
  1040. call to DF_WriteTextArea (based on the length of the text string). 
  1041.  
  1042. If R0 bit 2 is clear or R2 is zero on entry, the internal offset is used to
  1043. determine where to add the text string to the drawfile. This internal offset
  1044. is incremented according to the length of the string and (if R0 bit 3 is
  1045. set) returned in R2.
  1046.  
  1047. R2 can be used in the usual way if R0 bits 2 and 3 are set, except that the
  1048. value does not have to be a multiple of four.
  1049.  
  1050.  
  1051. Text string
  1052. -----------
  1053. The text string should contain only printable characters (codes 32-126 and
  1054. 128-255). It can be terminated by character 0, 10 or 13 if R0 bit 1 is clear
  1055. or only by a null character (ascii 0) if R0 bit 1 is set (the latter would
  1056. be used when reading the text from a file).
  1057.  
  1058. The text string can contain any of the escape sequences (beginning with a
  1059. back-slash character) described in the section on !Draw in the User
  1060. Guide/Applications Guide or Programmers Reference Manual. Two or more of
  1061. these sequences can be included in the text string, but do not split a
  1062. sequence between calls to DF_WriteTextArea.
  1063.  
  1064. If the text string contains a font definition ('\F') sequence, the font is
  1065. added to the font table object if not already included (a font table object
  1066. will be created if necessary). Since the font table is located near the
  1067. start of the drawfile, everything following it is moved upwards in memory by
  1068. an amount which is returned (in bytes) in R7. The free position offset value
  1069. (whether or not returned in R2) is automatically adjusted to include this
  1070. increase in font table size.
  1071.  
  1072.  
  1073. Reading from file
  1074. -----------------
  1075. When reading from a text file, loading the text directly into the drawfile
  1076. is not recommended. Instead you should use a temporary buffer as shown
  1077. below:
  1078.  
  1079.   REM get size of text file, allocate temporary buffer, load text file
  1080.   REM and ensure null char terminator.
  1081.  
  1082.   SYS "OS_File", 17, <full pathname of text file> TO,,,, size%
  1083.   DIM text_buff% size%
  1084.   SYS "OS_File", 16, <full pathname of text file>, text_buff%, 0
  1085.   text_buff%?size% = 0
  1086.  
  1087.   REM now create the text area object (this example uses R2):
  1088.  
  1089.   SYS "DF_StartTextArea",  1, buff%, fpo%,,0, &FFFFFF00 TO,,fpo%
  1090.   SYS "DF_DefineTextArea", 1, buff%, fpo%,,xmin%,ymin%,xmax%,ymax% TO,,fpo%
  1091.   SYS "DF_WriteTextArea", (1+2+4+8), buff%, fpo%, text_buff% TO,,fpo%
  1092.   SYS "DF_EndTextArea",   (1+4+8), buff%, fpo% TO,,fpo%
  1093.  
  1094.  
  1095. Text entry from the calling application
  1096. ---------------------------------------
  1097. The calling application can write directly to the text area object as
  1098. follows:
  1099.  
  1100.   SYS "DF_StartTextArea", 1,buff%,fpo%,,0,&FFFFFF00 TO,,fpo%
  1101.   SYS "DF_DefineTextArea",1,buff%,fpo%,,xmin%,ymin%,xmax%,ymax%
  1102.   SYS "DF_WriteTextArea", 1,buff%,,"\!1"
  1103.   SYS "DF_WriteTextArea", 1,buff%,,"\F0Trinity.Medium 12/\F1Corpus.Bold 12"
  1104.   SYS "DF_WriteTextArea", 1,buff%,,"\F2Trinity.Bold 16/\F3Corpus.Bold 14"
  1105.   SYS "DF_WriteTextArea", 1,buff%,,"\AC\L14/\P3/\2Draw\AD"
  1106.   SYS "DF_WriteTextArea", 1,buff%,,"\1Draw\0\P18/ is the most powerful of the applications"
  1107.   SYS "DF_WriteTextArea", 1,buff%,,"supplied with \1RISC OS\0. It is a structured"
  1108.   SYS "DF_WriteTextArea", 1,buff%,,"graphics program that can work with a variety of"
  1109.   SYS "DF_WriteTextArea", 1,buff%,,"basic object types."
  1110.   SYS "DF_WriteTextArea", 1,buff%,,""
  1111.   SYS "DF_WriteTextArea", 1,buff%,,"\AC\P3/\3Paths\AD"
  1112.   SYS "DF_WriteTextArea", 1,buff%,,"\1\P18/\U-25 15/Paths\0\U./ are sequences of straight"
  1113.   SYS "DF_WriteTextArea", 1,buff%,,"and curved lines of arbitrary thickness and colour,"
  1114.   REM more calls to DF_WriteText Area...
  1115.   SYS "DF_EndTextArea",   1,buff% TO,,fpo%
  1116.  
  1117. Each text string can be terminated by character 0, 10 or 13 or only by a
  1118. null character (ascii 0) depending on R0 bit 1. These terminating characters
  1119. are converted to newlines (ascii 10) when written to the text area object.
  1120. When rendered, a single newline is treated as a space. Therefore, the
  1121. lengths of the text strings supplied to DF_WriteTextArea do not reflect how
  1122. they will be formatted during rendering (this depends on the font and size,
  1123. and the area width less margin values, etc).
  1124.  
  1125. Two or more (= n) newlines gives a vertical gap equal to (n-1) times the
  1126. paragraph leading plus one linespace. Supplying a null string to
  1127. DF_WriteTextArea adds a newline to the one ending the previous text string
  1128. (giving two newlines) which results in a new paragraph being started.
  1129.  
  1130.  
  1131. Escape sequences
  1132. ----------------
  1133. Full details of the escape sequences (which always begin with a back-slash
  1134. character) can be found in the User Guide/Applications Guide or Programmers
  1135. Reference Manual. Most of these can be terminated either by a slash
  1136. character or a newline (DF_WriteTextArea allows chars 0, 10 and 13 for
  1137. newline depending on R0 bit 1). 
  1138.  
  1139. The text must begin with an initializer ('\!1') sequence. If two or more
  1140. physical areas are used, you must include a '\Dn' sequence with n equal to
  1141. the number of areas (each defined by a call to DF_DefineTextArea). The '\D'
  1142. sequence must appear before any printable (i.e. when rendered) text;
  1143. immediately after the '\!1' sequence is recommended. If there is only one
  1144. physical area then the '\D' sequence is optional.
  1145.  
  1146. The escape sequence code letter is case-sensitive; e.g. '\P' defines the
  1147. paragraph leading, '\p' is unrecognized and gives an error. Numeric
  1148. parameters are integers (a decimal point will result in an error). A font
  1149. definition sequence ('\F') will add the specified font (which must exist) to
  1150. the font table object if not already listed.
  1151.  
  1152.  
  1153.  
  1154. DF_EndTextArea  (SWI &4CCD0)
  1155. ============================
  1156.  
  1157. Purpose: complete a text area object.
  1158.  
  1159. On entry:   R0    = control flags
  1160.             R1    = pointer to buffer for control block and drawfile
  1161.             R2    = free position offset (optional - see below)
  1162.  
  1163.    control flags: bit   meaning when set
  1164.                   ----  ----------------
  1165.                    0    determines method of error reporting
  1166.                    1    unused (should be zero)
  1167.                    2    on entry, use free position offset in R2.
  1168.                   3-31  reserved (should be zero)
  1169.  
  1170. On exit:    R0    = error code or zero
  1171.             R1    = preserved
  1172.             R2    = incremented free position offset 
  1173.  
  1174. See 'Overview' above for an explanation of error reporting, the control
  1175. block and the free position offset value passed and returned in R2.
  1176.  
  1177. If R2 is zero or R0 bit 2 is clear the internal offset value is used to
  1178. determine the size of the text area object (see DF_WriteTextArea for
  1179. explanation).
  1180.  
  1181. This call ensures that the text area object is properly terminated (newline
  1182. followed by a null character with additional null chars to a word boundary)
  1183. and writes the correct size and bounding box entries to the object header.
  1184.  
  1185.  
  1186.  
  1187. DF_StartTaggedObject  (SWI &4CCD1)
  1188. ==================================
  1189.  
  1190. Purpose: initiate a tagged object.
  1191.  
  1192. On entry:   R0    = control flags
  1193.             R1    = pointer to buffer for control block and drawfile
  1194.             R2    = free position offset
  1195.             R3    = secondary tag value
  1196.  
  1197.    control flags: bit   meaning when set
  1198.                   ----  ----------------
  1199.                    0    determines method of error reporting
  1200.                   1-31  reserved (should be zero)
  1201.  
  1202. On exit:    R0    = error code or zero
  1203.             R1    = preserved
  1204.             R2    = incremented free position offset 
  1205.             R3    = current tagged object nesting level
  1206.  
  1207. See 'Overview' above for an explanation of error reporting, the control
  1208. block and the free position offset value passed and returned in R2.
  1209.  
  1210. This call writes the header for a tagged object. Tagged objects provide a
  1211. means by which standard objects can be packaged along with additional data
  1212. which is ignored by applications such as !Draw but which would be relevant
  1213. to a specific editor or rendering program.
  1214.  
  1215.  
  1216. The structure of a tagged object is:
  1217.  
  1218.   + 0     Object tag (type identifier, = 7)
  1219.   + 4     Total object size (bytes, including additional data at end of
  1220.                              this tagged object)
  1221.   + 8     Object bounding box xmin  }
  1222.   +12       "       "      "  ymin  } in draw units
  1223.   +16       "       "      "  xmax  }
  1224.   +20       "       "      "  ymax  }
  1225.   +24     Secondary tag value
  1226.  
  1227.   +28     A complete object (with size = n bytes, can be a group, tagged,
  1228.                              text, path, sprite or text area object)
  1229.  
  1230.   +(28+n) Optional additional data (multiple of 4 bytes)
  1231.  
  1232.  
  1233. The secondary tag value and optional additional data at the end of the
  1234. object are ignored by applications such as !Draw. Tagged objects cannot be
  1235. edited in !Draw; they cannot be re-positioned, scaled or rotated and the
  1236. style attributes etc. of the object contained within the tagged object
  1237. cannot be altered.
  1238.  
  1239. The object contained within the tagged object can be a group object
  1240. (containing one or more objects) or a tagged object (containing one object)
  1241. or a path, text, sprite or text area object. Thus tagged objects can be
  1242. nested. The DrawUtilsB module allows a maximum nesting level of 15. The
  1243. current nesting level is returned in R3 (this is initially zero, increments
  1244. by 1 with each call to DF_StartTaggedObject and decrements by 1 with each
  1245. call to DF_EndTaggedObject).
  1246.  
  1247. As an example, to incorporate a path object into a tagged object with an
  1248. additional 16 bytes of data following, you could use:
  1249.  
  1250.   SYS "DF_StartTaggedObject",1,buff%,fpo%,0 TO,,fpo%
  1251.   SYS "DF_PathStart",1,buff%,fpo%,<path style parameters> TO,,fpo%
  1252.   ...calls to DF_PathMove/Draw/Curve/Close etc...
  1253.   SYS "DF_PathEnd",1,buff%,fpo% TO,,fpo%
  1254.   buff%!fpo%      = extra_data1%
  1255.   buff%!(fpo%+4)  = extra_data2%
  1256.   buff%!(fpo%+8)  = extra_data3%
  1257.   buff%!(fpo%+12) = extra_data4%
  1258.   fpo%+= 16
  1259.   SYS "DF_EndTaggedObject",1,buff%,fpo% TO,,fpo%
  1260.  
  1261.  
  1262.  
  1263. DF_EndTaggedObject  (SWI &4CCD2)
  1264. ================================
  1265.  
  1266. Purpose: complete a tagged object.
  1267.  
  1268. On entry:   R0    = control flags
  1269.             R1    = pointer to buffer for control block and drawfile
  1270.             R2    = free position offset
  1271.  
  1272.    control flags: bit   meaning when set
  1273.                   ----  ----------------
  1274.                    0    determines method of error reporting
  1275.                   1-31  reserved (should be zero)
  1276.  
  1277. On exit:    R0    = error code or zero
  1278.             R1    = preserved
  1279.             R2    = incremented free position offset 
  1280.             R3    = current tagged object nesting level
  1281.  
  1282. See 'Overview' above for an explanation of error reporting, the control
  1283. block and the free position offset value passed and returned in R2.
  1284.  
  1285. This call completes a tagged object by writing the correct object size and
  1286. bounding box values to the object header. The bounding box is identical to
  1287. that of the object contained within the tagged object.
  1288.  
  1289. Any additional data should be written directly into the drawfile and the
  1290. free position offset value incremented by the appropriate amount before
  1291. issuing this call (see example under description of DF_StartTaggedObject).
  1292.  
  1293.  
  1294.  
  1295. DF_StartGroup  (SWI &4CCD3)
  1296. ===========================
  1297.  
  1298. Purpose: initiate a group object.
  1299.  
  1300. On entry:   R0    = control flags
  1301.             R1    = pointer to buffer for control block and drawfile
  1302.             R2    = free position offset
  1303.             R3    = 0 or pointer to group identifier string
  1304.  
  1305.    control flags: bit   meaning when set
  1306.                   ----  ----------------
  1307.                    0    determines method of error reporting
  1308.                   1-31  reserved (should be zero)
  1309.  
  1310. On exit:    R0    = error code or zero
  1311.             R1    = preserved
  1312.             R2    = incremented free position offset 
  1313.             R3    = current group object nesting level
  1314.  
  1315. See 'Overview' above for an explanation of error reporting, the control
  1316. block and the free position offset value passed and returned in R2.
  1317.  
  1318. This call writes the header for a group object. On entry, R3 can be a
  1319. pointer to a string identifier (max 12 characters) for the group. This may
  1320. be relevant to specific editors or rendering programs. Usually this is just
  1321. written as 12 spaces (use R3 = 0 for this).
  1322.  
  1323. All objects created between issuing this call and the corresponding
  1324. DF_EndGroup are included in the group. The DrawUtilsB module allows group
  1325. objects to be nested to a depth of 127. The current nesting level is
  1326. returned in R3 (this is initially zero, increments by 1 with each call to
  1327. DF_StartGroup and decrements by 1 with each call to DF_EndGroup).
  1328.  
  1329.  
  1330.  
  1331. DF_EndGroup  (SWI &4CCD4)
  1332. =========================
  1333.  
  1334. Purpose: complete a group object.
  1335.  
  1336. On entry:   R0    = control flags
  1337.             R1    = pointer to buffer for control block and drawfile
  1338.             R2    = free position offset
  1339.  
  1340.    control flags: bit   meaning when set
  1341.                   ----  ----------------
  1342.                    0    determines method of error reporting
  1343.                   1-31  reserved (should be zero)
  1344.  
  1345. On exit:    R0    = error code or zero
  1346.             R1    = preserved
  1347.             R2    = incremented free position offset 
  1348.             R3    = current group object nesting level
  1349.  
  1350. See 'Overview' above for an explanation of error reporting, the control
  1351. block and the free position offset value passed and returned in R2.
  1352.  
  1353. This call completes a group object by writing the correct object size and
  1354. bounding box values to the object header. The bounding box is that which
  1355. precisely encloses the bounding boxes of all objects in the group.
  1356.  
  1357.  
  1358.  
  1359. DF_CompleteFile  (SWI &4CCD5)
  1360. =============================
  1361.  
  1362. Purpose: check for completion of the drawfile.
  1363.  
  1364. On entry:   R0    = control flags
  1365.             R1    = pointer to buffer for control block and drawfile
  1366.             R2    = free position offset
  1367.             R3-R5 = unused
  1368.             R6    = 0 or page size code
  1369.  
  1370.    control flags: bit   meaning when set
  1371.                   ----  ----------------
  1372.                    0    determines method of error reporting
  1373.                   1-31  reserved (should be zero)
  1374.  
  1375. On exit:    R0    = error code or zero
  1376.             R1    = preserved
  1377.             R2    = free position offset 
  1378.             R3    = 0 or incomplete object type (tag value)
  1379.             R4    = group object nesting level
  1380.             R5    = tagged object nesting level
  1381.             R6    = page size code (may be altered to a recognized value)
  1382.  
  1383. See 'Overview' above for an explanation of error reporting, the control
  1384. block and the free position offset value passed and returned in R2.
  1385.  
  1386. There is no end-of-file marker in a drawfile - its size is given by the file
  1387. size attribute which is not actually contained within the file - and this
  1388. call is largely optional. This call;
  1389.  
  1390. •checks that there is no incomplete path, sprite or text area object in the
  1391.  drawfile; if there is then its tag value is returned in R3 (otherwise R3 =
  1392.  0)
  1393.  
  1394. •checks that there are no incomplete group or tagged objects; the nesting
  1395.  levels are returned in R4 and R5 and should both be zero
  1396.  
  1397. •if R3=R4=R5=0, checks that group and tagged object bounding boxes are
  1398.  correct for the object(s) contained therein (this is seldom necessary) and
  1399.  sets the image bounding box in the drawfile header (which will probably be
  1400.  correct anyway)
  1401.  
  1402. •if no errors are found and R6 is non-zero, R6 is taken as a page size code
  1403.  (see DF_InitialiseFile) and used to alter the options object (if there is
  1404.  no options object then R6 is ignored). 
  1405.  
  1406.  
  1407. Therefore, this call checks for completion of the drawfile and does not
  1408. preclude addition of more objects to the file. Alternatively, this call
  1409. could be used (e.g.) to check that the image bounding box was correct and
  1410. then issued again (after reading the image size) to set the page size in the
  1411. options object.
  1412.  
  1413.  
  1414.  
  1415. DF_AbortObject  (SWI &4CCD6)
  1416. ============================
  1417.  
  1418. Purpose: abandon an incomplete path, sprite or text area object.
  1419.  
  1420. On entry:   R0    = control flags
  1421.             R1    = pointer to buffer for control block and drawfile
  1422.             R2    = free position offset
  1423.  
  1424.    control flags: bit   meaning when set
  1425.                   ----  ----------------
  1426.                    0    determines method of error reporting
  1427.                   1-31  reserved (should be zero)
  1428.  
  1429. On exit:    R0    = error code or zero
  1430.             R1    = preserved
  1431.             R2    = free position offset (altered if R3 <> 0)
  1432.             R3    = 0 or object type (tag value)
  1433.  
  1434. See 'Overview' above for an explanation of error reporting, the control
  1435. block and the free position offset value passed and returned in R2.
  1436.  
  1437. This call should be used if a path, sprite or text area object has been
  1438. initiated but is to be abandoned (before completion) for any reason. It
  1439. resets the control block status flags (including those determining which
  1440. calls can be applied to the drawfile) and restores the free position offset
  1441. to its value immediately before the object was initiated.
  1442.  
  1443.  
  1444.  
  1445. DF_BufferResized  (SWI &4CCD7)
  1446. ==============================
  1447.  
  1448. Purpose: describe a change in buffer size.
  1449.  
  1450. On entry:   R0    = control flags
  1451.             R1    = pointer to buffer for control block and drawfile
  1452.             R2    = free position offset
  1453.             R3    = unused
  1454.             R4    = new buffer size (bytes)
  1455.  
  1456.    control flags: bit   meaning when set
  1457.                   ----  ----------------
  1458.                    0    determines method of error reporting
  1459.                   1-31  reserved (should be zero)
  1460.  
  1461. On exit:    R0    = error code or zero
  1462.             R1    = preserved
  1463.             R2    = free position offset 
  1464.             R3    = preserved
  1465.             R4    = preserved
  1466.  
  1467. See 'Overview' above for an explanation of error reporting, the control
  1468. block and the free position offset value passed and returned in R2.
  1469.  
  1470. The module needs to know the buffer size so it can check the amount of free
  1471. space before making any additions to the drawfile. This call can be issued
  1472. at any time (after DF_InitialiseFile) to report a change in buffer size.
  1473. Obviously the new size must not be less than the drawfile size.
  1474.  
  1475.  
  1476.  
  1477. DF_SetUnits  (SWI &4CCD8)
  1478. =========================
  1479.  
  1480. Purpose: change coordinate units.
  1481.  
  1482. On entry:   R0    = control flags
  1483.             R1    = pointer to buffer for control block and drawfile
  1484.             R2    = unused
  1485.             R3    = unused
  1486.             R4    = new units code
  1487.  
  1488.    control flags: bit   meaning when set
  1489.                   ----  ----------------
  1490.                    0    determines method of error reporting
  1491.                   1-31  reserved (should be zero)
  1492.  
  1493. On exit:    R0    = error code or zero
  1494.             R1    = preserved
  1495.             R2    = preserved 
  1496.             R3    = preserved
  1497.             R4    = units code (may be altered to a recognized value)
  1498.  
  1499. See 'Overview' above for an explanation of error reporting, the control
  1500. block and the free position offset value passed and returned in R2.
  1501.  
  1502. This call changes the units used to specify (most) coordinates; see
  1503. 'Overview: Coordinate units & transformation matrices' at the beginning of
  1504. this file for details.
  1505.  
  1506.  
  1507.  
  1508. DF_SetOrigin  (SWI &4CCD9)
  1509. ==========================
  1510.  
  1511. Purpose: define the origin for subsequent calls.
  1512.  
  1513. On entry:   R0    = control flags
  1514.             R1    = pointer to buffer for control block and drawfile
  1515.             R2    = unused
  1516.             R3    = unused
  1517.             R4    = new x.origin  } in whatever units are
  1518.             R5    = new y.origin  } currently selected
  1519.  
  1520.    control flags: bit   meaning when set
  1521.                   ----  ----------------
  1522.                    0    determines method of error reporting
  1523.                   1-31  reserved (should be zero)
  1524.  
  1525. On exit:    R0    = error code or zero
  1526.             R1    = preserved
  1527.             R2    = preserved 
  1528.             R3-R5 = preserved
  1529.  
  1530. See 'Overview' above for an explanation of error reporting, the control
  1531. block and the free position offset value passed and returned in R2.
  1532.  
  1533. The x- and y-origin values are added (after conversion to draw units) to the
  1534. coordinates used in all subsequent module calls except DF_TransformObject
  1535. and DF_ShiftObject. The origin coordinates are initially set to zero. 
  1536.  
  1537.  
  1538.  
  1539. DF_TransformObject  (SWI &4CCDA)
  1540. ================================
  1541.  
  1542. Purpose: transform an object using a transformation matrix.
  1543.  
  1544. On entry:   R0    = control flags
  1545.             R1    = pointer to buffer for control block and drawfile
  1546.             R2    = free position offset
  1547.             R3    = unused
  1548.             R4    = offset to object (bytes from start of buffer)
  1549.             R5    = pointer to transformation matrix
  1550.             R6    = x.origin  } for transformation
  1551.             R7    = y.origin  } in draw units
  1552.  
  1553.    control flags: bit   meaning when set
  1554.                   ----  ----------------
  1555.                    0    determines method of error reporting
  1556.                   1-31  reserved (should be zero)
  1557.  
  1558. On exit:    R0    = error code or zero
  1559.             R1    = preserved
  1560.             R2    = free position offset (may be altered) 
  1561.             R3-R7 = preserved
  1562.  
  1563. See 'Overview' above for an explanation of error reporting, the control
  1564. block and the free position offset value passed and returned in R2.
  1565.  
  1566. This call applies the transformation matrix to the object indicated by R4
  1567. (R4 is the offset in bytes from the start of the buffer to the start of the
  1568. object).
  1569.  
  1570. If necessary, text objects will be converted to transformed text objects and
  1571. sprite objects will be converted to transformed sprite objects. Such
  1572. conversions increase the size of the objects (by 28 and 24 bytes
  1573. respectively) and therefore the size of the drawfile, and the free position
  1574. offset returned in R2 is incremented accordingly. Any objects located after
  1575. the one indicated by R4 will be moved up in memory by the appropriate
  1576. amount.
  1577.  
  1578. This call can be applied to any completed object - including a group object
  1579. or tagged object but not a text area object - even if it is inside a group
  1580. object or tagged object, or is part of an (as yet) incomplete group object
  1581. or tagged object.
  1582.  
  1583. An error will be reported if:
  1584. •there is an incomplete path, sprite or text area object in the drawfile
  1585. •the object indicated by R4 is an incomplete group object or tagged object
  1586. •the object indicated by R4 is a text area object or a group object or
  1587.  tagged object containing a text area object (you cannot transform a text
  1588.  area object).
  1589.  
  1590. R6 and R7 define a point (in draw units) about which the transformation
  1591. (i.e. scaling and/or rotation) is applied. If, for example, R6 and R7 define
  1592. the geometric centre of an object, then the object will be scaled and/or
  1593. rotated about its centre with the centre remaining in its original
  1594. position).
  1595.  
  1596. See 'Overview: Coordinate units and transformation matrices' for the format
  1597. of the matrix.
  1598.  
  1599. All relevant bounding boxes are updated after this call.
  1600.  
  1601.  
  1602.  
  1603. DF_ShiftObject  (SWI &4CCDB)
  1604. ============================
  1605.  
  1606. Purpose: alter the position of an object.
  1607.  
  1608. On entry:   R0    = control flags
  1609.             R1    = pointer to buffer for control block and drawfile
  1610.             R2    = free position offset
  1611.             R3    = unused
  1612.             R4    = offset to object (bytes from start of buffer)
  1613.             R5    = unused
  1614.             R6    = x.shift  } in draw
  1615.             R7    = y.shift  } units
  1616.  
  1617.    control flags: bit   meaning when set
  1618.                   ----  ----------------
  1619.                    0    determines method of error reporting
  1620.                   1-31  reserved (should be zero)
  1621.  
  1622. On exit:    R0    = error code or zero
  1623.             R1    = preserved
  1624.             R2    = free position offset 
  1625.             R3-R7 = preserved
  1626.  
  1627. See 'Overview' above for an explanation of error reporting, the control
  1628. block and the free position offset value passed and returned in R2.
  1629.  
  1630. In effect, this call performs the translation-only equivalent of
  1631. DF_TransformObject. The same result could be obtained using
  1632. DF_TransformObject with xscale = yscale = 1 and rotation = 0. However,
  1633. DF_ShiftObject does not convert text objects and sprite objects to their
  1634. transformed equivalents - for any object it simply adds the x- and y-shift
  1635. values to the existing coordinates.
  1636.  
  1637. The restrictions described above for DF_TransformObject apply, except that
  1638. DF_ShiftObject can be applied to a text area object.
  1639.  
  1640. This call could be used (e.g.) to align an object with a specified point in
  1641. the image. This could be done by calculating the dimensions of the object
  1642. and appropriate coordinates before adding it to the drawfile. Alternatively,
  1643. the object could be created with arbitrary coordinates (e.g. 0,0) and then
  1644. moved to the required position after reading the bounding box values and
  1645. calculating the appropriate horizontal and vertical shift.
  1646.  
  1647. All relevant bounding boxes are updated after this call.
  1648.  
  1649.  
  1650.  
  1651. DF_PrevObjBBox  (SWI &4CCDC)
  1652. ============================
  1653.  
  1654. Purpose: return bounding box for last object created (or processed).
  1655.  
  1656. On entry:   R0    = control flags
  1657.             R1    = pointer to buffer for control block and drawfile
  1658.             R2    = unused
  1659.             R3-R6 = unused
  1660.  
  1661.    control flags: bit   meaning when set
  1662.                   ----  ----------------
  1663.                    0    determines method of error reporting
  1664.                   1-31  reserved (should be zero)
  1665.  
  1666. On exit:    R0    = error code or zero
  1667.             R1    = preserved
  1668.             R2    = preserved
  1669.             R3-R6 = bounding box xmin, ymin, xmax, ymax (in draw units)
  1670.  
  1671. See 'Overview' above for an explanation of error reporting, the control
  1672. block and the free position offset value passed and returned in R2.
  1673.  
  1674. The calls listed below record the object bounding box values after creating
  1675. or processing (shift/transform) an object; DF_PrevObjBBox returns these
  1676. values in R3-R6.
  1677.  
  1678.     DF_WriteText       DF_EndTaggedObject
  1679.     DF_PathEnd         DF_EndGroup
  1680.     DF_SpriteLoaded    DF_TransformObject
  1681.     DF_EndTextArea     DF_ShiftObject
  1682.  
  1683.  
  1684.  
  1685. Error codes
  1686. ===========
  1687.  
  1688. Error codes have the hexadecimal format &ttssnnnn where tt is the error
  1689. type, ss is the subtype and nnnn is the actual error number. There is a
  1690. unique nnnn value for each possible error returned - these are given below
  1691. in numerical order. Possible error types are:
  1692.  
  1693.     &00  Entry parameter error (or insufficient buffer or RMA space).
  1694.     &20  Logical error.
  1695.     &40  Entry parameter error or possible corruption of control block
  1696.          and/or drawfile.
  1697.     &E0  Corrupt object in drawfile (may be possible to scrap the object and redo).
  1698.     &F0  Corrupt control block and/or drawfile (recovery from this is unlikely).
  1699.  
  1700. and subtypes are:
  1701.  
  1702.     &00  Miscellaneous.
  1703.     &10  Memory allocation.
  1704.     &20  Control block and/or drawfile structure error.
  1705.     &40  Font selection error.
  1706.     &60  Text string error.
  1707.     &80  Invalid path object.
  1708.     &90  Invalid sprite object.
  1709.     &A0  Invalid text area object.
  1710.  
  1711.  
  1712. Code       Description
  1713. ---------  -------------------------------------------------------------------------
  1714.            General errors
  1715.            --------------
  1716. 0000 0001  Unknown swi call.
  1717. 0010 0002  Module cannot obtain RMA workspace.
  1718. 0000 0003  Buffer for control block and drawfile must be in user area (address
  1719.            > &8000).
  1720. 0000 0004  Buffer address is not word-aligned.
  1721. 0010 0005  Minimum size for buffer is 2048 bytes.
  1722. 4020 0006  Incorrect identification word at start of buffer (should be
  1723.            'MkDr').
  1724. F020 0007  Identification word at buffer + 1024 bytes (= start of drawfile) is
  1725.            not 'Draw'.
  1726. F020 0008  Drawfile major version number is not 201.
  1727. 0000 0009  Free position offset (passed in R2) is incorrect (too small).
  1728. 0000 0010  Free position offset (passed in R2) is not a multiple of 4.
  1729. 2000 0011  Inappropriate operation; is returned (e.g.) if you call DF_PathStart and
  1730.            then DF_WriteText.
  1731. 0010 0012  Insufficient free space in buffer for this operation.
  1732. 0000 0013  Data blocks supplied to module must be in user area (address > &8000).
  1733. F020 0014  Pointers in control block area have been corrupted (serious error);
  1734.            applies to objects created by several swi calls (i.e. path, sprite &
  1735.            text area objects).
  1736. 4020 0015  Unrecognised object found (only standard Draw objects are supported);
  1737.            (may be returned by DF_CompleteFile, DF_TransformObject &
  1738.            DF_ShiftObject when scanning through the file to check group & tagged
  1739.            object bounding boxes and by Transform/ShiftObject when checking the
  1740.            specified object).
  1741. 4020 0016  Object size is too small or not a multiple of 4 bytes (as for code 15).
  1742. 4020 0017  Object bounding box has width or height <= 0 (as for code 15).
  1743. 2000 0018  File contains an incomplete group object, tagged object, path object,
  1744.            sprite object or text area object (may be returned by DF_CompleteFile).
  1745.  
  1746.  
  1747.            Font & text errors
  1748.            ------------------
  1749. F020 0101  Font table not found (should be immediately after drawfile header).
  1750. 0040 0102  Unknown font.
  1751. 0040 0103  Expected a font name but found a null string.
  1752. 0040 0104  Font name too long (max = 39 chars) or contains invalid characters.
  1753. 0040 0105  Font number is <1 or >255 (when DF_SelectFont is used with a font
  1754.            number rather than a name).
  1755. 0040 0106  No font assigned to this number (when DF_SelectFont is used with a
  1756.            font number rather than a name).
  1757. 0040 0107  Minimum font size (width and height) is 1 point.
  1758. 0040 0108  Font table is full (max = 255 fonts).
  1759. 0040 0109  No font selected (with DF_SelectFont) before calling DF_WriteText or
  1760.            DF_PathTextOutline.
  1761. 0060 0110  Expected a text string (e.g. for DF_WriteText & DF_PathTextOutline).
  1762. 0060 0111  Unrecognised or disallowed control sequence or ascii 127 character in
  1763.            string.
  1764.  
  1765.  
  1766.            Path object errors
  1767.            ------------------
  1768. 0000 0201  Number of elements in dash pattern definition is <2 or >8.
  1769. E080 0202  Unknown component found in path object (only 0, 2, 5, 6 & 8 recognised).
  1770. E080 0203  Unexpected path end   }
  1771. E080 0204       "      "   move  }
  1772. E080 0205       "      "   close } in path object.
  1773. E080 0206       "      "   curve }
  1774. E080 0207       "      "   draw  }
  1775. E080 0208  No end-of-path marker }
  1776. 0010 0209  Cannot calculate bounding box for path object (all entries = 0,
  1777.            otherwise path object is complete) due to failure of RMA workspace claim.
  1778.  
  1779.  
  1780.            Sprite object errors
  1781.            --------------------
  1782. 0000 0301  If a bounding box is used to specify a sprite size then must have
  1783.            xmax > xmin and ymax > ymin.
  1784. E090 0302  Sprite size inconsistent with object size.
  1785. E090 0303  Invalid sprite dimensions (width or height <= 0).
  1786. E090 0304  Invalid sprite offset (<&2C).
  1787. E090 0305  Sprite defined in unknown mode.
  1788. E090 0306  Invalid sprite palette size.
  1789. E090 0307  Invalid mask offset (<&2C).
  1790. E090 0308  Image size inconsistent with sprite dimensions.
  1791. E090 0309  Mask size inconsistent with sprite dimensions.
  1792. E090 0310  Unknown sprite type (from top byte of mode entry).
  1793.  
  1794.  
  1795.            Text area object errors
  1796.            -----------------------
  1797. 0000 0401  Must have xmax > xmin and ymax > ymin for text column object.
  1798. 00A0 0402  Initialiser is not '\!1'.
  1799. 00A0 0403  Absent or late '\!' sequence.
  1800. 00A0 0404  Late or multiple '\!' sequence (must only appear at start of text area).
  1801. 00A0 0405  '\D' sequence appears after text output.
  1802. 00A0 0406  Value in '\D' sequence must match the number of text column objects
  1803.            created with DF_DefineTextArea.
  1804. 00A0 0407  Unrecognised alignment code (must be one of L, R, D, C).
  1805. 00A0 0408  Syntax error or missing parameter in escape sequence.
  1806. 00A0 0409  Invalid parameter value in escape sequence.
  1807. 00A0 0410  Incorrect terminator for escape sequence (most allow '/' or newline).
  1808. 00A0 0411  No font defined for font number in font select (\digit) sequence.
  1809. 00A0 0412  Attempt to write text before selecting a font with \digit sequence.
  1810.  
  1811.  
  1812.            Tagged object errors
  1813.            --------------------
  1814. 2000 0501  Tagged objects already nested to maximum allowed depth (= 15).
  1815. 2000 0502  Inappropriate call to DF_EndTaggedObject (there was no call to
  1816.            DF_StartTaggedObject).
  1817. 4020 0503  Pointers in control block area have been corrupted (serious error) or
  1818.            may be due to incorrect free position offset value (passed in R2).
  1819.  
  1820.  
  1821.            Group object errors
  1822.            -------------------
  1823. 2000 0601  Group objects already nested to maximum allowed depth (= 127).
  1824. 2000 0602  Inappropriate call to DF_EndGroup (there was no call to DF_StartGroup).
  1825. 4020 0603  Pointers in control block area have been corrupted (serious error) or
  1826.            may be due to incorrect free position offset value (passed in R2).
  1827.  
  1828.  
  1829.            Transform/Shift object errors
  1830.            -----------------------------
  1831. 4020 0701  Invalid offset value to indicate object for DF_TransformObject or
  1832.            DF_ShiftObject (too small or large or not a multiple of 4 bytes).
  1833. 2000 0702  Incomplete path, sprite or text area object in file.
  1834. 2000 0703  Text area object disallowed by DF_TransformObject.
  1835.  
  1836.  
  1837. ------------------------------------------------------------------------------------
  1838.  
  1839.  
  1840. Comments concerning this software to:
  1841.     James McQueen
  1842.     9/2 15 Croftbank Street
  1843.     Springburn
  1844.     Glasgow
  1845.     G21 4LP
  1846.