Commit bbf2fe75 authored by Kristian Høgsberg's avatar Kristian Høgsberg

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.
parent c264d8a9
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> 2005-06-20 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-document.cc: * glib/poppler-document.cc:
......
...@@ -46,27 +46,6 @@ struct _PopplerPageClass ...@@ -46,27 +46,6 @@ struct _PopplerPageClass
G_DEFINE_TYPE (PopplerPage, poppler_page, G_TYPE_OBJECT); 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 static PopplerOrientation
get_document_orientation (PopplerPage *page) get_document_orientation (PopplerPage *page)
{ {
...@@ -90,6 +69,28 @@ get_document_orientation (PopplerPage *page) ...@@ -90,6 +69,28 @@ get_document_orientation (PopplerPage *page)
return orientation; 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 static int
poppler_page_get_rotate (PopplerPage *page) poppler_page_get_rotate (PopplerPage *page)
{ {
...@@ -120,18 +121,11 @@ poppler_page_get_size (PopplerPage *page, ...@@ -120,18 +121,11 @@ poppler_page_get_size (PopplerPage *page,
double *width, double *width,
double *height) double *height)
{ {
PopplerOrientation orientation;
double page_width, page_height; double page_width, page_height;
g_return_if_fail (POPPLER_IS_PAGE (page)); g_return_if_fail (POPPLER_IS_PAGE (page));
if (page->orientation == POPPLER_ORIENTATION_DOCUMENT) { switch (page->orientation) {
orientation = get_document_orientation (page);
} else {
orientation = page->orientation;
}
switch (orientation) {
case POPPLER_ORIENTATION_PORTRAIT: case POPPLER_ORIENTATION_PORTRAIT:
case POPPLER_ORIENTATION_UPSIDEDOWN: case POPPLER_ORIENTATION_UPSIDEDOWN:
page_width = page->page->getWidth (); page_width = page->page->getWidth ();
...@@ -544,7 +538,6 @@ poppler_page_class_init (PopplerPageClass *klass) ...@@ -544,7 +538,6 @@ poppler_page_class_init (PopplerPageClass *klass)
static void static void
poppler_page_init (PopplerPage *page) poppler_page_init (PopplerPage *page)
{ {
page->orientation = POPPLER_ORIENTATION_DOCUMENT;
} }
...@@ -643,6 +636,22 @@ poppler_page_set_orientation (PopplerPage *page, ...@@ -643,6 +636,22 @@ poppler_page_set_orientation (PopplerPage *page,
page->orientation = orientation; 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 */ /* PopplerRectangle type */
GType GType
......
...@@ -32,34 +32,35 @@ G_BEGIN_DECLS ...@@ -32,34 +32,35 @@ G_BEGIN_DECLS
#define POPPLER_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_PAGE)) #define POPPLER_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_PAGE))
GType poppler_page_get_type (void) G_GNUC_CONST; GType poppler_page_get_type (void) G_GNUC_CONST;
void poppler_page_render_to_pixbuf (PopplerPage *page, void poppler_page_render_to_pixbuf (PopplerPage *page,
int src_x, int src_x,
int src_y, int src_y,
int src_width, int src_width,
int src_height, int src_height,
double scale, double scale,
GdkPixbuf *pixbuf, GdkPixbuf *pixbuf,
int dest_x, int dest_x,
int dest_y); int dest_y);
void poppler_page_get_size (PopplerPage *page, void poppler_page_get_size (PopplerPage *page,
double *width, double *width,
double *height); double *height);
void poppler_page_set_orientation (PopplerPage *page, PopplerOrientation poppler_page_get_orientation (PopplerPage *page);
PopplerOrientation orientation); void poppler_page_set_orientation (PopplerPage *page,
int poppler_page_get_index (PopplerPage *page); PopplerOrientation orientation);
GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page); int poppler_page_get_index (PopplerPage *page);
gboolean poppler_page_get_thumbnail_size (PopplerPage *page, GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page);
int *width, gboolean poppler_page_get_thumbnail_size (PopplerPage *page,
int *height); int *width,
GList *poppler_page_find_text (PopplerPage *page, int *height);
const char *text); GList *poppler_page_find_text (PopplerPage *page,
void poppler_page_render_to_ps (PopplerPage *page, const char *text);
PopplerPSFile *ps_file); void poppler_page_render_to_ps (PopplerPage *page,
char *poppler_page_get_text (PopplerPage *page, PopplerPSFile *ps_file);
PopplerRectangle *rect); char *poppler_page_get_text (PopplerPage *page,
GList *poppler_page_get_link_mapping (PopplerPage *page); PopplerRectangle *rect);
void poppler_page_free_link_mapping (GList *list); 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. */ /* A rectangle on a page, with coordinates in PDF points. */
......
...@@ -36,7 +36,6 @@ typedef enum ...@@ -36,7 +36,6 @@ typedef enum
typedef enum typedef enum
{ {
POPPLER_ORIENTATION_DOCUMENT,
POPPLER_ORIENTATION_PORTRAIT, POPPLER_ORIENTATION_PORTRAIT,
POPPLER_ORIENTATION_LANDSCAPE, POPPLER_ORIENTATION_LANDSCAPE,
POPPLER_ORIENTATION_UPSIDEDOWN, POPPLER_ORIENTATION_UPSIDEDOWN,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment