]> www.fi.muni.cz Git - evince.git/blob - libdocument/ev-render-context.c
Include config.h. Bug #504721.
[evince.git] / libdocument / ev-render-context.c
1 /* this file is part of evince, a gnome document viewer
2  *
3  *  Copyright (C) 2005 Jonathan Blandford <jrb@gnome.org>
4  *
5  * Evince is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Evince is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include <config.h>
21 #include "ev-render-context.h"
22
23 static void ev_render_context_init       (EvRenderContext      *rc);
24 static void ev_render_context_class_init (EvRenderContextClass *class);
25
26
27 G_DEFINE_TYPE (EvRenderContext, ev_render_context, G_TYPE_OBJECT);
28
29 static void ev_render_context_init (EvRenderContext *rc) { /* Do Nothing */ }
30
31 static void
32 ev_render_context_dispose (GObject *object)
33 {
34         EvRenderContext *rc;
35
36         rc = (EvRenderContext *) object;
37
38         if (rc->destroy) {
39                 (*rc->destroy) (rc->data);
40                 rc->destroy = NULL;
41         }
42
43         (* G_OBJECT_CLASS (ev_render_context_parent_class)->dispose) (object);
44 }
45
46 static void
47 ev_render_context_class_init (EvRenderContextClass *class)
48 {
49         GObjectClass *oclass;
50
51         oclass = G_OBJECT_CLASS (class);
52
53         oclass->dispose = ev_render_context_dispose;
54 }
55
56
57 EvRenderContext *
58 ev_render_context_new (int           rotation,
59                        gint          page,
60                        gdouble       scale)
61 {
62         EvRenderContext *rc;
63
64         rc = (EvRenderContext *) g_object_new (EV_TYPE_RENDER_CONTEXT, NULL);
65
66         rc->rotation = rotation;
67         rc->page = page;
68         rc->scale = scale;
69
70         return rc;
71 }
72
73 void
74 ev_render_context_set_page (EvRenderContext *rc,
75                             gint             page)
76 {
77         g_return_if_fail (rc != NULL);
78
79         rc->page = page;
80 }
81
82 void
83 ev_render_context_set_rotation (EvRenderContext *rc,
84                                 int              rotation)
85 {
86         g_return_if_fail (rc != NULL);
87
88         rc->rotation = rotation;
89 }
90
91 void
92 ev_render_context_set_scale (EvRenderContext *rc,
93                              gdouble          scale)
94 {
95         g_return_if_fail (rc != NULL);
96
97         rc->scale = scale;
98 }
99