1 /* 2 * * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>, 3 * * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef RS_SETTINGS_H 21 #define RS_SETTINGS_H 22 23 #include <glib-object.h> 24 25 G_BEGIN_DECLS 26 27 #define RS_TYPE_SETTINGS rs_settings_get_type() 28 29 #define RS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_SETTINGS, RSSettings)) 30 #define RS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RS_TYPE_SETTINGS, RSSettingsClass)) 31 #define RS_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RS_TYPE_SETTINGS)) 32 #define RS_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RS_TYPE_SETTINGS)) 33 #define RS_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RS_TYPE_SETTINGS, RSSettingsClass)) 34 35 /* Presets for WB */ 36 #define PRESET_WB_AUTO "wb_auto" 37 #define PRESET_WB_CAMERA "wb_camera" 38 39 typedef enum { 40 MASK_EXPOSURE = (1<<0), 41 MASK_SATURATION = (1<<1), 42 MASK_HUE = (1<<2), 43 MASK_CONTRAST = (1<<3), 44 MASK_WARMTH = (1<<4), 45 MASK_TINT = (1<<5), 46 MASK_DCP_TEMP = (1<<4), 47 MASK_DCP_TINT = (1<<5), 48 MASK_WB = MASK_WARMTH | MASK_TINT | MASK_DCP_TEMP | MASK_DCP_TINT, 49 MASK_CURVE = (1<<6), 50 MASK_SHARPEN = (1<<7), 51 MASK_DENOISE_LUMA = (1<<8), 52 MASK_DENOISE_CHROMA = (1<<9), 53 MASK_TCA_KR = (1<<10), 54 MASK_TCA_KB = (1<<11), 55 MASK_TCA = MASK_TCA_KR | MASK_TCA_KB, 56 MASK_CHANNELMIXER_RED = (1<<12), 57 MASK_CHANNELMIXER_GREEN = (1<<13), 58 MASK_CHANNELMIXER_BLUE = (1<<14), 59 MASK_CHANNELMIXER = MASK_CHANNELMIXER_RED | MASK_CHANNELMIXER_GREEN | MASK_CHANNELMIXER_BLUE, 60 MASK_VIGNETTING = (1<<15), 61 MASK_PROFILE = (1<<16), 62 MASK_ALL = 0x00ffffff, 63 } RSSettingsMask; 64 65 typedef struct _RSsettings { 66 GObject parent; 67 gint commit; 68 RSSettingsMask commit_todo; 69 gfloat exposure; 70 gfloat saturation; 71 gfloat hue; 72 gfloat contrast; 73 gfloat warmth; 74 gfloat tint; 75 gfloat dcp_temp; 76 gfloat dcp_tint; 77 gchar *wb_ascii; 78 gfloat sharpen; 79 gfloat denoise_luma; 80 gfloat denoise_chroma; 81 gfloat tca_kr; 82 gfloat tca_kb; 83 gfloat vignetting; 84 gfloat channelmixer_red; 85 gfloat channelmixer_green; 86 gfloat channelmixer_blue; 87 gint curve_nknots; 88 gfloat *curve_knots; 89 gboolean recalc_temp; 90 } RSSettings; 91 92 typedef struct { 93 GObjectClass parent_class; 94 } RSSettingsClass; 95 96 GType rs_settings_get_type (void); 97 98 RSSettings *rs_settings_new (void); 99 100 /** 101 * Reset a RSSettings 102 * @param settings A RSSettings 103 * @param mask A mask for only resetting some values 104 */ 105 extern void rs_settings_reset(RSSettings *settings, const RSSettingsMask mask); 106 107 /** 108 * Stop signal emission from a RSSettings and queue up signals 109 * @param settings A RSSettings 110 */ 111 extern void rs_settings_commit_start(RSSettings *settings); 112 113 /** 114 * Restart signal emission and process signal queue if any 115 * @param settings A RSSettings 116 * @return The mask of changes since rs_settings_commit_start() 117 */ 118 extern RSSettingsMask rs_settings_commit_stop(RSSettings *settings); 119 120 /** 121 * Copy settings from one RSSettins to another 122 * @param source The source RSSettings 123 * @param mask A RSSettingsMask to do selective copying 124 * @param target The target RSSettings 125 */ 126 extern RSSettingsMask rs_settings_copy(RSSettings *source, const RSSettingsMask mask, RSSettings *target); 127 128 /** 129 * Set curve knots 130 * @param settings A RSSettings 131 * @param knots Knots for curve 132 * @param nknots Number of knots 133 */ 134 extern void rs_settings_set_curve_knots(RSSettings *settings, const gfloat *knots, const gint nknots); 135 136 /** 137 * Set the warmth and tint values of a RSSettings 138 * @param settings A RSSettings 139 * @param exposure New value 140 */ 141 extern void rs_settings_set_wb(RSSettings *settings, const gfloat warmth, const gfloat tint, const gchar *ascii); 142 143 /** 144 * Get the knots from the curve 145 * @param settings A RSSettings 146 * @return All knots as a newly allocated array 147 */ 148 extern gfloat * 149 rs_settings_get_curve_knots(RSSettings *settings); 150 151 /** 152 * Get number of knots in curve in a RSSettings 153 * @param settings A RSSettings 154 * @return Number of knots 155 */ 156 extern gint 157 rs_settings_get_curve_nknots(RSSettings *settings); 158 159 /** 160 * Use like g_signal_connect(source, "settings-changed", G_CALLBACK(rs_settings_changed), target); 161 */ 162 extern void rs_settings_changed(RSSettings *source, const RSSettingsMask mask, RSSettings *target); 163 164 /** 165 * Link two RSSettings together, if source gets updated, it will propagate to target 166 * @param source A RSSettings 167 * @param target A RSSettings 168 */ 169 extern void rs_settings_link(RSSettings *source, RSSettings *target); 170 171 /** 172 * Unlink two RSSettings - this will be done automaticly if target from a previous rs_settings_link() is finalized 173 * @param source A RSSettings 174 * @param target A RSSettings - can be destroyed, doesn't matter, we just need the pointer 175 */ 176 extern void rs_settings_unlink(RSSettings *source, RSSettings *target); 177 178 G_END_DECLS 179 180 #endif /* RS_SETTINGS_H */ 181