[Rawstudio-commit] r2074 - trunk/src
Anders Brander
anders at brander.dk
Wed Oct 15 05:40:44 CEST 2008
Author: abrander
Date: 2008-10-15 05:40:44 +0200 (Wed, 15 Oct 2008)
New Revision: 2074
Modified:
trunk/src/rs-photo.c
trunk/src/rs-photo.h
Log:
Added some missing getters.
Modified: trunk/src/rs-photo.c
===================================================================
--- trunk/src/rs-photo.c 2008-10-15 03:39:27 UTC (rev 2073)
+++ trunk/src/rs-photo.c 2008-10-15 03:40:44 UTC (rev 2074)
@@ -253,24 +253,44 @@
return photo->angle;
}
+/* Macro to create functions for getting single parameters */
+#define RS_PHOTO_GET_GDOUBLE_VALUE(setting) \
+gdouble \
+rs_photo_get_##setting(RS_PHOTO *photo, const gint snapshot) \
+{ \
+ g_assert (RS_IS_PHOTO(photo)); \
+ g_assert ((snapshot>=0) && (snapshot<=2)); \
+ return photo->settings[snapshot]->setting; \
+}
+
+RS_PHOTO_GET_GDOUBLE_VALUE(exposure)
+RS_PHOTO_GET_GDOUBLE_VALUE(saturation)
+RS_PHOTO_GET_GDOUBLE_VALUE(hue)
+RS_PHOTO_GET_GDOUBLE_VALUE(contrast)
+RS_PHOTO_GET_GDOUBLE_VALUE(warmth)
+RS_PHOTO_GET_GDOUBLE_VALUE(tint)
+RS_PHOTO_GET_GDOUBLE_VALUE(sharpen)
+
+#undef RS_PHOTO_GET_GDOUBLE_VALUE
+
/* Macro to create functions for changing single parameters */
-#define RS_PHOTO_SET_GDOUBLE_VALUE(setting) \
+#define RS_PHOTO_SET_GDOUBLE_VALUE(setting, uppersetting) \
void \
rs_photo_set_##setting(RS_PHOTO *photo, const gint snapshot, const gdouble value) \
{ \
- if (!photo) return; \
- g_return_if_fail ((snapshot>=0) && (snapshot<=2)); \
+ /*if (!photo) return;*/ \
+ /*g_return_if_fail ((snapshot>=0) && (snapshot<=2));*/ \
photo->settings[snapshot]->setting = value; \
- g_signal_emit(photo, signals[SETTINGS_CHANGED], 0, MASK_ALL|(snapshot<<24)); \
+ g_signal_emit(photo, signals[SETTINGS_CHANGED], 0, MASK_##uppersetting|(snapshot<<24)); \
}
-RS_PHOTO_SET_GDOUBLE_VALUE(exposure)
-RS_PHOTO_SET_GDOUBLE_VALUE(saturation)
-RS_PHOTO_SET_GDOUBLE_VALUE(hue)
-RS_PHOTO_SET_GDOUBLE_VALUE(contrast)
-RS_PHOTO_SET_GDOUBLE_VALUE(warmth)
-RS_PHOTO_SET_GDOUBLE_VALUE(tint)
-RS_PHOTO_SET_GDOUBLE_VALUE(sharpen)
+RS_PHOTO_SET_GDOUBLE_VALUE(exposure, EXPOSURE)
+RS_PHOTO_SET_GDOUBLE_VALUE(saturation, SATURATION)
+RS_PHOTO_SET_GDOUBLE_VALUE(hue, HUE)
+RS_PHOTO_SET_GDOUBLE_VALUE(contrast, CONTRAST)
+RS_PHOTO_SET_GDOUBLE_VALUE(warmth, WARMTH)
+RS_PHOTO_SET_GDOUBLE_VALUE(tint, TINT)
+RS_PHOTO_SET_GDOUBLE_VALUE(sharpen, SHARPEN)
#undef RS_PHOTO_SET_GDOUBLE_VALUE
@@ -387,7 +407,7 @@
tint = (buf[B] + buf[R] - 4.0)/-2.0;
warmth = (buf[R]/(2.0-tint))-1.0;
- rs_photo_set_wb_from_wt(photo, snapshot, warmth, tint);
+ rs_settings_set_wb(photo->settings[snapshot], warmth, tint);
}
/**
Modified: trunk/src/rs-photo.h
===================================================================
--- trunk/src/rs-photo.h 2008-10-15 03:39:27 UTC (rev 2073)
+++ trunk/src/rs-photo.h 2008-10-15 03:40:44 UTC (rev 2074)
@@ -92,6 +92,62 @@
extern gdouble rs_photo_get_angle(RS_PHOTO *photo);
/**
+ * Get the exposure of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_exposure(RS_PHOTO *photo, const gint snapshot);
+
+/**
+ * Get the saturation of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_saturation(RS_PHOTO *photo, const gint snapshot);
+
+/**
+ * Get the hue of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_hue(RS_PHOTO *photo, const gint snapshot);
+
+/**
+ * Get the contrast of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_contrast(RS_PHOTO *photo, const gint snapshot);
+
+/**
+ * Get the warmth of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_warmth(RS_PHOTO *photo, const gint snapshot);
+
+/**
+ * Get the tint of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_tint(RS_PHOTO *photo, const gint snapshot);
+
+/**
+ * Get the sharpen of a RS_PHOTO
+ * @param photo A RS_PHOTO
+ * @param snapshot A snapshot
+ * @return The current value
+ */
+extern gdouble rs_photo_get_sharpen(RS_PHOTO *photo, const gint snapshot);
+
+/**
* Set the exposure of a RS_PHOTO
* @param photo A RS_PHOTO
* @param snapshot Which snapshot to affect
More information about the Rawstudio-commit
mailing list