diff options
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -49,11 +49,25 @@ char *gradient_to_string(gradient_t *gradient) return strslice(buffer, 0, start); } +void gradient_print(FILE *stream, gradient_t *gradient) +{ + for (size_t i = 0; i < gradient->length; i++) { + unsigned int r = gradient->colors[i].r * 255, + g = gradient->colors[i].g * 255, + b = gradient->colors[i].b * 255, + a = gradient->colors[i].a * 255; + + fprintf(stream, "#%02x%02x%02x%02x", r, g, b, a); + if (i != gradient->length - 1) + fputs(", ", stream); + } +} + void gradient_free(gradient_t *gradient) { free(gradient->colors); - if (gradient->cached != NULL) - cairo_pattern_destroy(gradient->cached); + if (gradient->pattern != NULL) + cairo_pattern_destroy(gradient->pattern); } const struct timespec timespec_from_ms(long ms) |
