summaryrefslogtreecommitdiff
path: root/src/eom-image.h
blob: 3e503db16e5c39159bccc6a34fc49101953417ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/* Eye Of Mate - Image
 *
 * Copyright (C) 2007 The Free Software Foundation
 *
 * Author: Lucas Rocha <lucasr@gnome.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef __EOM_IMAGE_H__
#define __EOM_IMAGE_H__

#include "eom-jobs.h"
#include "eom-window.h"
#include "eom-transform.h"
#include "eom-image-save-info.h"
#include "eom-enums.h"

#include <glib.h>
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

#ifdef HAVE_EXIF
#include <libexif/exif-data.h>
#include "eom-exif-util.h"
#endif

#ifdef HAVE_LCMS
#include <lcms2.h>
#endif

#ifdef HAVE_EXEMPI
#include <exempi/xmp.h>
#endif

#ifdef HAVE_RSVG
#include <librsvg/rsvg.h>
#endif

G_BEGIN_DECLS

#ifndef __EOM_IMAGE_DECLR__
#define __EOM_IMAGE_DECLR__
typedef struct _EomImage EomImage;
#endif
typedef struct _EomImageClass EomImageClass;
typedef struct _EomImagePrivate EomImagePrivate;

#define EOM_TYPE_IMAGE            (eom_image_get_type ())
#define EOM_IMAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_IMAGE, EomImage))
#define EOM_IMAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_IMAGE, EomImageClass))
#define EOM_IS_IMAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_IMAGE))
#define EOM_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  EOM_TYPE_IMAGE))
#define EOM_IMAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  EOM_TYPE_IMAGE, EomImageClass))

typedef enum {
	EOM_IMAGE_ERROR_SAVE_NOT_LOCAL,
	EOM_IMAGE_ERROR_NOT_LOADED,
	EOM_IMAGE_ERROR_VFS,
	EOM_IMAGE_ERROR_FILE_EXISTS,
	EOM_IMAGE_ERROR_TMP_FILE_FAILED,
	EOM_IMAGE_ERROR_GENERIC,
	EOM_IMAGE_ERROR_UNKNOWN
} EomImageError;

#define EOM_IMAGE_ERROR eom_image_error_quark ()

typedef enum {
	EOM_IMAGE_STATUS_UNKNOWN,
	EOM_IMAGE_STATUS_LOADING,
	EOM_IMAGE_STATUS_LOADED,
	EOM_IMAGE_STATUS_SAVING,
	EOM_IMAGE_STATUS_FAILED
} EomImageStatus;

typedef enum {
  EOM_IMAGE_METADATA_NOT_READ,
  EOM_IMAGE_METADATA_NOT_AVAILABLE,
  EOM_IMAGE_METADATA_READY
} EomImageMetadataStatus;

struct _EomImage {
	GObject parent;

	EomImagePrivate *priv;
};

struct _EomImageClass {
	GObjectClass parent_class;

	void (* changed) 	   (EomImage *img);

	void (* size_prepared)     (EomImage *img,
				    int       width,
				    int       height);

	void (* thumbnail_changed) (EomImage *img);

	void (* save_progress)     (EomImage *img,
				    gfloat    progress);

	void (* next_frame)        (EomImage *img,
				    gint delay);

	void (* file_changed)      (EomImage *img);
};

GType	          eom_image_get_type	             (void) G_GNUC_CONST;

GQuark            eom_image_error_quark              (void);

EomImage         *eom_image_new                      (const char *txt_uri);

EomImage         *eom_image_new_file                 (GFile *file);

gboolean          eom_image_load                     (EomImage   *img,
					              EomImageData data2read,
					              EomJob     *job,
					              GError    **error);

void              eom_image_cancel_load              (EomImage   *img);

gboolean          eom_image_has_data                 (EomImage   *img,
					              EomImageData data);

void              eom_image_data_ref                 (EomImage   *img);

void              eom_image_data_unref               (EomImage   *img);

void              eom_image_set_thumbnail            (EomImage   *img,
					              GdkPixbuf  *pixbuf);

gboolean          eom_image_save_as_by_info          (EomImage   *img,
		      			              EomImageSaveInfo *source,
		      			              EomImageSaveInfo *target,
		      			              GError    **error);

gboolean          eom_image_save_by_info             (EomImage   *img,
					              EomImageSaveInfo *source,
					              GError    **error);

GdkPixbuf*        eom_image_get_pixbuf               (EomImage   *img);

GdkPixbuf*        eom_image_get_thumbnail            (EomImage   *img);

void              eom_image_get_size                 (EomImage   *img,
					              gint       *width,
					              gint       *height);

goffset           eom_image_get_bytes                (EomImage   *img);

gboolean          eom_image_is_modified              (EomImage   *img);

void              eom_image_modified                 (EomImage   *img);

const gchar*      eom_image_get_caption              (EomImage   *img);

const gchar      *eom_image_get_collate_key          (EomImage   *img);

#if HAVE_EXIF
ExifData*         eom_image_get_exif_info            (EomImage   *img);
#endif

gpointer          eom_image_get_xmp_info             (EomImage   *img);

GFile*            eom_image_get_file                 (EomImage   *img);

gchar*            eom_image_get_uri_for_display      (EomImage   *img);

EomImageStatus    eom_image_get_status               (EomImage   *img);

EomImageMetadataStatus eom_image_get_metadata_status (EomImage   *img);

void              eom_image_transform                (EomImage   *img,
						      EomTransform *trans,
						      EomJob     *job);

#ifdef HAVE_EXIF
void              eom_image_autorotate               (EomImage   *img);
#endif

#ifdef HAVE_LCMS
cmsHPROFILE       eom_image_get_profile              (EomImage    *img);

void              eom_image_apply_display_profile    (EomImage    *img,
						      cmsHPROFILE  display_profile);
#endif

void              eom_image_undo                     (EomImage   *img);

GList		 *eom_image_get_supported_mime_types (void);

gboolean          eom_image_is_supported_mime_type   (const char *mime_type);

gboolean          eom_image_is_animation             (EomImage *img);

gboolean          eom_image_start_animation          (EomImage *img);

#ifdef HAVE_RSVG
gboolean          eom_image_is_svg                   (EomImage *img);
RsvgHandle       *eom_image_get_svg                  (EomImage *img);
EomTransform     *eom_image_get_transform            (EomImage *img);
#endif

void              eom_image_file_changed             (EomImage *img);
gboolean          eom_image_is_file_changed         (EomImage *img);

G_END_DECLS

#endif /* __EOM_IMAGE_H__ */