#include "comics-document.h"
#include "ev-document-misc.h"
-#include "ev-document-thumbnails.h"
#include "ev-file-helpers.h"
#ifdef G_OS_WIN32
{"%s -xOf" , "%s -tf %s" , NULL , FALSE, NO_OFFSET}
};
-static void comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
-
static GSList* get_supported_image_extensions (void);
static void get_page_size_area_prepared_cb (GdkPixbufLoader *loader,
gpointer data);
gint page);
-EV_BACKEND_REGISTER_WITH_CODE (ComicsDocument, comics_document,
- {
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
- comics_document_document_thumbnails_iface_init);
- } );
+EV_BACKEND_REGISTER (ComicsDocument, comics_document)
/**
* comics_regex_quote:
return extensions;
}
-static GdkPixbuf *
-comics_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border)
-{
- GdkPixbuf *thumbnail;
-
- thumbnail = comics_document_render_pixbuf (EV_DOCUMENT (document), rc);
-
- if (border) {
- GdkPixbuf *tmp_pixbuf = thumbnail;
-
- thumbnail = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf);
- g_object_unref (tmp_pixbuf);
- }
-
- return thumbnail;
-}
-
-static void
-comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = comics_document_thumbnails_get_thumbnail;
-}
-
static char**
extract_argv (EvDocument *document, gint page)
{
#include "djvu-text-page.h"
#include "djvu-links.h"
#include "djvu-document-private.h"
-#include "ev-document-thumbnails.h"
#include "ev-file-exporter.h"
#include "ev-document-misc.h"
#include "ev-document-find.h"
typedef struct _DjvuDocumentClass DjvuDocumentClass;
-static void djvu_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
static void djvu_document_file_exporter_iface_init (EvFileExporterInterface *iface);
static void djvu_document_find_iface_init (EvDocumentFindInterface *iface);
static void djvu_document_document_links_iface_init (EvDocumentLinksInterface *iface);
EV_BACKEND_REGISTER_WITH_CODE (DjvuDocument, djvu_document,
{
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, djvu_document_document_thumbnails_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, djvu_document_file_exporter_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_FIND, djvu_document_find_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_LINKS, djvu_document_document_links_iface_init);
return surface;
}
+static GdkPixbuf *
+djvu_document_get_thumbnail (EvDocument *document,
+ EvRenderContext *rc)
+{
+ DjvuDocument *djvu_document = DJVU_DOCUMENT (document);
+ GdkPixbuf *pixbuf, *rotated_pixbuf;
+ gdouble page_width, page_height;
+ gint thumb_width, thumb_height;
+ guchar *pixels;
+
+ g_return_val_if_fail (djvu_document->d_document, NULL);
+
+ djvu_document_get_page_size (EV_DOCUMENT(djvu_document), rc->page,
+ &page_width, &page_height);
+
+ thumb_width = (gint) (page_width * rc->scale);
+ thumb_height = (gint) (page_height * rc->scale);
+
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
+ thumb_width, thumb_height);
+ gdk_pixbuf_fill (pixbuf, 0xffffffff);
+ pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+ while (ddjvu_thumbnail_status (djvu_document->d_document, rc->page->index, 1) < DDJVU_JOB_OK)
+ djvu_handle_events(djvu_document, TRUE, NULL);
+
+ ddjvu_thumbnail_render (djvu_document->d_document, rc->page->index,
+ &thumb_width, &thumb_height,
+ djvu_document->thumbs_format,
+ gdk_pixbuf_get_rowstride (pixbuf),
+ (gchar *)pixels);
+
+ rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation);
+ g_object_unref (pixbuf);
+
+ return rotated_pixbuf;
+}
+
static void
djvu_document_finalize (GObject *object)
{
ev_document_class->get_n_pages = djvu_document_get_n_pages;
ev_document_class->get_page_size = djvu_document_get_page_size;
ev_document_class->render = djvu_document_render;
+ ev_document_class->get_thumbnail = djvu_document_get_thumbnail;
}
static gchar *
iface->get_selected_text = djvu_selection_get_selected_text;
}
-static GdkPixbuf *
-djvu_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border)
-{
- DjvuDocument *djvu_document = DJVU_DOCUMENT (document);
- GdkPixbuf *pixbuf, *rotated_pixbuf;
- gdouble page_width, page_height;
- gint thumb_width, thumb_height;
- guchar *pixels;
-
- g_return_val_if_fail (djvu_document->d_document, NULL);
-
- djvu_document_get_page_size (EV_DOCUMENT(djvu_document), rc->page,
- &page_width, &page_height);
-
- thumb_width = (gint) (page_width * rc->scale);
- thumb_height = (gint) (page_height * rc->scale);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- thumb_width, thumb_height);
- gdk_pixbuf_fill (pixbuf, 0xffffffff);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- while (ddjvu_thumbnail_status (djvu_document->d_document, rc->page->index, 1) < DDJVU_JOB_OK)
- djvu_handle_events(djvu_document, TRUE, NULL);
-
- ddjvu_thumbnail_render (djvu_document->d_document, rc->page->index,
- &thumb_width, &thumb_height,
- djvu_document->thumbs_format,
- gdk_pixbuf_get_rowstride (pixbuf),
- (gchar *)pixels);
-
- rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation);
- g_object_unref (pixbuf);
-
- if (border) {
- GdkPixbuf *tmp_pixbuf = rotated_pixbuf;
-
- rotated_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf);
- g_object_unref (tmp_pixbuf);
- }
-
- return rotated_pixbuf;
-}
-
-static void
-djvu_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = djvu_document_thumbnails_get_thumbnail;
-}
-
/* EvFileExporterIface */
static void
djvu_document_file_exporter_begin (EvFileExporter *exporter,
#include "dvi-document.h"
#include "texmfcnf.h"
-#include "ev-document-thumbnails.h"
#include "ev-document-misc.h"
#include "ev-file-exporter.h"
#include "ev-file-helpers.h"
typedef struct _DviDocumentClass DviDocumentClass;
-static void dvi_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
-static void dvi_document_file_exporter_iface_init (EvFileExporterInterface *iface);
-static void dvi_document_do_color_special (DviContext *dvi,
- const char *prefix,
- const char *arg);
+static void dvi_document_file_exporter_iface_init (EvFileExporterInterface *iface);
+static void dvi_document_do_color_special (DviContext *dvi,
+ const char *prefix,
+ const char *arg);
EV_BACKEND_REGISTER_WITH_CODE (DviDocument, dvi_document,
{
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, dvi_document_document_thumbnails_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER, dvi_document_file_exporter_iface_init);
});
ev_document_class->support_synctex = dvi_document_support_synctex;
}
-static GdkPixbuf *
-dvi_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border)
-{
- DviDocument *dvi_document = DVI_DOCUMENT (document);
- GdkPixbuf *pixbuf;
- GdkPixbuf *rotated_pixbuf;
- cairo_surface_t *surface;
- gint thumb_width, thumb_height;
- gint proposed_width, proposed_height;
-
- thumb_width = (gint) (dvi_document->base_width * rc->scale);
- thumb_height = (gint) (dvi_document->base_height * rc->scale);
-
- g_mutex_lock (dvi_context_mutex);
-
- mdvi_setpage (dvi_document->context, rc->page->index);
-
- mdvi_set_shrink (dvi_document->context,
- (int)dvi_document->base_width * dvi_document->params->hshrink / thumb_width,
- (int)dvi_document->base_height * dvi_document->params->vshrink / thumb_height);
-
- proposed_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv;
- proposed_height = dvi_document->context->dvi_page_h * dvi_document->context->params.vconv;
-
- if (border) {
- mdvi_cairo_device_set_margins (&dvi_document->context->device,
- MAX (thumb_width - proposed_width, 0) / 2,
- MAX (thumb_height - proposed_height, 0) / 2);
- } else {
- mdvi_cairo_device_set_margins (&dvi_document->context->device,
- MAX (thumb_width - proposed_width - 2, 0) / 2,
- MAX (thumb_height - proposed_height - 2, 0) / 2);
- }
-
- mdvi_cairo_device_set_scale (&dvi_document->context->device, rc->scale);
- mdvi_cairo_device_render (dvi_document->context);
- surface = mdvi_cairo_device_get_surface (&dvi_document->context->device);
- g_mutex_unlock (dvi_context_mutex);
-
- pixbuf = ev_document_misc_pixbuf_from_surface (surface);
- cairo_surface_destroy (surface);
-
- rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation);
- g_object_unref (pixbuf);
-
- if (border) {
- GdkPixbuf *tmp_pixbuf = rotated_pixbuf;
-
- rotated_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf);
- g_object_unref (tmp_pixbuf);
- }
-
- return rotated_pixbuf;
-}
-
-static void
-dvi_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = dvi_document_thumbnails_get_thumbnail;
-}
-
/* EvFileExporterIface */
static void
dvi_document_file_exporter_begin (EvFileExporter *exporter,
#include "ev-document-images.h"
#include "ev-document-fonts.h"
#include "ev-document-security.h"
-#include "ev-document-thumbnails.h"
#include "ev-document-transition.h"
#include "ev-document-forms.h"
#include "ev-document-layers.h"
};
static void pdf_document_security_iface_init (EvDocumentSecurityInterface *iface);
-static void pdf_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
static void pdf_document_document_links_iface_init (EvDocumentLinksInterface *iface);
static void pdf_document_document_images_iface_init (EvDocumentImagesInterface *iface);
static void pdf_document_document_forms_iface_init (EvDocumentFormsInterface *iface);
{
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_SECURITY,
pdf_document_security_iface_init);
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
- pdf_document_document_thumbnails_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_LINKS,
pdf_document_document_links_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_IMAGES,
width, height, rc);
}
+static GdkPixbuf *
+make_thumbnail_for_page (PopplerPage *poppler_page,
+ EvRenderContext *rc,
+ gint width,
+ gint height)
+{
+ GdkPixbuf *pixbuf;
+
+#ifdef POPPLER_WITH_GDK
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
+ width, height);
+ gdk_pixbuf_fill (pixbuf, 0xffffffff);
+
+ ev_document_fc_mutex_lock ();
+ poppler_page_render_to_pixbuf (poppler_page, 0, 0,
+ width, height,
+ rc->scale, rc->rotation, pixbuf);
+ ev_document_fc_mutex_unlock ();
+#else
+ cairo_surface_t *surface;
+
+ ev_document_fc_mutex_lock ();
+ surface = pdf_page_render (poppler_page, width, height, rc);
+ ev_document_fc_mutex_unlock ();
+
+ pixbuf = ev_document_misc_pixbuf_from_surface (surface);
+ cairo_surface_destroy (surface);
+#endif /* POPPLER_WITH_GDK */
+
+ return pixbuf;
+}
+
+static GdkPixbuf *
+pdf_document_get_thumbnail (EvDocument *document,
+ EvRenderContext *rc)
+{
+ PdfDocument *pdf_document = PDF_DOCUMENT (document);
+ PopplerPage *poppler_page;
+ GdkPixbuf *pixbuf = NULL;
+ GdkPixbuf *border_pixbuf;
+ double page_width, page_height;
+ gint width, height;
+
+ poppler_page = POPPLER_PAGE (rc->page->backend_page);
+
+ poppler_page_get_size (poppler_page,
+ &page_width, &page_height);
+
+ width = MAX ((gint)(page_width * rc->scale + 0.5), 1);
+ height = MAX ((gint)(page_height * rc->scale + 0.5), 1);
+
+ if (rc->rotation == 90 || rc->rotation == 270) {
+ gint temp;
+
+ temp = width;
+ width = height;
+ height = temp;
+ }
+
+#ifdef POPPLER_WITH_GDK
+ pixbuf = poppler_page_get_thumbnail_pixbuf (poppler_page);
+#else
+ cairo_surface_t *surface;
+
+ surface = poppler_page_get_thumbnail (poppler_page);
+ if (surface) {
+ pixbuf = ev_document_misc_pixbuf_from_surface (surface);
+ cairo_surface_destroy (surface);
+ }
+#endif /* POPPLER_WITH_GDK */
+
+ if (pixbuf != NULL) {
+ int thumb_width = (rc->rotation == 90 || rc->rotation == 270) ?
+ gdk_pixbuf_get_height (pixbuf) :
+ gdk_pixbuf_get_width (pixbuf);
+
+ if (thumb_width == width) {
+ GdkPixbuf *rotated_pixbuf;
+
+ rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf,
+ (GdkPixbufRotation) (360 - rc->rotation));
+ g_object_unref (pixbuf);
+ pixbuf = rotated_pixbuf;
+ } else {
+ /* The provided thumbnail has a different size */
+ g_object_unref (pixbuf);
+ pixbuf = make_thumbnail_for_page (poppler_page, rc, width, height);
+ }
+ } else {
+ /* There is no provided thumbnail. We need to make one. */
+ pixbuf = make_thumbnail_for_page (poppler_page, rc, width, height);
+ }
+
+ return pixbuf;
+}
+
/* reference:
http://www.pdfa.org/lib/exe/fetch.php?id=pdfa%3Aen%3Atechdoc&cache=cache&media=pdfa:techdoc:tn0001_pdfa-1_and_namespaces_2008-03-18.pdf */
static char *
ev_document_class->get_page_size = pdf_document_get_page_size;
ev_document_class->get_page_label = pdf_document_get_page_label;
ev_document_class->render = pdf_document_render;
+ ev_document_class->get_thumbnail = pdf_document_get_thumbnail;
ev_document_class->get_info = pdf_document_get_info;
ev_document_class->get_backend_info = pdf_document_get_backend_info;
ev_document_class->support_synctex = pdf_document_support_synctex;
iface->get_image = pdf_document_images_get_image;
}
-static GdkPixbuf *
-make_thumbnail_for_page (PopplerPage *poppler_page,
- EvRenderContext *rc,
- gint width,
- gint height)
-{
- GdkPixbuf *pixbuf;
-
-#ifdef POPPLER_WITH_GDK
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- width, height);
- gdk_pixbuf_fill (pixbuf, 0xffffffff);
-
- ev_document_fc_mutex_lock ();
- poppler_page_render_to_pixbuf (poppler_page, 0, 0,
- width, height,
- rc->scale, rc->rotation, pixbuf);
- ev_document_fc_mutex_unlock ();
-#else
- cairo_surface_t *surface;
-
- ev_document_fc_mutex_lock ();
- surface = pdf_page_render (poppler_page, width, height, rc);
- ev_document_fc_mutex_unlock ();
-
- pixbuf = ev_document_misc_pixbuf_from_surface (surface);
- cairo_surface_destroy (surface);
-#endif /* POPPLER_WITH_GDK */
-
- return pixbuf;
-}
-
-static GdkPixbuf *
-pdf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails,
- EvRenderContext *rc,
- gboolean border)
-{
- PdfDocument *pdf_document = PDF_DOCUMENT (document_thumbnails);
- PopplerPage *poppler_page;
- GdkPixbuf *pixbuf = NULL;
- GdkPixbuf *border_pixbuf;
- double page_width, page_height;
- gint width, height;
-
- poppler_page = POPPLER_PAGE (rc->page->backend_page);
-
- poppler_page_get_size (poppler_page,
- &page_width, &page_height);
-
- width = MAX ((gint)(page_width * rc->scale + 0.5), 1);
- height = MAX ((gint)(page_height * rc->scale + 0.5), 1);
-
- if (rc->rotation == 90 || rc->rotation == 270) {
- gint temp;
-
- temp = width;
- width = height;
- height = temp;
- }
-
-#ifdef POPPLER_WITH_GDK
- pixbuf = poppler_page_get_thumbnail_pixbuf (poppler_page);
-#else
- cairo_surface_t *surface;
-
- surface = poppler_page_get_thumbnail (poppler_page);
- if (surface) {
- pixbuf = ev_document_misc_pixbuf_from_surface (surface);
- cairo_surface_destroy (surface);
- }
-#endif /* POPPLER_WITH_GDK */
-
- if (pixbuf != NULL) {
- int thumb_width = (rc->rotation == 90 || rc->rotation == 270) ?
- gdk_pixbuf_get_height (pixbuf) :
- gdk_pixbuf_get_width (pixbuf);
-
- if (thumb_width == width) {
- GdkPixbuf *rotated_pixbuf;
-
- rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf,
- (GdkPixbufRotation) (360 - rc->rotation));
- g_object_unref (pixbuf);
- pixbuf = rotated_pixbuf;
- } else {
- /* The provided thumbnail has a different size */
- g_object_unref (pixbuf);
- pixbuf = make_thumbnail_for_page (poppler_page, rc, width, height);
- }
- } else {
- /* There is no provided thumbnail. We need to make one. */
- pixbuf = make_thumbnail_for_page (poppler_page, rc, width, height);
- }
-
- if (border && pixbuf) {
- border_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, pixbuf);
- g_object_unref (pixbuf);
- pixbuf = border_pixbuf;
- }
-
- return pixbuf;
-}
-
-static void
-pdf_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = pdf_document_thumbnails_get_thumbnail;
-}
-
-
static GList *
pdf_document_find_find_text (EvDocumentFind *document_find,
EvPage *page,
#include <glib/gi18n-lib.h>
#include "pixbuf-document.h"
-#include "ev-document-thumbnails.h"
#include "ev-document-misc.h"
#include "ev-file-helpers.h"
typedef struct _PixbufDocumentClass PixbufDocumentClass;
-static void pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
-
-EV_BACKEND_REGISTER_WITH_CODE (PixbufDocument, pixbuf_document,
- {
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
- pixbuf_document_document_thumbnails_iface_init)
- });
+EV_BACKEND_REGISTER (PixbufDocument, pixbuf_document)
static gboolean
pixbuf_document_load (EvDocument *document,
return surface;
}
+static GdkPixbuf *
+pixbuf_document_get_thumbnail (EvDocument *document,
+ EvRenderContext *rc)
+{
+ PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document);
+ GdkPixbuf *pixbuf, *rotated_pixbuf;
+ gint width, height;
+
+ width = (gint) (gdk_pixbuf_get_width (pixbuf_document->pixbuf) * rc->scale);
+ height = (gint) (gdk_pixbuf_get_height (pixbuf_document->pixbuf) * rc->scale);
+
+ pixbuf = gdk_pixbuf_scale_simple (pixbuf_document->pixbuf,
+ width, height,
+ GDK_INTERP_BILINEAR);
+
+ rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation);
+ g_object_unref (pixbuf);
+
+ return rotated_pixbuf;
+}
+
static void
pixbuf_document_finalize (GObject *object)
{
ev_document_class->get_n_pages = pixbuf_document_get_n_pages;
ev_document_class->get_page_size = pixbuf_document_get_page_size;
ev_document_class->render = pixbuf_document_render;
+ ev_document_class->get_thumbnail = pixbuf_document_get_thumbnail;
}
-static GdkPixbuf *
-pixbuf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border)
-{
- PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document);
- GdkPixbuf *pixbuf, *rotated_pixbuf;
- gint width, height;
-
- width = (gint) (gdk_pixbuf_get_width (pixbuf_document->pixbuf) * rc->scale);
- height = (gint) (gdk_pixbuf_get_height (pixbuf_document->pixbuf) * rc->scale);
-
- pixbuf = gdk_pixbuf_scale_simple (pixbuf_document->pixbuf,
- width, height,
- GDK_INTERP_BILINEAR);
-
- rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation);
- g_object_unref (pixbuf);
-
- return rotated_pixbuf;
-}
-
-static void
-pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = pixbuf_document_thumbnails_get_thumbnail;
-}
-
-
static void
pixbuf_document_init (PixbufDocument *pixbuf_document)
{
#include "ev-spectre.h"
#include "ev-file-exporter.h"
-#include "ev-document-thumbnails.h"
#include "ev-document-misc.h"
struct _PSDocument {
};
static void ps_document_file_exporter_iface_init (EvFileExporterInterface *iface);
-static void ps_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
EV_BACKEND_REGISTER_WITH_CODE (PSDocument, ps_document,
{
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
- ps_document_document_thumbnails_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER,
ps_document_file_exporter_iface_init);
});
ev_document_class->render = ps_document_render;
}
-/* EvDocumentThumbnailsIface */
-static GdkPixbuf *
-ps_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails,
- EvRenderContext *rc,
- gboolean border)
-{
- PSDocument *ps = PS_DOCUMENT (document_thumbnails);
- cairo_surface_t *surface;
- GdkPixbuf *pixbuf = NULL;
-
- surface = ps_document_render (EV_DOCUMENT (ps), rc);
- if (!surface) {
- g_warning ("Error rendering thumbnail");
- return NULL;
- }
-
- pixbuf = ev_document_misc_pixbuf_from_surface (surface);
- cairo_surface_destroy (surface);
-
- if (border) {
- GdkPixbuf *border_pixbuf;
-
- border_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, pixbuf);
- g_object_unref (pixbuf);
- pixbuf = border_pixbuf;
- }
-
- return pixbuf;
-}
-
-static void
-ps_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = ps_document_thumbnails_get_thumbnail;
-}
-
/* EvFileExporterIface */
static void
ps_document_file_exporter_begin (EvFileExporter *exporter,
#include "tiff2ps.h"
#include "tiff-document.h"
#include "ev-document-misc.h"
-#include "ev-document-thumbnails.h"
#include "ev-file-exporter.h"
#include "ev-file-helpers.h"
typedef struct _TiffDocumentClass TiffDocumentClass;
-static void tiff_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
static void tiff_document_document_file_exporter_iface_init (EvFileExporterInterface *iface);
EV_BACKEND_REGISTER_WITH_CODE (TiffDocument, tiff_document,
{
- EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
- tiff_document_document_thumbnails_iface_init);
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER,
tiff_document_document_file_exporter_iface_init);
});
}
static GdkPixbuf *
-tiff_document_render_pixbuf (EvDocument *document,
+tiff_document_get_thumbnail (EvDocument *document,
EvRenderContext *rc)
{
TiffDocument *tiff_document = TIFF_DOCUMENT (document);
ev_document_class->get_n_pages = tiff_document_get_n_pages;
ev_document_class->get_page_size = tiff_document_get_page_size;
ev_document_class->render = tiff_document_render;
+ ev_document_class->get_thumbnail = tiff_document_get_thumbnail;
ev_document_class->get_page_label = tiff_document_get_page_label;
}
-static GdkPixbuf *
-tiff_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border)
-{
- GdkPixbuf *pixbuf;
-
- pixbuf = tiff_document_render_pixbuf (EV_DOCUMENT (document), rc);
-
- if (border) {
- GdkPixbuf *tmp_pixbuf = pixbuf;
-
- pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf);
- g_object_unref (tmp_pixbuf);
- }
-
- return pixbuf;
-}
-
-static void
-tiff_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
-{
- iface->get_thumbnail = tiff_document_thumbnails_get_thumbnail;
-}
-
/* postscript exporter implementation */
static void
tiff_document_file_exporter_begin (EvFileExporter *exporter,
#include <libdocument/ev-document-links.h>
#include <libdocument/ev-document-misc.h>
#include <libdocument/ev-document-security.h>
-#include <libdocument/ev-document-thumbnails.h>
#include <libdocument/ev-document-transition.h>
#include <libdocument/ev-document-type-builtins.h>
#include <libdocument/ev-file-exporter.h>
ev-document-misc.h \
ev-document-print.h \
ev-document-security.h \
- ev-document-thumbnails.h \
ev-document-transition.h \
ev-document-text.h \
ev-file-exporter.h \
ev-document-annotations.c \
ev-document-attachments.c \
ev-document-factory.c \
- ev-document-thumbnails.c \
ev-document-fonts.c \
ev-document-layers.c \
ev-document-links.c \
+++ /dev/null
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
-/*
- * Copyright (C) 2004 Anders Carlsson <andersca@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, 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <config.h>
-#include "ev-document-thumbnails.h"
-#include "ev-document.h"
-
-G_DEFINE_INTERFACE (EvDocumentThumbnails, ev_document_thumbnails, 0)
-
-static void
-ev_document_thumbnails_default_init (EvDocumentThumbnailsInterface *klass)
-{
-}
-
-GdkPixbuf *
-ev_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border)
-{
- EvDocumentThumbnailsInterface *iface;
-
- g_return_val_if_fail (EV_IS_DOCUMENT_THUMBNAILS (document), NULL);
- g_return_val_if_fail (EV_IS_RENDER_CONTEXT (rc), NULL);
-
- iface = EV_DOCUMENT_THUMBNAILS_GET_IFACE (document);
-
- return iface->get_thumbnail (document, rc, border);
-}
-
+++ /dev/null
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
-/*
- * Copyright (C) 2004 Anders Carlsson
- *
- * 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, 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#if !defined (__EV_EVINCE_DOCUMENT_H_INSIDE__) && !defined (EVINCE_COMPILATION)
-#error "Only <evince-document.h> can be included directly."
-#endif
-
-#ifndef EV_DOCUMENT_THUMBNAILS_H
-#define EV_DOCUMENT_THUMBNAILS_H
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "ev-render-context.h"
-
-G_BEGIN_DECLS
-
-#define EV_TYPE_DOCUMENT_THUMBNAILS (ev_document_thumbnails_get_type ())
-#define EV_DOCUMENT_THUMBNAILS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_THUMBNAILS, EvDocumentThumbnails))
-#define EV_DOCUMENT_THUMBNAILS_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_THUMBNAILS, EvDocumentThumbnailsInterface))
-#define EV_IS_DOCUMENT_THUMBNAILS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_THUMBNAILS))
-#define EV_IS_DOCUMENT_THUMBNAILS_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_THUMBNAILS))
-#define EV_DOCUMENT_THUMBNAILS_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_THUMBNAILS, EvDocumentThumbnailsInterface))
-
-typedef struct _EvDocumentThumbnails EvDocumentThumbnails;
-typedef struct _EvDocumentThumbnailsInterface EvDocumentThumbnailsInterface;
-
-struct _EvDocumentThumbnailsInterface {
- GTypeInterface base_iface;
-
- /* Methods */
- GdkPixbuf * (* get_thumbnail) (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border);
-};
-
-GType ev_document_thumbnails_get_type (void) G_GNUC_CONST;
-
-GdkPixbuf *ev_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
- EvRenderContext *rc,
- gboolean border);
-
-G_END_DECLS
-
-#endif /* EV_DOCUMENT_THUMBNAILS_H */
#include <string.h>
#include "ev-document.h"
+#include "ev-document-misc.h"
#include "synctex_parser.h"
#define EV_DOCUMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_DOCUMENT, EvDocumentPrivate))
return klass->render (document, rc);
}
+static GdkPixbuf *
+_ev_document_get_thumbnail (EvDocument *document,
+ EvRenderContext *rc)
+{
+ cairo_surface_t *surface;
+ GdkPixbuf *pixbuf;
+
+ surface = ev_document_render (document, rc);
+ pixbuf = ev_document_misc_pixbuf_from_surface (surface);
+ cairo_surface_destroy (surface);
+
+ return pixbuf;
+}
+
+GdkPixbuf *
+ev_document_get_thumbnail (EvDocument *document,
+ EvRenderContext *rc)
+{
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
+
+ if (klass->get_thumbnail)
+ return klass->get_thumbnail (document, rc);
+
+ return _ev_document_get_thumbnail (document, rc);
+}
+
const gchar *
ev_document_get_uri (EvDocument *document)
{
EvPage *page);
cairo_surface_t * (* render) (EvDocument *document,
EvRenderContext *rc);
+ GdkPixbuf * (* get_thumbnail) (EvDocument *document,
+ EvRenderContext *rc);
EvDocumentInfo * (* get_info) (EvDocument *document);
gboolean (* get_backend_info)(EvDocument *document,
EvDocumentBackendInfo *info);
gint page_index);
cairo_surface_t *ev_document_render (EvDocument *document,
EvRenderContext *rc);
+GdkPixbuf *ev_document_get_thumbnail (EvDocument *document,
+ EvRenderContext *rc);
const gchar *ev_document_get_uri (EvDocument *document);
const gchar *ev_document_get_title (EvDocument *document);
gboolean ev_document_is_page_size_uniform (EvDocument *document);
#include <config.h>
#include "ev-jobs.h"
-#include "ev-document-thumbnails.h"
#include "ev-document-links.h"
#include "ev-document-images.h"
#include "ev-document-forms.h"
{
EvJobThumbnail *job_thumb = EV_JOB_THUMBNAIL (job);
EvRenderContext *rc;
+ GdkPixbuf *pixbuf;
EvPage *page;
ev_debug_message (DEBUG_JOBS, "%d (%p)", job_thumb->page, job);
rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
g_object_unref (page);
- job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (job->document),
- rc, TRUE);
+ pixbuf = ev_document_get_thumbnail (job->document, rc);
g_object_unref (rc);
ev_document_doc_mutex_unlock ();
+ job_thumb->thumbnail = ev_document_misc_get_thumbnail_frame (-1, -1, pixbuf);
+ g_object_unref (pixbuf);
+
ev_job_succeeded (job);
return FALSE;
#include <gtk/gtk.h>
#include "ev-document-misc.h"
-#include "ev-document-thumbnails.h"
#include "ev-job-scheduler.h"
#include "ev-sidebar-page.h"
#include "ev-sidebar-thumbnails.h"
EvDocument *document = ev_document_model_get_document (model);
EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
- if (!EV_IS_DOCUMENT_THUMBNAILS (document) ||
- ev_document_get_n_pages (document) <= 0 ||
+ if (ev_document_get_n_pages (document) <= 0 ||
!ev_document_check_dimensions (document)) {
return;
}
ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page,
EvDocument *document)
{
- return (EV_IS_DOCUMENT_THUMBNAILS (document));
+ return TRUE;
}
static const gchar*
#include "ev-document-fonts.h"
#include "ev-document-images.h"
#include "ev-document-links.h"
-#include "ev-document-thumbnails.h"
#include "ev-document-annotations.h"
#include "ev-document-type-builtins.h"
#include "ev-document-misc.h"
gint rotation;
EvDocument *document = ev_window->priv->document;
- if (!EV_IS_DOCUMENT_THUMBNAILS (document) ||
- ev_document_get_n_pages (document) <= 0 ||
+ if (ev_document_get_n_pages (document) <= 0 ||
!ev_document_check_dimensions (document)) {
return;
}
ev_document_get_page_size (document, 0, &width, &height);
rc = ev_render_context_new (page, 0, size / width);
- pixbuf = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (document),
- rc, FALSE);
+ pixbuf = ev_document_get_thumbnail (document, rc);
g_object_unref (rc);
g_object_unref (page);
return -2;
}
- if (!EV_IS_DOCUMENT_THUMBNAILS (document)) {
- g_object_unref (document);
- ev_shutdown ();
- return -2;
- }
-
if (EV_IS_ASYNC_RENDERER (document)) {
struct AsyncData data;