From 4e20a8cea66e707846f78f7cf55806b131c71a61 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 6 Feb 2010 21:59:25 +0100 Subject: Add option to set image background to white or black --- src/winwidget.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/winwidget.c') diff --git a/src/winwidget.c b/src/winwidget.c index fe98e85..c494123 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -627,20 +627,27 @@ feh_create_checks(void) eprintf ("Unable to create a teeny weeny imlib image. I detect problems"); - for (y = 0; y < 16; y += 8) { - onoff = (y / 8) & 0x1; - for (x = 0; x < 16; x += 8) { - if (onoff) - gib_imlib_image_fill_rectangle(checks, x, y, 8, 8, 144, 144, 144, - 255); - else - gib_imlib_image_fill_rectangle(checks, x, y, 8, 8, 100, 100, 100, - 255); - onoff++; - if (onoff == 2) - onoff = 0; + if (strncmp(opt.image_bg, "white", 5) == 0) + gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 255, 255, 255, 255); + else if (strncmp(opt.image_bg, "black", 5) == 0) + gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 0, 0, 0, 255); + else { + for (y = 0; y < 16; y += 8) { + onoff = (y / 8) & 0x1; + for (x = 0; x < 16; x += 8) { + if (onoff) + gib_imlib_image_fill_rectangle(checks, x, y, 8, 8, 144, 144, 144, + 255); + else + gib_imlib_image_fill_rectangle(checks, x, y, 8, 8, 100, 100, 100, + 255); + onoff++; + if (onoff == 2) + onoff = 0; + } } } + checks_pmap = XCreatePixmap(disp, root, 16, 16, depth); gib_imlib_render_image_on_drawable(checks_pmap, checks, 0, 0, 1, 0, 0); gib_imlib_free_image_and_decache(checks); -- cgit v1.2.3