Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-image.h File Reference
#include <glib-object.h>
#include <gdk/gdk.h>
+ Include dependency graph for ev-image.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _EvImage
 
struct  _EvImageClass
 

Macros

#define EV_TYPE_IMAGE   (ev_image_get_type())
 
#define EV_IMAGE(object)   (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_IMAGE, EvImage))
 
#define EV_IMAGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_IMAGE, EvImageClass))
 
#define EV_IS_IMAGE(object)   (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_IMAGE))
 
#define EV_IS_IMAGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_IMAGE))
 
#define EV_IMAGE_GET_CLASS(object)   (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_IMAGE, EvImageClass))
 

Typedefs

typedef typedefG_BEGIN_DECLS
struct _EvImage 
EvImage
 
typedef struct _EvImageClass EvImageClass
 
typedef struct _EvImagePrivate EvImagePrivate
 

Functions

GType ev_image_get_type (void) G_GNUC_CONST
 
EvImageev_image_new (gint page, gint img_id)
 
EvImageev_image_new_from_pixbuf (GdkPixbuf *pixbuf)
 
gint ev_image_get_id (EvImage *image)
 
gint ev_image_get_page (EvImage *image)
 
GdkPixbuf * ev_image_get_pixbuf (EvImage *image)
 
const gchar * ev_image_save_tmp (EvImage *image, GdkPixbuf *pixbuf)
 
const gchar * ev_image_get_tmp_uri (EvImage *image)
 

Macro Definition Documentation

#define EV_IMAGE (   object)    (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_IMAGE, EvImage))

Definition at line 37 of file ev-image.h.

#define EV_IMAGE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_IMAGE, EvImageClass))

Definition at line 38 of file ev-image.h.

#define EV_IMAGE_GET_CLASS (   object)    (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_IMAGE, EvImageClass))

Definition at line 41 of file ev-image.h.

#define EV_IS_IMAGE (   object)    (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_IMAGE))

Definition at line 39 of file ev-image.h.

#define EV_IS_IMAGE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_IMAGE))

Definition at line 40 of file ev-image.h.

#define EV_TYPE_IMAGE   (ev_image_get_type())

Definition at line 36 of file ev-image.h.

Typedef Documentation

typedef typedefG_BEGIN_DECLS struct _EvImage EvImage

Definition at line 32 of file ev-image.h.

typedef struct _EvImageClass EvImageClass

Definition at line 33 of file ev-image.h.

Definition at line 34 of file ev-image.h.

Function Documentation

gint ev_image_get_id ( EvImage image)

Definition at line 117 of file ev-image.c.

118 {
119  g_return_val_if_fail (EV_IS_IMAGE (image), -1);
120 
121  return image->priv->id;
122 }

+ Here is the caller graph for this function:

gint ev_image_get_page ( EvImage image)

Definition at line 109 of file ev-image.c.

110 {
111  g_return_val_if_fail (EV_IS_IMAGE (image), -1);
112 
113  return image->priv->page;
114 }

+ Here is the caller graph for this function:

GdkPixbuf* ev_image_get_pixbuf ( EvImage image)

ev_image_get_pixbuf: an EvImage

Returns: (transfer none): a #GdkPixbuf

Definition at line 131 of file ev-image.c.

132 {
133  g_return_val_if_fail (EV_IS_IMAGE (image), NULL);
134  g_return_val_if_fail (GDK_IS_PIXBUF (image->priv->pixbuf), NULL);
135 
136  return image->priv->pixbuf;
137 }
const gchar* ev_image_get_tmp_uri ( EvImage image)

Definition at line 182 of file ev-image.c.

183 {
184  g_return_val_if_fail (EV_IS_IMAGE (image), NULL);
185 
186  return image->priv->tmp_uri;
187 }
GType ev_image_get_type ( void  )
EvImage* ev_image_new ( gint  page,
gint  img_id 
)

Definition at line 83 of file ev-image.c.

85 {
86  EvImage *image;
87 
88  image = EV_IMAGE (g_object_new (EV_TYPE_IMAGE, NULL));
89  image->priv->page = page;
90  image->priv->id = img_id;
91 
92  return image;
93 }

+ Here is the caller graph for this function:

EvImage* ev_image_new_from_pixbuf ( GdkPixbuf *  pixbuf)

Definition at line 96 of file ev-image.c.

97 {
98  EvImage *image;
99 
100  g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
101 
102  image = EV_IMAGE (g_object_new (EV_TYPE_IMAGE, NULL));
103  image->priv->pixbuf = g_object_ref (pixbuf);
104 
105  return image;
106 }
const gchar* ev_image_save_tmp ( EvImage image,
GdkPixbuf *  pixbuf 
)

Definition at line 140 of file ev-image.c.

142 {
143  GError *error = NULL;
144  gchar *filename = NULL;
145  int fd;
146 
147  g_return_val_if_fail (EV_IS_IMAGE (image), NULL);
148  g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
149 
150  if (image->priv->tmp_uri)
151  return image->priv->tmp_uri;
152 
153  if ((fd = ev_mkstemp ("image.XXXXXX.png", &filename, &error)) == -1)
154  goto had_error;
155 
156  gdk_pixbuf_save (pixbuf, filename,
157  "png", &error,
158  "compression", "3", NULL);
159  close (fd);
160 
161  if (!error) {
162  image->priv->tmp_uri = g_filename_to_uri (filename, NULL, &error);
163  if (image->priv->tmp_uri == NULL)
164  goto had_error;
165 
166  g_free (filename);
167 
168  return image->priv->tmp_uri;
169  }
170 
171  had_error:
172 
173  /* Erro saving image */
174  g_warning ("Error saving image: %s", error->message);
175  g_error_free (error);
176  g_free (filename);
177 
178  return NULL;
179 }

+ Here is the caller graph for this function: