Tuesday, August 24, 2010

gnocl::draw set

As mentioned yesterday I set aside some time today to look at setting a number of global variables to contain parameters for line and fill colours plus a few other settings. So far so good but at the end of day the gnocl::draw set will cause a crash. This isn't too much of a problem to solve! I'm looking at how to split a variable length list of values into components using the strtok library function. The reason for this that  Cairo requires details of line types (i.e. 'dashes') to be presented as an array of doubles. Whilst I can easily store the list as a string as part of a global structure, parsing the list and creating an array and assigning values during run time is a new area to me. But, should have it all sorted by the end of play tomorrow evening.

Here's a taster of the gnocl::draw set sub-command at work:

    gnocl::draw set -lineColor {1 0 1 1} -fillColor {0 1 0 0.5} -lineWidth 5
    gnocl::draw set -dash {50 10 10 10}   

No comments: