Author: akv
Date: 2009-12-29 16:50:20 +0100 (Tue, 29 Dec 2009)
New Revision: 2877

Modified:
   branches/rawstudio-ng-color/librawstudio/rs-utils.c
   branches/rawstudio-ng-color/librawstudio/rs-utils.h
Log:
Added rs_human_aperture() and rs_human_focal() for generating human readable 
focallength and aperture.

Modified: branches/rawstudio-ng-color/librawstudio/rs-utils.c
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-utils.c 2009-12-28 19:43:59 UTC 
(rev 2876)
+++ branches/rawstudio-ng-color/librawstudio/rs-utils.c 2009-12-29 15:50:20 UTC 
(rev 2877)
@@ -627,3 +627,26 @@
 
        return (gchar *) rs_md5(buffer);
 }
+
+const gchar *
+rs_human_aperture(gdouble aperture)
+{
+       gchar *ret = NULL;
+
+       if (aperture < 8)
+               ret = g_strdup_printf("f/%.1f", aperture);
+       else
+               ret = g_strdup_printf("f/%.0f", aperture);
+}
+
+const gchar *
+rs_human_focal(gdouble min, gdouble max)
+{
+       gchar *ret = NULL;
+
+       if (min == max)
+               ret = g_strdup_printf("%.0fmm", max);
+       else
+               ret = g_strdup_printf("%.0f-%.0fmm", min, max);
+       return ret;
+}

Modified: branches/rawstudio-ng-color/librawstudio/rs-utils.h
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-utils.h 2009-12-28 19:43:59 UTC 
(rev 2876)
+++ branches/rawstudio-ng-color/librawstudio/rs-utils.h 2009-12-29 15:50:20 UTC 
(rev 2877)
@@ -163,4 +163,7 @@
 
 gchar * rs_file_checksum(const gchar *photo);
 
+const gchar * rs_human_aperture(gdouble aperture);
+const gchar * rs_human_focal(gdouble min, gdouble max);
+
 #endif /* RS_UTILS_H */


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to