aboutsummaryrefslogtreecommitdiffstats
path: root/config.def.h
diff options
context:
space:
mode:
authorBerke Kocaoğlu <kberke@metu.edu.tr>2022-12-22 12:21:40 +0100
committerNRK <nrk@disroot.org>2022-12-22 12:21:40 +0100
commit95bc9b463b87236d30d86626e1052e6979d6510f (patch)
treec3de438755c7ed7ff8e6cfdf5dae4359f28c364e /config.def.h
parent9cb9a54944e8ad9a42b3113286cb51bceae4b2d0 (diff)
downloadnsxiv-95bc9b463b87236d30d86626e1052e6979d6510f.tar.zst
add brightness and contrast (#396)
* Imlib2 supports modifying gamma, brightness and contrast directly while sxiv only supports gamma. Makes sense to extend it to brightness and contrast as well. * Since color corrections need to be aware of each other, they have been refactored into one centralized function. * This also makes the code more hackable as it makes it easier to add more color correction functions without them interfering with each other. Co-authored-by: 0ion9 <finticemo@gmail.com> Co-authored-by: NRK <nrk@disroot.org> Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/396 Reviewed-by: NRK <nrk@disroot.org> Reviewed-by: TAAPArthur <taaparthur@noreply.codeberg.org> Co-authored-by: Berke Kocaoğlu <kberke@metu.edu.tr> Co-committed-by: Berke Kocaoğlu <kberke@metu.edu.tr>
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/config.def.h b/config.def.h
index 00f1f22..198c696 100644
--- a/config.def.h
+++ b/config.def.h
@@ -33,11 +33,14 @@ static const float zoom_levels[] = {
/* default slideshow delay (in sec, overwritten via -S option): */
static const int SLIDESHOW_DELAY = 5;
-/* gamma correction: the user-visible ranges [-GAMMA_RANGE, 0] and
- * (0, GAMMA_RANGE] are mapped to the ranges [0, 1], and (1, GAMMA_MAX].
+/* color correction: the user-visible ranges [-CC_STEPS, 0] and
+ * (0, CC_STEPS] are mapped to the ranges [0, 1], and (1, *_MAX].
+ * Higher step count will have higher granulairy.
*/
-static const double GAMMA_MAX = 10.0;
-static const int GAMMA_RANGE = 32;
+static const int CC_STEPS = 32;
+static const double GAMMA_MAX = 10.0;
+static const double BRIGHTNESS_MAX = 2.0;
+static const double CONTRAST_MAX = 4.0;
/* command i_scroll pans image 1/PAN_FRACTION of screen width/height */
static const int PAN_FRACTION = 5;
@@ -118,6 +121,10 @@ static const keymap_t keys[] = {
{ 0, XK_braceleft, g_change_gamma, -1 },
{ 0, XK_braceright, g_change_gamma, +1 },
{ ControlMask, XK_g, g_change_gamma, 0 },
+ { ControlMask, XK_bracketright, g_change_brightness, +1 },
+ { ControlMask, XK_bracketleft, g_change_brightness, -1 },
+ { 0, XK_parenleft, g_change_contrast, -1 },
+ { 0, XK_parenright, g_change_contrast, +1 },
{ 0, XK_h, t_move_sel, DIR_LEFT },
{ 0, XK_Left, t_move_sel, DIR_LEFT },