Mercurial > geeqie
annotate src/exif.h @ 122:e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
* image-overlay.[ch]: More work on osd icons.
* image.c: Use correct flag when setting auto rotation state, and set
the state again after the rotation so that osd can update.
* img-view.c: Show osd icon when overlay is enabled.
* layout.c, layout_image.[ch]: Enable overlay regardless of the
full screen state, only difference now is that image description text
is only shown when in full screen but icons will always appear.
* layout_util.c: Make I key toggle overlay from windowed mode too.
* typedefs.h (LayoutWindow): Remove no longer used
full_screen_overlay_on.
author | gqview |
---|---|
date | Sat, 02 Dec 2006 21:57:12 +0000 |
parents | 50fc73e08550 |
children | 71e1ebee420e |
rev | line source |
---|---|
9 | 1 /* |
2 * GQView | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
110
diff
changeset
|
3 * (C) 2006 John Ellis |
9 | 4 * |
5 * Authors: | |
6 * Support for Exif file format, originally written by Eric Swalens. | |
7 * Modified by Quy Tonthat | |
8 * Reimplemented with generic data storage by John Ellis | |
9 * | |
10 | |
11 This program is free software; you can redistribute it and/or modify | |
12 it under the terms of the GNU General Public License as published by | |
13 the Free Software Foundation; either version 2 of the License, or | |
14 (at your option) any later version. | |
15 | |
16 This program is distributed in the hope that it will be useful, | |
17 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 GNU General Public License for more details. | |
20 | |
21 You should have received a copy of the GNU General Public License | |
22 along with this program; if not, write to the Free Software | |
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 */ | |
25 | |
26 #ifndef __EXIF_H | |
27 #define __EXIF_H | |
28 | |
29 | |
30 /* | |
31 *----------------------------------------------------------------------------- | |
32 * Tag formats | |
33 *----------------------------------------------------------------------------- | |
34 */ | |
35 | |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
36 #define EXIF_FORMAT_COUNT 13 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
37 |
9 | 38 typedef enum { |
39 EXIF_FORMAT_UNKNOWN = 0, | |
40 EXIF_FORMAT_BYTE_UNSIGNED = 1, | |
41 EXIF_FORMAT_STRING = 2, | |
42 EXIF_FORMAT_SHORT_UNSIGNED = 3, | |
43 EXIF_FORMAT_LONG_UNSIGNED = 4, | |
44 EXIF_FORMAT_RATIONAL_UNSIGNED = 5, | |
45 EXIF_FORMAT_BYTE = 6, | |
46 EXIF_FORMAT_UNDEFINED = 7, | |
47 EXIF_FORMAT_SHORT = 8, | |
48 EXIF_FORMAT_LONG = 9, | |
49 EXIF_FORMAT_RATIONAL = 10, | |
50 EXIF_FORMAT_FLOAT = 11, | |
51 EXIF_FORMAT_DOUBLE = 12 | |
52 } ExifFormatType; | |
53 | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
54 typedef enum { |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
55 EXIF_BYTE_ORDER_INTEL, |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
56 EXIF_BYTE_ORDER_MOTOROLA |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
57 } ExifByteOrder; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
58 |
9 | 59 typedef struct _ExifFormatAttrib ExifFormatAttrib; |
60 struct _ExifFormatAttrib | |
61 { | |
62 ExifFormatType type; | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
63 guint size; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
64 const gchar *short_name; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
65 const gchar *description; |
9 | 66 }; |
67 | |
68 /* the list of known tag data formats */ | |
69 extern ExifFormatAttrib ExifFormatList[]; | |
70 | |
71 | |
72 /* | |
73 *----------------------------------------------------------------------------- | |
74 * Data storage | |
75 *----------------------------------------------------------------------------- | |
76 */ | |
77 | |
78 typedef struct _ExifData ExifData; | |
79 struct _ExifData | |
80 { | |
81 GList *items; /* list of (ExifItem *) */ | |
82 }; | |
83 | |
84 typedef struct _ExifRational ExifRational; | |
85 struct _ExifRational | |
86 { | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
87 guint32 num; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
88 guint32 den; |
9 | 89 }; |
90 | |
91 | |
92 typedef struct _ExifItem ExifItem; | |
93 typedef struct _ExifMarker ExifMarker; | |
94 typedef struct _ExifTextList ExifTextList; | |
95 | |
96 struct _ExifItem | |
97 { | |
98 ExifFormatType format; | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
99 guint tag; |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
100 const ExifMarker *marker; |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
101 guint elements; |
9 | 102 gpointer data; |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
103 guint data_len; |
9 | 104 }; |
105 | |
106 struct _ExifMarker | |
107 { | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
108 guint tag; |
9 | 109 ExifFormatType format; |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
110 gint components; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
111 gchar *key; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
112 gchar *description; |
9 | 113 ExifTextList *list; |
114 }; | |
115 | |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
116 #define EXIF_MARKER_LIST_END { 0x0000, EXIF_FORMAT_UNKNOWN, 0, NULL, NULL, NULL } |
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
117 |
9 | 118 struct _ExifTextList |
119 { | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
120 gint value; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
121 const gchar* description; |
9 | 122 }; |
123 | |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
124 #define EXIF_TEXT_LIST_END { -1, NULL } |
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
125 |
9 | 126 |
127 typedef struct _ExifFormattedText ExifFormattedText; | |
128 struct _ExifFormattedText | |
129 { | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
130 const gchar *key; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
131 const gchar *description; |
9 | 132 }; |
133 | |
134 | |
135 /* | |
136 *----------------------------------------------------------------------------- | |
137 * Data | |
138 *----------------------------------------------------------------------------- | |
139 */ | |
140 | |
141 /* enums useful for image manipulation */ | |
142 | |
143 typedef enum { | |
144 EXIF_ORIENTATION_UNKNOWN = 0, | |
145 EXIF_ORIENTATION_TOP_LEFT = 1, | |
146 EXIF_ORIENTATION_TOP_RIGHT = 2, | |
147 EXIF_ORIENTATION_BOTTOM_RIGHT = 3, | |
148 EXIF_ORIENTATION_BOTTOM_LEFT = 4, | |
149 EXIF_ORIENTATION_LEFT_TOP = 5, | |
150 EXIF_ORIENTATION_RIGHT_TOP = 6, | |
151 EXIF_ORIENTATION_RIGHT_BOTTOM = 7, | |
152 EXIF_ORIENTATION_LEFT_BOTTOM = 8 | |
153 } ExifOrientationType; | |
154 | |
155 typedef enum { | |
156 EXIF_UNIT_UNKNOWN = 0, | |
157 EXIF_UNIT_NOUNIT = 1, | |
158 EXIF_UNIT_INCH = 2, | |
159 EXIF_UNIT_CENTIMETER = 3 | |
160 } ExifUnitType; | |
161 | |
162 | |
163 /* the known exif tags list */ | |
164 extern ExifMarker ExifKnownMarkersList[]; | |
165 | |
166 /* the unknown tags utilize this generic list */ | |
167 extern ExifMarker ExifUnknownMarkersList[]; | |
168 | |
169 /* the list of specially formatted keys, for human readable output */ | |
170 extern ExifFormattedText ExifFormattedList[]; | |
171 | |
172 | |
173 /* | |
174 *----------------------------------------------------------------------------- | |
175 * functions | |
176 *----------------------------------------------------------------------------- | |
177 */ | |
178 | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
110
diff
changeset
|
179 ExifData *exif_read(const gchar *path, gint parse_color_profile); |
9 | 180 void exif_free(ExifData *exif); |
181 | |
182 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key); | |
183 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value); | |
184 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign); | |
185 double exif_rational_to_double(ExifRational *r, gint sign); | |
186 | |
187 ExifItem *exif_get_item(ExifData *exif, const gchar *key); | |
188 | |
189 const char *exif_item_get_tag_name(ExifItem *item); | |
190 const char *exif_item_get_description(ExifItem *item); | |
191 const char *exif_item_get_format_name(ExifItem *item, gint brief); | |
192 gchar *exif_item_get_data_as_text(ExifItem *item); | |
193 gint exif_item_get_integer(ExifItem *item, gint *value); | |
194 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign); | |
195 | |
196 const gchar *exif_get_description_by_key(const gchar *key); | |
197 | |
198 /* usually for debugging to stdout */ | |
199 void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list); | |
200 | |
201 | |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
202 |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
203 /* These funcs for use by makernote/tiff parsers only */ |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
204 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
205 #define EXIF_TIFF_MAX_LEVELS 4 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
206 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
207 #define EXIF_TIFD_OFFSET_TAG 0 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
208 #define EXIF_TIFD_OFFSET_FORMAT 2 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
209 #define EXIF_TIFD_OFFSET_COUNT 4 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
210 #define EXIF_TIFD_OFFSET_DATA 8 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
211 #define EXIF_TIFD_SIZE 12 |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
212 |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
213 |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
214 guint16 exif_byte_get_int16(unsigned char *f, ExifByteOrder bo); |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
215 guint32 exif_byte_get_int32(unsigned char *f, ExifByteOrder bo); |
110
9fbf210edc6f
Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents:
106
diff
changeset
|
216 void exif_byte_put_int16(unsigned char *f, guint16 n, ExifByteOrder bo); |
9fbf210edc6f
Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents:
106
diff
changeset
|
217 void exif_byte_put_int32(unsigned char *f, guint32 n, ExifByteOrder bo); |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
218 |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
219 ExifItem *exif_item_new(ExifFormatType format, guint tag, |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
220 guint elements, const ExifMarker *marker); |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
221 void exif_item_copy_data(ExifItem *item, void *src, guint len, |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
222 ExifFormatType src_format, ExifByteOrder bo); |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
223 |
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
224 gint exif_parse_IFD_table(ExifData *exif, |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
225 unsigned char *tiff, guint offset, |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
226 guint size, ExifByteOrder bo, |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
227 gint level, |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
228 const ExifMarker *list); |
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
229 |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
230 gint exif_tiff_directory_offset(unsigned char *data, const guint len, |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
231 guint *offset, ExifByteOrder *bo); |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
232 gint exif_tiff_parse(ExifData *exif, unsigned char *tiff, guint size, ExifMarker *list); |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
233 |
57
a8c9992320f4
Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents:
54
diff
changeset
|
234 gchar *exif_text_list_find_value(ExifTextList *list, guint value); |
a8c9992320f4
Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents:
54
diff
changeset
|
235 |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
236 |
9 | 237 #endif |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
238 |