Drawing with the SDK

Top  Previous  Next

The SDK provides several functions to simplify drawing with Whisker.


Adding objects


The SDK provides serveral functions to allow simple addition of drawing objects to documents:







as well as the plain vanilla




for the more esoteric drawing objects (see the Programmer's Guide for more details).



Drawing Styles


The server uses option strings to specify drawing styles to DisplayAddObject. The SDK simplifies the handling of drawing objects, with three functions:






These functions have a double use:


1.They set the 'default' drawing, pen and text options to the parameters specified.
2.They return a String value which represents the options which can be passed to the Server to specify these settings.


So to draw a line in a certain colour and width, all you need to do is to call


Whisker.DisplaySetPenOptions width, r, g, b, wsPenSolid

Whisker.DisplayAddLine docname, linename, x , y, x2, y2, ""


However, if you wanted to draw lines in two different styles, repeatedly, you could set up two different pens like this:


Dim Redln As String

Dim BlueLn As String


RedLn = Whisker.DisplaySetPenOptions(1, 255, 0, 0, wsPenSolid)

BlueLn = Whisker.DisplaySetBrushOptions(1, 0, 255, 0,wsPenSolid)


Whisker.DisplayAddLine docname, linename, x , y, x2, y2, RedLn

Whisker.DisplayAddLine docname, linename, a , b, a2, b2, BlueLn