1 /* Eye Of Gnome - Image
2  *
3  * Copyright (C) 2007 The Free Software Foundation
4  *
5  * Author: Lucas Rocha <lucasr@gnome.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20  */
21 
22 #ifndef __EOG_IMAGE_H__
23 #define __EOG_IMAGE_H__
24 
25 #include "eog-jobs.h"
26 #include "eog-window.h"
27 #include "eog-transform.h"
28 #include "eog-image-save-info.h"
29 #include "eog-enums.h"
30 
31 #include <glib.h>
32 #include <glib-object.h>
33 #include <gdk-pixbuf/gdk-pixbuf.h>
34 
35 #ifdef HAVE_EXIF
36 #include <libexif/exif-data.h>
37 #include "eog-exif-util.h"
38 #endif
39 
40 #ifdef HAVE_LCMS
41 #include <lcms2.h>
42 #endif
43 
44 #ifdef HAVE_RSVG
45 #include <librsvg/rsvg.h>
46 #endif
47 
48 G_BEGIN_DECLS
49 
50 #ifndef __EOG_IMAGE_DECLR__
51 #define __EOG_IMAGE_DECLR__
52 typedef struct _EogImage EogImage;
53 #endif
54 typedef struct _EogImageClass EogImageClass;
55 typedef struct _EogImagePrivate EogImagePrivate;
56 
57 #define EOG_TYPE_IMAGE            (eog_image_get_type ())
58 #define EOG_IMAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), EOG_TYPE_IMAGE, EogImage))
59 #define EOG_IMAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  EOG_TYPE_IMAGE, EogImageClass))
60 #define EOG_IS_IMAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOG_TYPE_IMAGE))
61 #define EOG_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  EOG_TYPE_IMAGE))
62 #define EOG_IMAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  EOG_TYPE_IMAGE, EogImageClass))
63 
64 typedef enum {
65 	EOG_IMAGE_ERROR_SAVE_NOT_LOCAL,
66 	EOG_IMAGE_ERROR_NOT_LOADED,
67 	EOG_IMAGE_ERROR_NOT_SAVED,
68 	EOG_IMAGE_ERROR_VFS,
69 	EOG_IMAGE_ERROR_FILE_EXISTS,
70 	EOG_IMAGE_ERROR_TMP_FILE_FAILED,
71 	EOG_IMAGE_ERROR_GENERIC,
72 	EOG_IMAGE_ERROR_UNKNOWN
73 } EogImageError;
74 
75 #define EOG_IMAGE_ERROR eog_image_error_quark ()
76 
77 typedef enum {
78 	EOG_IMAGE_STATUS_UNKNOWN,
79 	EOG_IMAGE_STATUS_LOADING,
80 	EOG_IMAGE_STATUS_LOADED,
81 	EOG_IMAGE_STATUS_SAVING,
82 	EOG_IMAGE_STATUS_FAILED
83 } EogImageStatus;
84 
85 typedef enum {
86   EOG_IMAGE_METADATA_NOT_READ,
87   EOG_IMAGE_METADATA_NOT_AVAILABLE,
88   EOG_IMAGE_METADATA_READY
89 } EogImageMetadataStatus;
90 
91 struct _EogImage {
92 	GObject parent;
93 
94 	EogImagePrivate *priv;
95 };
96 
97 struct _EogImageClass {
98 	GObjectClass parent_class;
99 
100 	void (* changed) 	   (EogImage *img);
101 
102 	void (* size_prepared)     (EogImage *img,
103 				    int       width,
104 				    int       height);
105 
106 	void (* thumbnail_changed) (EogImage *img);
107 
108 	void (* save_progress)     (EogImage *img,
109 				    gfloat    progress);
110 
111 	void (* next_frame)        (EogImage *img,
112 				    gint delay);
113 
114 	void (* file_changed)      (EogImage *img);
115 };
116 
117 GType	          eog_image_get_type	             (void) G_GNUC_CONST;
118 
119 GQuark            eog_image_error_quark              (void);
120 
121 EogImage         *eog_image_new_file                 (GFile *file, const gchar *caption);
122 
123 gboolean          eog_image_load                     (EogImage   *img,
124 					              EogImageData data2read,
125 					              EogJob     *job,
126 					              GError    **error);
127 
128 void              eog_image_cancel_load              (EogImage   *img);
129 
130 gboolean          eog_image_has_data                 (EogImage   *img,
131 					              EogImageData data);
132 
133 void              eog_image_data_ref                 (EogImage   *img);
134 
135 void              eog_image_data_unref               (EogImage   *img);
136 
137 void              eog_image_set_thumbnail            (EogImage   *img,
138 					              GdkPixbuf  *pixbuf);
139 
140 gboolean          eog_image_save_as_by_info          (EogImage   *img,
141 		      			              EogImageSaveInfo *source,
142 		      			              EogImageSaveInfo *target,
143 		      			              GError    **error);
144 
145 gboolean          eog_image_save_by_info             (EogImage   *img,
146 					              EogImageSaveInfo *source,
147 					              GError    **error);
148 
149 GdkPixbuf*        eog_image_get_pixbuf               (EogImage   *img);
150 
151 GdkPixbuf*        eog_image_get_thumbnail            (EogImage   *img);
152 
153 void              eog_image_get_size                 (EogImage   *img,
154 					              gint       *width,
155 					              gint       *height);
156 
157 goffset           eog_image_get_bytes                (EogImage   *img);
158 
159 gboolean          eog_image_is_modified              (EogImage   *img);
160 
161 void              eog_image_modified                 (EogImage   *img);
162 
163 const gchar*      eog_image_get_caption              (EogImage   *img);
164 
165 const gchar      *eog_image_get_collate_key          (EogImage   *img);
166 
167 #ifdef HAVE_EXIF
168 ExifData*      eog_image_get_exif_info            (EogImage   *img);
169 #endif
170 
171 gpointer          eog_image_get_xmp_info             (EogImage   *img);
172 
173 GFile*            eog_image_get_file                 (EogImage   *img);
174 
175 gchar*            eog_image_get_uri_for_display      (EogImage   *img);
176 
177 EogImageStatus    eog_image_get_status               (EogImage   *img);
178 
179 EogImageMetadataStatus eog_image_get_metadata_status (EogImage   *img);
180 
181 void              eog_image_transform                (EogImage   *img,
182 						      EogTransform *trans,
183 						      EogJob     *job);
184 
185 void              eog_image_autorotate               (EogImage   *img);
186 
187 #ifdef HAVE_LCMS
188 cmsHPROFILE       eog_image_get_profile              (EogImage    *img);
189 
190 void              eog_image_apply_display_profile    (EogImage    *img,
191 						      cmsHPROFILE  display_profile);
192 #endif
193 
194 void              eog_image_undo                     (EogImage   *img);
195 
196 GList		 *eog_image_get_supported_mime_types (void);
197 
198 gboolean          eog_image_is_supported_mime_type   (const char *mime_type);
199 
200 gboolean          eog_image_is_animation             (EogImage *img);
201 
202 gboolean          eog_image_start_animation          (EogImage *img);
203 
204 #ifdef HAVE_RSVG
205 gboolean          eog_image_is_svg                   (EogImage *img);
206 RsvgHandle       *eog_image_get_svg                  (EogImage *img);
207 #endif
208 
209 EogTransform     *eog_image_get_transform            (EogImage *img);
210 EogTransform     *eog_image_get_autorotate_transform (EogImage *img);
211 
212 gboolean          eog_image_is_jpeg                  (EogImage *img);
213 
214 void              eog_image_file_changed             (EogImage *img);
215 
216 gboolean          eog_image_is_file_changed          (EogImage *img);
217 
218 gboolean          eog_image_is_file_writable         (EogImage *img);
219 
220 gboolean          eog_image_is_multipaged            (EogImage *img);
221 
222 G_END_DECLS
223 
224 #endif /* __EOG_IMAGE_H__ */
225