]> www.fi.muni.cz Git - evince.git/blob - libdocument/ev-render-context.c
0072e27955e85ff3dfb482a4e438977919da27fc
[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 "ev-render-context.h"
21
22 static void ev_render_context_init       (EvRenderContext      *rc);
23 static void ev_render_context_class_init (EvRenderContextClass *class);
24
25
26 G_DEFINE_TYPE (EvRenderContext, ev_render_context, G_TYPE_OBJECT);
27
28 static void ev_render_context_init (EvRenderContext *rc) { /* Do Nothing */ }
29
30 static void
31 ev_render_context_dispose (GObject *object)
32 {
33         EvRenderContext *rc;
34
35         rc = (EvRenderContext *) object;
36
37         if (rc->destroy) {
38                 (*rc->destroy) (rc->data);
39                 rc->destroy = NULL;
40         }
41
42         (* G_OBJECT_CLASS (ev_render_context_parent_class)->dispose) (object);
43 }
44
45 static void
46 ev_render_context_class_init (EvRenderContextClass *class)
47 {
48         GObjectClass *oclass;
49
50         oclass = G_OBJECT_CLASS (class);
51
52         oclass->dispose = ev_render_context_dispose;
53 }
54
55
56 EvRenderContext *
57 ev_render_context_new (int           rotation,
58                        gint          page,
59                        gdouble       scale)
60 {
61         EvRenderContext *rc;
62
63         rc = (EvRenderContext *) g_object_new (EV_TYPE_RENDER_CONTEXT, NULL);
64
65         rc->rotation = rotation;
66         rc->page = page;
67         rc->scale = scale;
68
69         return rc;
70 }
71
72 void
73 ev_render_context_set_page (EvRenderContext *rc,
74                             gint             page)
75 {
76         g_return_if_fail (rc != NULL);
77
78         rc->page = page;
79 }
80
81 void
82 ev_render_context_set_rotation (EvRenderContext *rc,
83                                 int              rotation)
84 {
85         g_return_if_fail (rc != NULL);
86
87         rc->rotation = rotation;
88 }
89
90 void
91 ev_render_context_set_scale (EvRenderContext *rc,
92                              gdouble          scale)
93 {
94         g_return_if_fail (rc != NULL);
95
96         rc->scale = scale;
97 }
98