SWI's
=====

Here are the SWI's provided by the DrawFile module.



DrawFile_Render
---------------

Entry:

   R0    =  flags:
               bit 0: render bounding boxes (as dotted red rectangles)
               bit 1: do not render the objects themselves
               bit 2: specify a default flatness in 
   R1    -> draw file data
   R2    =  size of draw file in bytes
   R3    -> transformation matrix
         =  0 <=> use identity
   R4    -> clipping rectangle in O S units
         =  0 <=> no clipping rectangle set up
   R5    = flatness

Exit:

   All registers preserved

Use:

   This SWI renders a draw file at a given screen position where that
position is defined as screen position 0, 0 with the x- and y-translations
as specified in the transformation matrix. Hence to render a non-rotated 1:1
draw file at (x, y) (screen coordinates in O S units) the transformation
matrix is

      (1 << 16        0)
      (      0  1 << 16)
      (  256*x    256*y).

The effects of calling the module with the matrix not of the form

      (f  0)
      (0  f)
      (x  y)

(which is a translation and a magnification) should not be relied on. The
clipping rectangle is typically a redraw rectangle returned by the Wimp on a
redraw window request.  If R4 = 0, then the whole draw file is rendered. If
non-zero, only objects which intersect the clipping rectangle are rendered.
If R3 = 0, then unit transformation matrix is assumed (i e, the draw file is
rendered with its bottom left corner at screen coordinates (0, 0)).

Altering the transformation matrix can allow you to alter the scale of the
diagram.  For example, you can use the following transformation matrix to
render your diagram at a scale of 2:1 :-

      (1 << 17        0)
      (      0  1 << 17)
      (  256*x    256*y).

and the following to render your diagram at half scale :-


      (1 << 15        0)
      (      0  1 << 15)
      (  256*x    256*y).

 

DrawFile_BBox
-------------

Entry:

   R0    =  flags (must be 0)
   R1    -> draw file data
   R2    =  size of draw file in bytes
   R3    -> transformation matrix
         =  0 <=> use identity
   R4    -> 4-word buffer to hold the bounding box of the draw file
            (x0, y0, x1, y1) in draw units

Exit:

   All registers preserved. Buffer pointed at by R4 holds the bounding box
of the draw file (x0, y0, x1, y1) in draw units.

Use:

   This SWI is used to determine the bounding box (in draw units) of the
given draw file, as if it were plotted with the transformation given.

DrawFile_DeclareFonts
---------------------

Entry:

   R0    =  flags
               bit 0: do not download font (passed to PDriver_DeclareFont)
   R1    -> draw file data
   R2    =  size of draw file in bytes

Exit:

   All registers preserved. All fonts used by the document have been
declared.

Use:

   If a printer requires font declarations, this SWI must be called for each
drawfile to be printed, between the calls to PDriver_SelectJob and
PDriver_DrawPage.

   All fonts are declared as "kerned," since this includes the non-kerned
case.

Other information
---- ------------

   The SWI chunk number of the DrawFile module is 0x45540 and its error base
is 0x20C00.
