Fixed gradients to actually use both end colors
[monky] / src / colours.c
index 016eb32..f839f2f 100644 (file)
@@ -10,7 +10,7 @@
  * Please see COPYING for details
  *
  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
  *     (see AUTHORS)
  * All rights reserved.
  *
@@ -119,7 +119,7 @@ unsigned long *do_gradient(int width, unsigned long first_colour, unsigned long
        for (i = 0; i < width; i++) {
                int red3 = 0, green3 = 0, blue3 = 0;    // colour components
 
-               float factor = ((float)(i + 1) / width);
+               float factor = ((float) i / (width - 1));
 
                /* the '+ 0.5' bit rounds our floats to ints properly */
                if (red1 >= red2) {