Latest News
!System updates

Development tools
C/C++ Tools

Writing 32-bit code
32-bit introduction
32-bit overview
32-bit technical
Memory issues
Developer tools
Paul Skirrow's Guide (PDF)
Download area

32-bit APIs
API changes
CallASWI
FileCore

RISC OS 5
Overview
BBC BASIC
CDFS driver
OS_ClaimDeviceVector behaviour
CDFS
Draw clipping
GraphicsV
HAL
Internet
UTF8 & Japanese support
International IME support
MIMEMap
Module PostInit/Final
PCI Manager
PDumper
Podules
Resource allocation
SCSI
Service Calls
UCS fonts
USB
WIMP API Changes
WIMP Flags

IYONIX pc
DDR memory
Help system
Keyboard layout
Miscellaneous
PCI slots

Opportunities

Iyonix Ltd
IYONIX home page
Contact details

   

Draw Clipping to Path

Document version 0.10, January 2003

Principles

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.

API

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

SWI Draw_FillClipped

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).

SWI Draw_StrokeClipped

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