eog-image.h 6.09 KB
Newer Older
1
/* Eye Of Gnome - Image
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
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __EOG_IMAGE_H__
#define __EOG_IMAGE_H__

#include "eog-jobs.h"
#include "eog-window.h"
#include "eog-transform.h"
#include "eog-image-save-info.h"
29
#include "eog-enums.h"
30 31 32 33 34 35 36 37 38 39 40 41 42

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

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

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

43 44 45 46
#ifdef HAVE_EXEMPI
#include <exempi/xmp.h>
#endif

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
G_BEGIN_DECLS

#ifndef __EOG_IMAGE_DECLR__
#define __EOG_IMAGE_DECLR__
typedef struct _EogImage EogImage;
#endif
typedef struct _EogImageClass EogImageClass;
typedef struct _EogImagePrivate EogImagePrivate;

#define EOG_TYPE_IMAGE            (eog_image_get_type ())
#define EOG_IMAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), EOG_TYPE_IMAGE, EogImage))
#define EOG_IMAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  EOG_TYPE_IMAGE, EogImageClass))
#define EOG_IS_IMAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOG_TYPE_IMAGE))
#define EOG_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  EOG_TYPE_IMAGE))
#define EOG_IMAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  EOG_TYPE_IMAGE, EogImageClass))

typedef enum {
	EOG_IMAGE_ERROR_SAVE_NOT_LOCAL,
	EOG_IMAGE_ERROR_NOT_LOADED,
	EOG_IMAGE_ERROR_VFS,
	EOG_IMAGE_ERROR_FILE_EXISTS,
	EOG_IMAGE_ERROR_TMP_FILE_FAILED,
	EOG_IMAGE_ERROR_GENERIC,
	EOG_IMAGE_ERROR_UNKNOWN
} EogImageError;

#define EOG_IMAGE_ERROR eog_image_error_quark ()

typedef enum {
	EOG_IMAGE_STATUS_UNKNOWN,
	EOG_IMAGE_STATUS_LOADING,
	EOG_IMAGE_STATUS_LOADED,
79
	EOG_IMAGE_STATUS_SAVING,
80 81 82
	EOG_IMAGE_STATUS_FAILED
} EogImageStatus;

83 84 85 86 87 88
typedef enum {
  EOG_IMAGE_METADATA_NOT_READ,
  EOG_IMAGE_METADATA_NOT_AVAILABLE,
  EOG_IMAGE_METADATA_READY
} EogImageMetadataStatus;

89 90 91 92 93 94 95 96 97 98 99
struct _EogImage {
	GObject parent;

	EogImagePrivate *priv;
};

struct _EogImageClass {
	GObjectClass parent_class;

	void (* changed) 	   (EogImage *img);

100 101
	void (* size_prepared)     (EogImage *img,
				    int       width,
102 103 104 105
				    int       height);

	void (* thumbnail_changed) (EogImage *img);

106
	void (* save_progress)     (EogImage *img,
107
				    gfloat    progress);
108 109 110

	void (* next_frame)        (EogImage *img,
				    gint delay);
111 112
};

113
GType	          eog_image_get_type	             (void) G_GNUC_CONST;
114 115 116 117 118

GQuark            eog_image_error_quark              (void);

EogImage         *eog_image_new                      (const char *txt_uri);

119
EogImage         *eog_image_new_file                 (GFile *file);
120

121
gboolean          eog_image_load                     (EogImage   *img,
122
					              EogImageData data2read,
123
					              EogJob     *job,
124 125 126 127
					              GError    **error);

void              eog_image_cancel_load              (EogImage   *img);

128
gboolean          eog_image_has_data                 (EogImage   *img,
129
					              EogImageData data);
130 131 132 133 134

void              eog_image_data_ref                 (EogImage   *img);

void              eog_image_data_unref               (EogImage   *img);

135
void              eog_image_set_thumbnail            (EogImage   *img,
136 137
					              GdkPixbuf  *pixbuf);

138 139 140
gboolean          eog_image_save_as_by_info          (EogImage   *img,
		      			              EogImageSaveInfo *source,
		      			              EogImageSaveInfo *target,
141 142
		      			              GError    **error);

143 144
gboolean          eog_image_save_by_info             (EogImage   *img,
					              EogImageSaveInfo *source,
145 146 147 148 149 150
					              GError    **error);

GdkPixbuf*        eog_image_get_pixbuf               (EogImage   *img);

GdkPixbuf*        eog_image_get_thumbnail            (EogImage   *img);

151 152
void              eog_image_get_size                 (EogImage   *img,
					              gint       *width,
153 154
					              gint       *height);

155
goffset           eog_image_get_bytes                (EogImage   *img);
156 157 158 159 160 161 162 163 164 165 166

gboolean          eog_image_is_modified              (EogImage   *img);

void              eog_image_modified                 (EogImage   *img);

const gchar*      eog_image_get_caption              (EogImage   *img);

const gchar      *eog_image_get_collate_key          (EogImage   *img);

gpointer          eog_image_get_exif_info            (EogImage   *img);

167 168
gpointer          eog_image_get_xmp_info             (EogImage   *img);

169
GFile*            eog_image_get_file                 (EogImage   *img);
170 171 172

gchar*            eog_image_get_uri_for_display      (EogImage   *img);

173 174
EogImageStatus    eog_image_get_status               (EogImage   *img);

175 176
EogImageMetadataStatus eog_image_get_metadata_status (EogImage   *img);

177
void              eog_image_transform                (EogImage   *img,
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
						      EogTransform *trans,
						      EogJob     *job);

#ifdef HAVE_EXIF
void              eog_image_autorotate               (EogImage   *img);
#endif

#ifdef HAVE_LCMS
cmsHPROFILE       eog_image_get_profile              (EogImage    *img);

void              eog_image_apply_display_profile    (EogImage    *img,
						      cmsHPROFILE  display_profile);
#endif

void              eog_image_undo                     (EogImage   *img);

GList		 *eog_image_get_supported_mime_types (void);

gboolean          eog_image_is_supported_mime_type   (const char *mime_type);

198 199 200 201
gboolean          eog_image_is_animation             (EogImage *img);

gboolean          eog_image_start_animation          (EogImage *img);

202 203 204
G_END_DECLS

#endif /* __EOG_IMAGE_H__ */