diff options
author | Kristian Høgsberg <krh@redhat.com> | 2005-06-20 17:58:38 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2005-06-20 17:58:38 +0000 |
commit | bbf2fe757f0fd08d0e90e3810709ab7152c779c0 (patch) | |
tree | 1738ca5fe49fddd0bbb8ef964667e32d21bbd634 | |
parent | c264d8a9f84587cd0f2ef67683a01fc8dd9395af (diff) |
2005-06-20 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-page.cc:
* glib/poppler-page.h:
* glib/poppler.h: Clean up glib rotation implementation and add a
getter for rotation. Patch from Marco.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | glib/poppler-page.cc | 69 | ||||
-rw-r--r-- | glib/poppler-page.h | 57 | ||||
-rw-r--r-- | glib/poppler.h | 1 |
4 files changed, 75 insertions, 59 deletions
@@ -1,5 +1,12 @@ 2005-06-20 Kristian Høgsberg <krh@redhat.com> + * glib/poppler-page.cc: + * glib/poppler-page.h: + * glib/poppler.h: Clean up glib rotation implementation and add a + getter for rotation. Patch from Marco. + +2005-06-20 Kristian Høgsberg <krh@redhat.com> + * glib/poppler-document.cc: * poppler/FontInfo.cc: Fixes from Marco to handle fonts without name (typically type 3 fonts) and fix an iterator bug. diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 3f22908f..65542a3c 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -46,27 +46,6 @@ struct _PopplerPageClass G_DEFINE_TYPE (PopplerPage, poppler_page, G_TYPE_OBJECT); -PopplerPage * -_poppler_page_new (PopplerDocument *document, Page *page, int index) -{ - PopplerPage *poppler_page; - - g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL); - - poppler_page = (PopplerPage *) g_object_new (POPPLER_TYPE_PAGE, NULL); - poppler_page->document = document; - poppler_page->page = page; - poppler_page->index = index; - - return poppler_page; -} - -static void -poppler_page_finalize (GObject *object) -{ - /* page->page is owned by the document */ -} - static PopplerOrientation get_document_orientation (PopplerPage *page) { @@ -90,6 +69,28 @@ get_document_orientation (PopplerPage *page) return orientation; } +PopplerPage * +_poppler_page_new (PopplerDocument *document, Page *page, int index) +{ + PopplerPage *poppler_page; + + g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL); + + poppler_page = (PopplerPage *) g_object_new (POPPLER_TYPE_PAGE, NULL); + poppler_page->document = document; + poppler_page->page = page; + poppler_page->index = index; + poppler_page->orientation = get_document_orientation (poppler_page); + + return poppler_page; +} + +static void +poppler_page_finalize (GObject *object) +{ + /* page->page is owned by the document */ +} + static int poppler_page_get_rotate (PopplerPage *page) { @@ -120,18 +121,11 @@ poppler_page_get_size (PopplerPage *page, double *width, double *height) { - PopplerOrientation orientation; double page_width, page_height; g_return_if_fail (POPPLER_IS_PAGE (page)); - if (page->orientation == POPPLER_ORIENTATION_DOCUMENT) { - orientation = get_document_orientation (page); - } else { - orientation = page->orientation; - } - - switch (orientation) { + switch (page->orientation) { case POPPLER_ORIENTATION_PORTRAIT: case POPPLER_ORIENTATION_UPSIDEDOWN: page_width = page->page->getWidth (); @@ -544,7 +538,6 @@ poppler_page_class_init (PopplerPageClass *klass) static void poppler_page_init (PopplerPage *page) { - page->orientation = POPPLER_ORIENTATION_DOCUMENT; } @@ -643,6 +636,22 @@ poppler_page_set_orientation (PopplerPage *page, page->orientation = orientation; } +/** + * poppler_page_get_orientation: + * @page: a #PopplerPage + * @orientation: a #PopplerOrientation + * + * Return the orientation of the specified page + * + * Return value: a #PopplerOrientation + **/ +PopplerOrientation +poppler_page_get_orientation (PopplerPage *page) +{ + g_return_val_if_fail (POPPLER_IS_PAGE (page), POPPLER_ORIENTATION_PORTRAIT); + + return page->orientation; +} /* PopplerRectangle type */ GType diff --git a/glib/poppler-page.h b/glib/poppler-page.h index 474ac469..8f0d4d3c 100644 --- a/glib/poppler-page.h +++ b/glib/poppler-page.h @@ -32,34 +32,35 @@ G_BEGIN_DECLS #define POPPLER_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_PAGE)) -GType poppler_page_get_type (void) G_GNUC_CONST; -void poppler_page_render_to_pixbuf (PopplerPage *page, - int src_x, - int src_y, - int src_width, - int src_height, - double scale, - GdkPixbuf *pixbuf, - int dest_x, - int dest_y); -void poppler_page_get_size (PopplerPage *page, - double *width, - double *height); -void poppler_page_set_orientation (PopplerPage *page, - PopplerOrientation orientation); -int poppler_page_get_index (PopplerPage *page); -GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page); -gboolean poppler_page_get_thumbnail_size (PopplerPage *page, - int *width, - int *height); -GList *poppler_page_find_text (PopplerPage *page, - const char *text); -void poppler_page_render_to_ps (PopplerPage *page, - PopplerPSFile *ps_file); -char *poppler_page_get_text (PopplerPage *page, - PopplerRectangle *rect); -GList *poppler_page_get_link_mapping (PopplerPage *page); -void poppler_page_free_link_mapping (GList *list); +GType poppler_page_get_type (void) G_GNUC_CONST; +void poppler_page_render_to_pixbuf (PopplerPage *page, + int src_x, + int src_y, + int src_width, + int src_height, + double scale, + GdkPixbuf *pixbuf, + int dest_x, + int dest_y); +void poppler_page_get_size (PopplerPage *page, + double *width, + double *height); +PopplerOrientation poppler_page_get_orientation (PopplerPage *page); +void poppler_page_set_orientation (PopplerPage *page, + PopplerOrientation orientation); +int poppler_page_get_index (PopplerPage *page); +GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page); +gboolean poppler_page_get_thumbnail_size (PopplerPage *page, + int *width, + int *height); +GList *poppler_page_find_text (PopplerPage *page, + const char *text); +void poppler_page_render_to_ps (PopplerPage *page, + PopplerPSFile *ps_file); +char *poppler_page_get_text (PopplerPage *page, + PopplerRectangle *rect); +GList *poppler_page_get_link_mapping (PopplerPage *page); +void poppler_page_free_link_mapping (GList *list); /* A rectangle on a page, with coordinates in PDF points. */ diff --git a/glib/poppler.h b/glib/poppler.h index d5c17eae..4d7bfcef 100644 --- a/glib/poppler.h +++ b/glib/poppler.h @@ -36,7 +36,6 @@ typedef enum typedef enum { - POPPLER_ORIENTATION_DOCUMENT, POPPLER_ORIENTATION_PORTRAIT, POPPLER_ORIENTATION_LANDSCAPE, POPPLER_ORIENTATION_UPSIDEDOWN, |