[cairo] shading, take 2
Bill Spitzak
spitzak at d2.com
Wed Mar 3 10:09:18 PST 2004
On Wednesday 03 March 2004 07:21 am, Thomas Hunger wrote:
> some screenshots and a tarball can be found here:
> http://www.iqo.uni-hannover.de/gnome/cairo/
You mentioned the problem with qsort swapping two stops at the same value.
It seems to me that it would be acceptable to require the calling program to
sort the stops itself and give them in lowest-to-highest order. Most programs
can easily be written to do this and it avoids the need to even check if
sorting is necessary in Cairo.
Only problem is what to do if you provide the stops out of order. One idea is
to say it is undefined (except it should not crash or draw outside the
region). The other is to say that it acts like it is equal to the previous
stop. With no additional code this could also force any negative stops to
zero as well.
If you do want to sort, I think the fact that there are normally a small
number of stops, and they are very likely to be provided in order, means an
insertion sort would be fast enough.
--
,~,~,~,~ ~ ~ ~ ~
/\_ _|_========___ Bill Spitzak
~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com
More information about the cairo
mailing list