Mercurial > hg > forks > geeqie
changeset 2457:58f993045468
Fix #219: Ability to set solid colour for transparency layer
https://github.com/BestImageViewer/geeqie/issues/219
The checkerboard colours can be set on the Preferences/Image tab
author | Colin Clark <cclark@mcb.net> |
---|---|
date | Tue, 21 Mar 2017 17:28:55 +0000 |
parents | f2d26d984c1e |
children | 46817a8b4fbd |
files | doc/docbook/GuideOptionsImage.xml src/options.c src/options.h src/preferences.c src/rcfile.c src/renderer-tiles.c |
diffstat | 6 files changed, 46 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/docbook/GuideOptionsImage.xml Fri Mar 17 11:07:16 2017 +0000 +++ b/doc/docbook/GuideOptionsImage.xml Tue Mar 21 17:28:55 2017 +0000 @@ -190,6 +190,16 @@ </listitem> </varlistentry> </variablelist> + <variablelist> + <varlistentry> + <term> + <guilabel>Alpha channel color 1/2</guilabel> + </term> + <listitem> + <para>These two colors define the checkerboard background used when images with an alpha channel are displayed.</para> + </listitem> + </varlistentry> + </variablelist> </section> <section id="Convenience"> <title>Convenience</title>
--- a/src/options.c Fri Mar 17 11:07:16 2017 +0000 +++ b/src/options.c Tue Mar 21 17:28:55 2017 +0000 @@ -77,6 +77,15 @@ options->fullscreen.screen = -1; memset(&options->image.border_color, 0, sizeof(options->image.border_color)); + memset(&options->image.alpha_color_1, 0, sizeof(options->image.alpha_color_1)); + memset(&options->image.alpha_color_2, 0, sizeof(options->image.alpha_color_2)); +/* alpha channel checkerboard background (same as gimp) */ + options->image.alpha_color_1.red = 0x009999; + options->image.alpha_color_1.green = 0x009999; + options->image.alpha_color_1.blue = 0x009999; + options->image.alpha_color_2.red = 0x006666; + options->image.alpha_color_2.green = 0x006666; + options->image.alpha_color_2.blue = 0x006666; options->image.enable_read_ahead = TRUE; options->image.exif_rotate_enable = TRUE; options->image.exif_proof_rotate_enable = TRUE;
--- a/src/options.h Fri Mar 17 11:07:16 2017 +0000 +++ b/src/options.h Tue Mar 21 17:28:55 2017 +0000 @@ -89,6 +89,8 @@ gboolean use_custom_border_color_in_fullscreen; gboolean use_custom_border_color; GdkColor border_color; + GdkColor alpha_color_1; + GdkColor alpha_color_2; } image; /* thumbnails */
--- a/src/preferences.c Fri Mar 17 11:07:16 2017 +0000 +++ b/src/preferences.c Tue Mar 21 17:28:55 2017 +0000 @@ -297,6 +297,9 @@ view_window_colors_update(); } + options->image.alpha_color_1 = c_options->image.alpha_color_1; + options->image.alpha_color_2 = c_options->image.alpha_color_2; + options->fullscreen.screen = c_options->fullscreen.screen; options->fullscreen.clean_flip = c_options->fullscreen.clean_flip; options->fullscreen.disable_saver = c_options->fullscreen.disable_saver; @@ -1548,6 +1551,17 @@ pref_color_button_new(group, _("Border color"), &options->image.border_color, G_CALLBACK(pref_color_button_set_cb), &c_options->image.border_color); + c_options->image.border_color = options->image.border_color; + + pref_color_button_new(group, _("Alpha channel color 1"), &options->image.alpha_color_1, + G_CALLBACK(pref_color_button_set_cb), &c_options->image.alpha_color_1); + + pref_color_button_new(group, _("Alpha channel color 2"), &options->image.alpha_color_2, + G_CALLBACK(pref_color_button_set_cb), &c_options->image.alpha_color_2); + + c_options->image.alpha_color_1 = options->image.alpha_color_1; + c_options->image.alpha_color_2 = options->image.alpha_color_2; + group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Auto rotate proofs using Exif information"),
--- a/src/rcfile.c Fri Mar 17 11:07:16 2017 +0000 +++ b/src/rcfile.c Tue Mar 21 17:28:55 2017 +0000 @@ -366,6 +366,8 @@ WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color); WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color_in_fullscreen); WRITE_NL(); WRITE_COLOR(*options, image.border_color); + WRITE_NL(); WRITE_COLOR(*options, image.alpha_color_1); + WRITE_NL(); WRITE_COLOR(*options, image.alpha_color_2); WRITE_NL(); WRITE_BOOL(*options, image.use_clutter_renderer); /* Thumbnails Options */ @@ -640,6 +642,8 @@ if (READ_BOOL(*options, image.use_custom_border_color)) continue; if (READ_BOOL(*options, image.use_custom_border_color_in_fullscreen)) continue; if (READ_COLOR(*options, image.border_color)) continue; + if (READ_COLOR(*options, image.alpha_color_1)) continue; + if (READ_COLOR(*options, image.alpha_color_2)) continue; if (READ_BOOL(*options, image.use_clutter_renderer)) continue; /* Thumbnails options */
--- a/src/renderer-tiles.c Fri Mar 17 11:07:16 2017 +0000 +++ b/src/renderer-tiles.c Tue Mar 21 17:28:55 2017 +0000 @@ -1272,7 +1272,13 @@ scale_x, scale_y, interp_type, 255, check_x, check_y, - PR_ALPHA_CHECK_SIZE, PR_ALPHA_CHECK1, PR_ALPHA_CHECK2); + PR_ALPHA_CHECK_SIZE, + ((options->image.alpha_color_1.red << 8 & 0x00FF0000) + + (options->image.alpha_color_1.green & 0x00FF00) + + (options->image.alpha_color_1.blue >> 8 & 0x00FF)), + ((options->image.alpha_color_2.red << 8 & 0x00FF0000) + + (options->image.alpha_color_2.green & 0x00FF00) + + (options->image.alpha_color_2.blue >> 8 & 0x00FF))); } }