~ubuntu-branches/ubuntu/trusty/rawstudio/trusty-proposed

« back to all changes in this revision

Viewing changes to src/rs-utils.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-10-18 17:58:00 UTC
  • mfrom: (2.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081018175800-r1s7ke1xwy9wxv5b
Tags: 1.1.1-1
MergingĀ upstreamĀ versionĀ 1.1.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2006-2008 Anders Brander <anders@brander.dk> and 
 
3
 * Anders Kvist <akv@lnxbx.dk>
 
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_UTILS_H
 
21
#define RS_UTILS_H
 
22
 
 
23
#include <glib.h>
 
24
 
 
25
/**
 
26
 * A version of atof() that isn't locale specific
 
27
 * @note This doesn't do any error checking!
 
28
 * @param str A NULL terminated string representing a number
 
29
 * @return The number represented by str or 0.0 if str is NULL
 
30
 */
 
31
extern gdouble rs_atof(const gchar *str);
 
32
 
 
33
/**
 
34
 * A convenience function to convert an EXIF timestamp to a unix timestamp.
 
35
 * @note This will only work until 2038 unless glib fixes its GTime
 
36
 * @param str A NULL terminated string containing a timestamp in the format "YYYY:MM:DD HH:MM:SS" (EXIF 2.2 section 4.6.4)
 
37
 * @return A unix timestamp or -1 on error
 
38
 */
 
39
GTime
 
40
rs_exiftime_to_unixtime(const gchar *str);
 
41
 
 
42
/**
 
43
 * A convenience function to convert an unix timestamp to an EXIF timestamp.
 
44
 * @note This will only work until 2038 unless glib fixes its GTime
 
45
 * @param timestamp A unix timestamp
 
46
 * @return A string formatted as specified in EXIF 2.2 section 4.6.4
 
47
 */
 
48
gchar *
 
49
rs_unixtime_to_exiftime(GTime timestamp);
 
50
 
 
51
/**
 
52
 * Constrains a box to fill a bounding box without changing aspect
 
53
 * @param target_width The width of the bounding box
 
54
 * @param target_height The height of the bounding box
 
55
 * @param width The input and output width
 
56
 * @param height The input and output height
 
57
 */
 
58
extern void
 
59
rs_constrain_to_bounding_box(gint target_width, gint target_height, gint *width, gint *height);
 
60
 
 
61
/**
 
62
 * Try to count the number of processor cores in a system.
 
63
 * @note This currently only works for systems with /proc/cpuinfo
 
64
 * @return The numver of cores or 1 if the system is unsupported
 
65
 */
 
66
extern gint
 
67
rs_get_number_of_processor_cores();
 
68
 
 
69
#endif /* RS_UTILS_H */