Draw Clipping to Path
Document version 0.10, January 2003
The Draw module in RISC OS 5.00 has been extended to support path clipping
via two new SWIs. It can use an arbitrary shape clipping path - it need not
be rectangular.
Draw works by flattening a path from curves into lots of short lines. This
new path is then scanned for horizontal lines which can be plotted to
the screen. These are placed in an array and plotted using the hline routine
(from OS_ReadVduVariables) - i.e. no code actually writes to the screen
in Draw.
For clipped paths, the clipping path is passed to the processor and scan
lines that would be plotted are 'remembered'. The main path is then passed
to the processor and only those scan lines which fall within the entries in
the array are actually plotted. This is very inefficient. Some of the
optimisations that could be applied to this, such as sorting the list are
not fully implemented.
To make clipping a number of regions simple, and because of the lack of
registers passed into the SWI call, the clipping path is described in a
description block:
| +0 | | pointer to path to clip against
| | +4 | | fill style for path
| | +8 | | pointer to transformation matrix, or 0 for identity
|
| On entry: | | R0 = | | pointer to path to plot
| | | R1 = | | fill style for path to plot, or 0 for default
| | | R2 = | | pointer to transformation matrix for path to plot, or 0 for identity
| | | R3 = | | flatness
| | | R4 = | | pointer to clip description block
|
Fill the path specified, clipping it against the clip description block (3
word block describing the clipping area).
| On entry: | | R0 = | | pointer to path to plot
| | | R1 = | | fill style for path to plot
| | | R2 = | | pointer to transformation matrix for path to plot, or 0 for identity
| | | R3 = | | flatness
| | | R4 = | | thickness
| | | R5 = | | pointer to join/cap block
| | | R6 = | | pointer to dashing pattern, or 0 for default
| | | R7 = | | pointer to clip description block
|
Stroke (draw the outline) of the specified, clipping it against the clip
description block (3 word block describing the clipping area).
There are a number of further optimisations that still could take place, so
speed may not yet be optimised.
 |
| © 2006 IYONIX Ltd |
32-bit RISC OS |
|