poppler 1.0.3-x86-mingw32 → 1.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cFormFieldMapping
25
+
26
+ DEF_ACCESSOR_WITH_SETTER(form_field_mapping, area,
27
+ RVAL2POPPLERFORMFIELDMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
28
+ DEF_ACCESSOR(form_field_mapping, field, RVAL2POPPLERFORMFIELDMAPPING,
29
+ POPPLERFORMFIELD2RVAL, RVAL2POPPLERFORMFIELD)
30
+
31
+ void
32
+ Init_poppler_formfieldmapping(VALUE mPoppler)
33
+ {
34
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD_MAPPING,
35
+ "FormFieldMapping", mPoppler);
36
+
37
+ rb_define_method(RG_TARGET_NAMESPACE, "area", form_field_mapping_get_area, 0);
38
+ rb_define_method(RG_TARGET_NAMESPACE, "field", form_field_mapping_get_field,
39
+ 0);
40
+
41
+ rb_define_method(RG_TARGET_NAMESPACE, "set_area",
42
+ form_field_mapping_set_area, 1);
43
+ rb_define_method(RG_TARGET_NAMESPACE, "set_field",
44
+ form_field_mapping_set_field, 1);
45
+
46
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
47
+ }
@@ -0,0 +1,55 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cImageMapping
25
+
26
+ DEF_ACCESSOR_WITH_SETTER(image_mapping, area,
27
+ RVAL2POPPLERIMAGEMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
28
+ DEF_ACCESSOR(image_mapping, image_id, RVAL2POPPLERIMAGEMAPPING, INT2NUM, NUM2INT)
29
+ #ifdef RB_POPPLER_CAIRO_AVAILABLE
30
+ static VALUE
31
+ rg_image(VALUE self)
32
+ {
33
+ return rb_funcall(rb_iv_get(self, "@page"), rb_intern("get_image"),
34
+ 1, INT2NUM(RVAL2POPPLERIMAGEMAPPING(self)->image_id));
35
+ }
36
+ #endif
37
+
38
+ void
39
+ Init_poppler_imagemapping(VALUE mPoppler)
40
+ {
41
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_IMAGE_MAPPING,
42
+ "ImageMapping", mPoppler);
43
+
44
+ rb_define_method(RG_TARGET_NAMESPACE, "area", image_mapping_get_area, 0);
45
+ rb_define_method(RG_TARGET_NAMESPACE, "image_id", image_mapping_get_image_id, 0);
46
+ #ifdef RB_POPPLER_CAIRO_AVAILABLE
47
+ RG_DEF_METHOD(image, 0);
48
+ #endif
49
+
50
+ rb_define_method(RG_TARGET_NAMESPACE, "set_area", image_mapping_set_area, 1);
51
+ rb_define_method(RG_TARGET_NAMESPACE, "set_image_id",
52
+ image_mapping_set_image_id, 1);
53
+
54
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
55
+ }
@@ -0,0 +1,130 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cIndexIter
25
+
26
+ static VALUE RG_TARGET_NAMESPACE;
27
+
28
+ static ID id_valid;
29
+
30
+ /* Interface for getting the Index of a poppler_document */
31
+ #define CHECK_IITER_IS_VALID(iter) do { \
32
+ if (!RVAL2CBOOL(rg_valid_p(iter))) \
33
+ return Qnil; \
34
+ } while (0)
35
+
36
+ static VALUE
37
+ rg_valid_p(VALUE self)
38
+ {
39
+ return rb_ivar_get(self, id_valid);
40
+ }
41
+
42
+ static VALUE
43
+ rg_initialize(VALUE self, VALUE document)
44
+ {
45
+ PopplerIndexIter *iter;
46
+ iter = poppler_index_iter_new(RVAL2POPPLERDOCUMENT(document));
47
+ G_INITIALIZE(self, iter);
48
+ poppler_index_iter_free(iter);
49
+ rb_ivar_set(self, id_valid, CBOOL2RVAL(iter));
50
+ return Qnil;
51
+ }
52
+
53
+ static VALUE
54
+ rg_child(VALUE self)
55
+ {
56
+ PopplerIndexIter *child;
57
+ VALUE rb_child;
58
+
59
+ CHECK_IITER_IS_VALID(self);
60
+ child = poppler_index_iter_get_child(RVAL2POPPLERINDEXITER(self));
61
+ rb_child = POPPLERINDEXITER2RVAL(child);
62
+ poppler_index_iter_free(child);
63
+ return rb_child;
64
+ }
65
+
66
+ static VALUE
67
+ rg_open_p(VALUE self)
68
+ {
69
+ CHECK_IITER_IS_VALID(self);
70
+ return CBOOL2RVAL(poppler_index_iter_is_open(RVAL2POPPLERINDEXITER(self)));
71
+ }
72
+
73
+ #ifndef HAVE_TYPE_POPPLERACTIONANY
74
+ static VALUE
75
+ rg_action(VALUE self)
76
+ {
77
+ CHECK_IITER_IS_VALID(self);
78
+ return POPPLERACTION2RVAL(poppler_index_iter_get_action(RVAL2POPPLERINDEXITER(self)));
79
+ }
80
+ #endif
81
+
82
+ static VALUE
83
+ rg_next(VALUE self)
84
+ {
85
+ if (poppler_index_iter_next(RVAL2POPPLERINDEXITER(self))) {
86
+ return Qtrue;
87
+ } else {
88
+ rb_ivar_set(self, id_valid, Qfalse);
89
+ return Qfalse;
90
+ }
91
+ }
92
+
93
+ static VALUE
94
+ rg_each(VALUE self)
95
+ {
96
+ PopplerIndexIter *iter;
97
+
98
+ CHECK_IITER_IS_VALID(self);
99
+ iter = RVAL2POPPLERINDEXITER(self);
100
+ do {
101
+ rb_yield(self);
102
+ } while (poppler_index_iter_next(iter));
103
+ rb_ivar_set(self, id_valid, Qfalse);
104
+
105
+ return self;
106
+ }
107
+
108
+ void
109
+ Init_poppler_indexiter(VALUE mPoppler)
110
+ {
111
+ id_valid = rb_intern("valid?");
112
+
113
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_INDEX_ITER, "IndexIter", mPoppler);
114
+
115
+ /* Interface for getting the Index of a poppler_document */
116
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
117
+
118
+ RG_DEF_METHOD(initialize, 1);
119
+ RG_DEF_METHOD(child, 0);
120
+ RG_DEF_METHOD_P(open, 0);
121
+ #ifndef HAVE_TYPE_POPPLERACTIONANY
122
+ RG_DEF_METHOD(action, 0);
123
+ #endif
124
+ RG_DEF_METHOD(next, 0);
125
+
126
+ RG_DEF_METHOD_P(valid, 0);
127
+ RG_DEF_METHOD(each, 0);
128
+
129
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
130
+ }
@@ -0,0 +1,50 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cLinkMapping
25
+
26
+ void
27
+ rectangle_set(PopplerRectangle *rect, VALUE rb_rect)
28
+ {
29
+ *rect = *(RVAL2POPPLERRECTANGLE(rb_rect));
30
+ }
31
+
32
+ DEF_ACCESSOR_WITH_SETTER(link_mapping, area,
33
+ RVAL2POPPLERLINKMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
34
+ DEF_ACCESSOR(link_mapping, action, RVAL2POPPLERLINKMAPPING,
35
+ POPPLERACTION2RVAL, RVAL2POPPLERACTION)
36
+
37
+ void
38
+ Init_poppler_linkmapping(VALUE mPoppler)
39
+ {
40
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_LINK_MAPPING, "LinkMapping",
41
+ mPoppler);
42
+
43
+ rb_define_method(RG_TARGET_NAMESPACE, "area", link_mapping_get_area, 0);
44
+ rb_define_method(RG_TARGET_NAMESPACE, "action", link_mapping_get_action, 0);
45
+
46
+ rb_define_method(RG_TARGET_NAMESPACE, "set_area", link_mapping_set_area, 1);
47
+ rb_define_method(RG_TARGET_NAMESPACE, "set_action", link_mapping_set_action, 1);
48
+
49
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
50
+ }
@@ -1,76 +1,36 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /**********************************************************************
3
-
4
- rbpoppler-page.c -
5
-
6
- Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
7
-
8
- **********************************************************************/
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
9
21
 
10
22
  #include "rbpoppler-private.h"
11
23
 
12
- #define SELF(self) (POPPLER_PAGE(RVAL2GOBJ(self)))
24
+ #define RG_TARGET_NAMESPACE cPage
25
+ #define SELF(self) (RVAL2POPPLERPAGE(self))
13
26
 
14
27
  #ifndef GDK_TYPE_REGION
15
28
  extern GType gdk_region_get_type(void);
16
29
  # define GDK_TYPE_REGION (gdk_region_get_type())
17
30
  #endif
18
31
 
19
- #define GDK_REGION2RVAL(obj) (BOXED2RVAL(obj, GDK_TYPE_REGION))
20
- #define RVAL2GDK_PIXBUF(pixbuf) (GDK_PIXBUF(RVAL2GOBJ(pixbuf)))
21
-
22
-
23
- #define SEL_STYLE2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_SELECTION_STYLE))
24
- #define RVAL2SEL_STYLE(obj) (RVAL2GENUM(obj, POPPLER_TYPE_SELECTION_STYLE))
25
-
26
- #define RVAL2TRANS(obj) ((PopplerPageTransition *)RVAL2BOXED(obj, POPPLER_TYPE_PAGE_TRANSITION))
27
- #define TRANS2RVAL(obj) (BOXED2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION))
28
- #define RVAL2LM(obj) ((PopplerLinkMapping *)RVAL2BOXED(obj, POPPLER_TYPE_LINK_MAPPING))
29
- #define RVAL2IM(obj) ((PopplerImageMapping *)RVAL2BOXED(obj, POPPLER_TYPE_IMAGE_MAPPING))
30
- #define RVAL2FFM(obj) ((PopplerFormFieldMapping *)RVAL2BOXED(obj, POPPLER_TYPE_FORM_FIELD_MAPPING))
31
- #define RVAL2AM(obj) ((PopplerAnnotMapping *)RVAL2BOXED(obj, POPPLER_TYPE_ANNOT_MAPPING))
32
-
33
- #define TT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION_TYPE))
34
- #define RVAL2TT(obj) (RVAL2GENUM(obj, POPPLER_TYPE_PAGE_TRANSITION_TYPE))
35
- #define TA2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT))
36
- #define RVAL2TA(obj) (RVAL2GENUM(obj, POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT))
37
- #define TD2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION_DIRECTION))
38
- #define RVAL2TD(obj) (RVAL2GENUM(obj, POPPLER_TYPE_PAGE_TRANSITION_DIRECTION))
39
-
40
- static VALUE cPSFile, cRectangle;
41
-
42
- #ifdef POPPLER_TYPE_COLOR
43
- VALUE rb_cPopplerColor;
44
-
45
- PopplerColor *
46
- rb_poppler_ruby_object_to_color(VALUE color)
47
- {
48
- #ifdef POPPLER_WITH_GDK
49
- if (RTEST(rb_obj_is_kind_of(color, rb_cGdkColor))) {
50
- GdkColor *gdk_color;
51
-
52
- gdk_color = RVAL2GDKCOLOR(color);
53
- color = rb_funcall(rb_cPopplerColor, rb_intern("new"),
54
- 3,
55
- UINT2NUM(gdk_color->red),
56
- UINT2NUM(gdk_color->green),
57
- UINT2NUM(gdk_color->blue));
58
- }
59
- #endif
60
-
61
- return RVAL2BOXED(color, POPPLER_TYPE_COLOR);
62
- }
63
-
64
- VALUE
65
- rb_poppler_ruby_object_from_color_with_free(PopplerColor *color)
66
- {
67
- VALUE rb_color;
68
-
69
- rb_color = POPPLER_COLOR2RVAL(color);
70
- g_free(color);
71
- return rb_color;
72
- }
73
- #endif
32
+ static VALUE cRectangle;
33
+ static VALUE cPSFile;
74
34
 
75
35
  #ifdef POPPLER_WITH_GDK
76
36
  static VALUE
@@ -81,7 +41,7 @@ page_render_to_pixbuf(VALUE self, VALUE src_x, VALUE src_y, VALUE src_width,
81
41
  poppler_page_render_to_pixbuf(SELF(self), NUM2INT(src_x),
82
42
  NUM2INT(src_y), NUM2INT(src_width),
83
43
  NUM2INT(src_height), NUM2DBL(scale),
84
- NUM2INT(rotation), RVAL2GOBJ(pixbuf));
44
+ NUM2INT(rotation), RVAL2GDKPIXBUF(pixbuf));
85
45
  return Qnil;
86
46
  }
87
47
  #endif
@@ -98,12 +58,12 @@ page_render(VALUE self, VALUE cairo)
98
58
  static VALUE
99
59
  page_render_to_ps(VALUE self, VALUE ps_file)
100
60
  {
101
- poppler_page_render_to_ps(SELF(self), RVAL2GOBJ(ps_file));
61
+ poppler_page_render_to_ps(SELF(self), RVAL2POPPLERPSFILE(ps_file));
102
62
  return Qnil;
103
63
  }
104
64
 
105
65
  static VALUE
106
- page_render_generic(int argc, VALUE *argv, VALUE self)
66
+ rg_render(int argc, VALUE *argv, VALUE self)
107
67
  {
108
68
  if (argc == 1) {
109
69
  if (RVAL2CBOOL(rb_obj_is_kind_of(argv[0], cPSFile))) {
@@ -120,28 +80,28 @@ page_render_generic(int argc, VALUE *argv, VALUE self)
120
80
  return page_render_to_pixbuf(self, argv[0], argv[1], argv[2], argv[3],
121
81
  argv[4], argv[5], argv[6]);
122
82
  #else
123
- rb_raise(rb_eArgError, "GDK is not available");
83
+ rb_raise(rb_eArgError, "GDK is not available");
124
84
  #endif
125
85
  } else {
126
86
  rb_raise(rb_eArgError,
127
87
  "wrong number of arguments (%d for 1 or 7)",
128
- argc);
88
+ argc);
129
89
  }
130
90
  }
131
91
 
132
92
  #ifdef POPPLER_WITH_GDK
133
93
  static VALUE
134
94
  page_render_to_pixbuf_for_printing(VALUE self, VALUE src_x, VALUE src_y,
135
- VALUE src_width, VALUE src_height,
136
- VALUE scale, VALUE rotation, VALUE pixbuf)
95
+ VALUE src_width, VALUE src_height,
96
+ VALUE scale, VALUE rotation, VALUE pixbuf)
137
97
  {
138
98
  poppler_page_render_to_pixbuf_for_printing(SELF(self), NUM2INT(src_x),
139
- NUM2INT(src_y),
140
- NUM2INT(src_width),
141
- NUM2INT(src_height),
142
- NUM2DBL(scale),
143
- NUM2INT(rotation),
144
- RVAL2GOBJ(pixbuf));
99
+ NUM2INT(src_y),
100
+ NUM2INT(src_width),
101
+ NUM2INT(src_height),
102
+ NUM2DBL(scale),
103
+ NUM2INT(rotation),
104
+ RVAL2GDKPIXBUF(pixbuf));
145
105
  return Qnil;
146
106
  }
147
107
  #endif
@@ -156,21 +116,21 @@ page_render_for_printing(VALUE self, VALUE cairo)
156
116
  #endif
157
117
 
158
118
  static VALUE
159
- page_render_for_printing_generic(int argc, VALUE *argv, VALUE self)
119
+ rg_render_for_printing(int argc, VALUE *argv, VALUE self)
160
120
  {
161
121
  if (argc == 1) {
162
122
  #ifdef RB_POPPLER_CAIRO_AVAILABLE
163
- return page_render_for_printing(self, argv[0]);
123
+ return page_render_for_printing(self, argv[0]);
164
124
  #else
165
- rb_raise(rb_eArgError, "cairo is not available");
125
+ rb_raise(rb_eArgError, "cairo is not available");
166
126
  #endif
167
127
  } else if (argc == 7) {
168
128
  #ifdef POPPLER_WITH_GDK
169
129
  return page_render_to_pixbuf_for_printing(self, argv[0], argv[1],
170
- argv[2], argv[3],
171
- argv[4], argv[5], argv[6]);
130
+ argv[2], argv[3],
131
+ argv[4], argv[5], argv[6]);
172
132
  #else
173
- rb_raise(rb_eArgError, "GDK is not available");
133
+ rb_raise(rb_eArgError, "GDK is not available");
174
134
  #endif
175
135
  } else {
176
136
  rb_raise(rb_eArgError,
@@ -187,13 +147,13 @@ page_render_selection(VALUE self, VALUE cairo,
187
147
  PopplerRectangle *old_selection = NULL;
188
148
 
189
149
  if (!NIL_P(rb_old_selection))
190
- old_selection = RVAL2POPPLER_RECT(rb_old_selection);
150
+ old_selection = RVAL2POPPLERRECTANGLE(rb_old_selection);
191
151
  poppler_page_render_selection(SELF(self), RVAL2CRCONTEXT(cairo),
192
- RVAL2POPPLER_RECT(selection),
152
+ RVAL2POPPLERRECTANGLE(selection),
193
153
  old_selection,
194
- RVAL2SEL_STYLE(style),
195
- RVAL2POPPLER_COLOR(glyph_color),
196
- RVAL2POPPLER_COLOR(background_color));
154
+ RVAL2POPPLERSELECTIONSTYLE(style),
155
+ RVAL2POPPLERCOLOR(glyph_color),
156
+ RVAL2POPPLERCOLOR(background_color));
197
157
  return Qnil;
198
158
  }
199
159
  #endif
@@ -209,14 +169,14 @@ page_render_selection_to_pixbuf(VALUE self, VALUE scale, VALUE rotation,
209
169
  PopplerRectangle *old_selection = NULL;
210
170
 
211
171
  if (!NIL_P(rb_old_selection))
212
- old_selection = RVAL2POPPLER_RECT(rb_old_selection);
172
+ old_selection = RVAL2POPPLERRECTANGLE(rb_old_selection);
213
173
  poppler_page_render_selection_to_pixbuf(SELF(self),
214
174
  NUM2DBL(scale),
215
175
  NUM2INT(rotation),
216
- RVAL2GOBJ(pixbuf),
217
- RVAL2POPPLER_RECT(selection),
176
+ RVAL2GDKPIXBUF(pixbuf),
177
+ RVAL2POPPLERRECTANGLE(selection),
218
178
  old_selection,
219
- RVAL2SEL_STYLE(style),
179
+ RVAL2POPPLERSELECTIONSTYLE(style),
220
180
  RVAL2GDKCOLOR(glyph_color),
221
181
  RVAL2GDKCOLOR(background_color));
222
182
  return Qnil;
@@ -224,7 +184,7 @@ page_render_selection_to_pixbuf(VALUE self, VALUE scale, VALUE rotation,
224
184
  #endif
225
185
 
226
186
  static VALUE
227
- page_render_selection_generic(int argc, VALUE *argv, VALUE self)
187
+ rg_render_selection(int argc, VALUE *argv, VALUE self)
228
188
  {
229
189
  if (argc == 6) {
230
190
  #ifdef RB_POPPLER_CAIRO_AVAILABLE
@@ -248,7 +208,7 @@ page_render_selection_generic(int argc, VALUE *argv, VALUE self)
248
208
  }
249
209
 
250
210
  static VALUE
251
- page_get_size(VALUE self)
211
+ rg_size(VALUE self)
252
212
  {
253
213
  double width, height;
254
214
  poppler_page_get_size(SELF(self), &width, &height);
@@ -256,26 +216,26 @@ page_get_size(VALUE self)
256
216
  }
257
217
 
258
218
  static VALUE
259
- page_get_index(VALUE self)
219
+ rg_index(VALUE self)
260
220
  {
261
221
  return INT2NUM(poppler_page_get_index(SELF(self)));
262
222
  }
263
223
 
264
224
  static VALUE
265
- page_get_duration(VALUE self)
225
+ rg_duration(VALUE self)
266
226
  {
267
227
  return rb_float_new(poppler_page_get_duration(SELF(self)));
268
228
  }
269
229
 
270
230
  static VALUE
271
- page_get_transition(VALUE self)
231
+ rg_transition(VALUE self)
272
232
  {
273
- return TRANS2RVAL(poppler_page_get_transition(SELF(self)));
233
+ return POPPLERPAGETRANSITION2RVAL(poppler_page_get_transition(SELF(self)));
274
234
  }
275
235
 
276
236
  #if RB_POPPLER_CAIRO_AVAILABLE
277
237
  static VALUE
278
- page_get_thumbnail(VALUE self)
238
+ rg_thumbnail(VALUE self)
279
239
  {
280
240
  return CRSURFACE2RVAL(poppler_page_get_thumbnail(SELF(self)));
281
241
  }
@@ -283,14 +243,14 @@ page_get_thumbnail(VALUE self)
283
243
 
284
244
  #ifdef POPPLER_WITH_GDK
285
245
  static VALUE
286
- page_get_thumbnail_pixbuf(VALUE self)
246
+ rg_thumbnail_pixbuf(VALUE self)
287
247
  {
288
248
  return GOBJ2RVAL(poppler_page_get_thumbnail_pixbuf(SELF(self)));
289
249
  }
290
250
  #endif
291
251
 
292
252
  static VALUE
293
- page_get_thumbnail_size(VALUE self)
253
+ rg_thumbnail_size(VALUE self)
294
254
  {
295
255
  int width, height;
296
256
 
@@ -301,14 +261,14 @@ page_get_thumbnail_size(VALUE self)
301
261
  }
302
262
 
303
263
  static VALUE
304
- page_find_text(VALUE self, VALUE text)
264
+ rg_find_text(VALUE self, VALUE text)
305
265
  {
306
266
  return GLIST2ARY2F(poppler_page_find_text(SELF(self), RVAL2CSTR(text)),
307
267
  POPPLER_TYPE_RECTANGLE);
308
268
  }
309
269
 
310
270
  static VALUE
311
- page_get_text(int argc, VALUE *argv, VALUE self)
271
+ rg_get_text(int argc, VALUE *argv, VALUE self)
312
272
  {
313
273
  gchar *text;
314
274
  PopplerSelectionStyle style = POPPLER_SELECTION_GLYPH;
@@ -326,7 +286,7 @@ page_get_text(int argc, VALUE *argv, VALUE self)
326
286
  } else {
327
287
  rb_rect = Qnil;
328
288
  if (!NIL_P(arg2)) {
329
- style = RVAL2SEL_STYLE(arg2);
289
+ style = RVAL2POPPLERSELECTIONSTYLE(arg2);
330
290
  }
331
291
  }
332
292
  }
@@ -350,7 +310,7 @@ page_get_text(int argc, VALUE *argv, VALUE self)
350
310
  } else {
351
311
  PopplerRectangle *rect;
352
312
 
353
- rect = RVAL2POPPLER_RECT(rb_rect);
313
+ rect = RVAL2POPPLERRECTANGLE(rb_rect);
354
314
  #if POPPLER_CHECK_VERSION(0, 15, 0)
355
315
  text = poppler_page_get_selected_text(page, style, rect);
356
316
  #else
@@ -364,24 +324,24 @@ page_get_text(int argc, VALUE *argv, VALUE self)
364
324
  }
365
325
 
366
326
  static VALUE
367
- page_get_selection_region(VALUE self, VALUE scale, VALUE style, VALUE selection)
327
+ rg_get_selection_region(VALUE self, VALUE scale, VALUE style, VALUE selection)
368
328
  {
369
329
  return GLIST2ARY2F(poppler_page_get_selection_region(SELF(self),
370
- NUM2DBL(scale),
371
- RVAL2SEL_STYLE(style),
372
- RVAL2POPPLER_RECT(selection)),
373
- POPPLER_TYPE_RECTANGLE);
330
+ NUM2DBL(scale),
331
+ RVAL2POPPLERSELECTIONSTYLE(style),
332
+ RVAL2POPPLERRECTANGLE(selection)),
333
+ POPPLER_TYPE_RECTANGLE);
374
334
  }
375
335
 
376
336
  static VALUE
377
- page_get_link_mapping(VALUE self)
337
+ rg_link_mapping(VALUE self)
378
338
  {
379
339
  return GLIST2ARY2F(poppler_page_get_link_mapping(SELF(self)),
380
340
  POPPLER_TYPE_LINK_MAPPING);
381
341
  }
382
342
 
383
343
  static VALUE
384
- page_get_image_mapping(VALUE self)
344
+ rg_image_mapping(VALUE self)
385
345
  {
386
346
  VALUE mappings;
387
347
  GList *image_mapping, *node;
@@ -389,15 +349,15 @@ page_get_image_mapping(VALUE self)
389
349
  mappings = rb_ary_new();
390
350
  image_mapping = poppler_page_get_image_mapping(SELF(self));
391
351
  for (node = image_mapping; node; node = g_list_next(node)) {
392
- PopplerImageMapping *image_mapping;
393
- VALUE mapping;
352
+ PopplerImageMapping *image_mapping;
353
+ VALUE mapping;
394
354
 
395
- image_mapping = node->data;
396
- mapping = BOXED2RVAL(image_mapping, POPPLER_TYPE_IMAGE_MAPPING);
355
+ image_mapping = node->data;
356
+ mapping = POPPLERIMAGEMAPPING2RVAL(image_mapping);
397
357
  #ifdef RB_POPPLER_CAIRO_AVAILABLE
398
- rb_iv_set(mapping, "@page", self);
358
+ rb_iv_set(mapping, "@page", self);
399
359
  #endif
400
- rb_ary_push(mappings, mapping);
360
+ rb_ary_push(mappings, mapping);
401
361
  }
402
362
  poppler_page_free_image_mapping(image_mapping);
403
363
 
@@ -406,377 +366,69 @@ page_get_image_mapping(VALUE self)
406
366
 
407
367
  #ifdef RB_POPPLER_CAIRO_AVAILABLE
408
368
  static VALUE
409
- _page_get_image(VALUE self, gint image_id)
369
+ rg_get_image(VALUE self, VALUE image_id)
410
370
  {
411
- return CRSURFACE2RVAL(poppler_page_get_image(SELF(self), image_id));
412
- }
413
-
414
- static VALUE
415
- page_get_image(VALUE self, VALUE image_id)
416
- {
417
- return _page_get_image(self, NUM2INT(image_id));
371
+ return CRSURFACE2RVAL(poppler_page_get_image(SELF(self), NUM2INT(image_id)));
418
372
  }
419
373
  #endif
420
374
 
421
375
  static VALUE
422
- page_get_form_field_mapping(VALUE self)
376
+ rg_form_field_mapping(VALUE self)
423
377
  {
424
378
  return GLIST2ARY2F(poppler_page_get_form_field_mapping(SELF(self)),
425
379
  POPPLER_TYPE_FORM_FIELD_MAPPING);
426
380
  }
427
381
 
428
382
  static VALUE
429
- page_get_annot_mapping(VALUE self)
383
+ rg_annotation_mapping(VALUE self)
430
384
  {
431
385
  return GLIST2ARY2F(poppler_page_get_annot_mapping(SELF(self)),
432
386
  POPPLER_TYPE_ANNOT_MAPPING);
433
387
  }
434
388
 
435
389
  static VALUE
436
- page_get_crop_box(VALUE self)
390
+ rg_crop_box(VALUE self)
437
391
  {
438
392
  PopplerRectangle rect;
439
393
 
440
394
  poppler_page_get_crop_box(SELF(self), &rect);
441
- return POPPLER_RECT2RVAL(&rect);
442
- }
443
-
444
-
445
- /* A rectangle on a page, with coordinates in PDF points. */
446
- static VALUE
447
- rectangle_initialize(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2)
448
- {
449
- PopplerRectangle rectangle;
450
-
451
- rectangle.x1 = NUM2DBL(x1);
452
- rectangle.y1 = NUM2DBL(y1);
453
- rectangle.x2 = NUM2DBL(x2);
454
- rectangle.y2 = NUM2DBL(y2);
455
-
456
- G_INITIALIZE(self, &rectangle);
457
- return Qnil;
458
- }
459
-
460
- DEF_ACCESSOR(rectangle, x1, RVAL2POPPLER_RECT, rb_float_new, NUM2DBL)
461
- DEF_ACCESSOR(rectangle, y1, RVAL2POPPLER_RECT, rb_float_new, NUM2DBL)
462
- DEF_ACCESSOR(rectangle, x2, RVAL2POPPLER_RECT, rb_float_new, NUM2DBL)
463
- DEF_ACCESSOR(rectangle, y2, RVAL2POPPLER_RECT, rb_float_new, NUM2DBL)
464
-
465
- static VALUE
466
- rectangle_to_a(VALUE self)
467
- {
468
- PopplerRectangle *rectangle = RVAL2POPPLER_RECT(self);
469
- return rb_ary_new3(4,
470
- rb_float_new(rectangle->x1),
471
- rb_float_new(rectangle->y1),
472
- rb_float_new(rectangle->x2),
473
- rb_float_new(rectangle->y2));
474
- }
475
-
476
- static VALUE
477
- rectangle_inspect(VALUE self)
478
- {
479
- VALUE inspected;
480
- gchar *points;
481
- PopplerRectangle *rectangle;
482
-
483
- rectangle = RVAL2POPPLER_RECT(self);
484
- inspected = rb_call_super(0, NULL);
485
- rb_str_resize(inspected, RSTRING_LEN(inspected) - 1);
486
- points = g_strdup_printf(": [%g, %g, %g, %g]>",
487
- rectangle->x1, rectangle->y1,
488
- rectangle->x2, rectangle->y2);
489
- rb_str_cat2(inspected, points);
490
- g_free(points);
491
- return inspected;
492
- }
493
-
494
-
495
- #ifdef POPPLER_TYPE_COLOR
496
- /* A color in RGB */
497
- static VALUE
498
- color_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
499
- {
500
- PopplerColor color;
501
-
502
- color.red = NUM2UINT(red);
503
- color.green = NUM2UINT(green);
504
- color.blue = NUM2UINT(blue);
505
-
506
- G_INITIALIZE(self, &color);
507
- return Qnil;
508
- }
509
-
510
- DEF_ACCESSOR(color, red, RVAL2POPPLER_COLOR, UINT2NUM, NUM2UINT)
511
- DEF_ACCESSOR(color, green, RVAL2POPPLER_COLOR, UINT2NUM, NUM2UINT)
512
- DEF_ACCESSOR(color, blue, RVAL2POPPLER_COLOR, UINT2NUM, NUM2UINT)
513
-
514
- static VALUE
515
- color_to_a(VALUE self)
516
- {
517
- PopplerColor *color;
518
- color = RVAL2POPPLER_COLOR(self);
519
- return rb_ary_new3(3,
520
- UINT2NUM(color->red),
521
- UINT2NUM(color->green),
522
- UINT2NUM(color->blue));
523
- }
524
-
525
- static VALUE
526
- color_inspect(VALUE self)
527
- {
528
- VALUE inspected;
529
- gchar *rgb;
530
- PopplerColor *color;
531
-
532
- color = RVAL2POPPLER_COLOR(self);
533
- inspected = rb_call_super(0, NULL);
534
- rb_str_resize(inspected, RSTRING_LEN(inspected) - 1);
535
- rgb = g_strdup_printf(": [%u, %u, %u]>",
536
- color->red, color->green, color->blue);
537
- rb_str_cat2(inspected, rgb);
538
- g_free(rgb);
539
- return inspected;
540
- }
541
- #endif
542
-
543
-
544
- /* Mapping between areas on the current page and PopplerActions */
545
- #define RECT_ENTITY2RVAL(rect) POPPLER_RECT2RVAL(&(rect))
546
- #define RECT_ENTITY_SET(rect, rb_rect) rectangle_set(&(rect), rb_rect)
547
- static void
548
- rectangle_set(PopplerRectangle *rect, VALUE rb_rect)
549
- {
550
- *rect = *(RVAL2POPPLER_RECT(rb_rect));
551
- }
552
-
553
- DEF_ACCESSOR_WITH_SETTER(link_mapping, area,
554
- RVAL2LM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
555
- DEF_ACCESSOR(link_mapping, action, RVAL2LM,
556
- POPPLER_ACTION2RVAL, RVAL2POPPLER_ACTION)
557
-
558
-
559
- /* Page Transition */
560
- DEF_ACCESSOR(page_trans, type, RVAL2TRANS, RVAL2TT, TT2RVAL)
561
- DEF_ACCESSOR(page_trans, alignment, RVAL2TRANS, RVAL2TA, TA2RVAL)
562
- DEF_ACCESSOR(page_trans, direction, RVAL2TRANS, RVAL2TD, TD2RVAL)
563
- DEF_ACCESSOR(page_trans, duration, RVAL2TRANS, NUM2INT, INT2NUM)
564
- DEF_ACCESSOR(page_trans, angle, RVAL2TRANS, NUM2INT, INT2NUM)
565
- DEF_ACCESSOR(page_trans, scale, RVAL2TRANS, NUM2DBL, rb_float_new)
566
- DEF_ACCESSOR(page_trans, rectangular, RVAL2TRANS, RVAL2CBOOL, CBOOL2RVAL)
567
-
568
-
569
- /* Mapping between areas on the current page and images */
570
- DEF_ACCESSOR_WITH_SETTER(image_mapping, area,
571
- RVAL2IM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
572
- DEF_ACCESSOR(image_mapping, image_id, RVAL2IM, INT2NUM, NUM2INT)
573
- #ifdef RB_POPPLER_CAIRO_AVAILABLE
574
- static VALUE
575
- image_mapping_get_image(VALUE self)
576
- {
577
- return _page_get_image(rb_iv_get(self, "@page"), RVAL2IM(self)->image_id);
578
- }
579
- #endif
580
-
581
-
582
- /* Mapping between areas on the current page and form fields */
583
- DEF_ACCESSOR_WITH_SETTER(form_field_mapping, area,
584
- RVAL2FFM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
585
- DEF_ACCESSOR(form_field_mapping, field, RVAL2FFM,
586
- POPPLER_FORM_FIELD2RVAL, RVAL2POPPLER_FORM_FIELD)
587
-
588
- static VALUE
589
- annot_mapping_initialize(int argc, VALUE *argv, VALUE self)
590
- {
591
- VALUE area, annotation;
592
- PopplerAnnotMapping *mapping;
593
-
594
- rb_scan_args(argc, argv, "02", &area, &annotation);
595
-
596
- mapping = poppler_annot_mapping_new();
597
- mapping->area = *RVAL2POPPLER_RECT(area);
598
- mapping->annot = RVAL2POPPLER_ANNOT(annotation);
599
- G_INITIALIZE(self, mapping);
600
-
601
- return Qnil;
602
- }
603
-
604
- DEF_ACCESSOR_WITH_SETTER(annot_mapping, area,
605
- RVAL2AM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
606
- DEF_READER(annot_mapping, annotation, annot, RVAL2AM, POPPLER_ANNOT2RVAL)
607
-
608
- static VALUE
609
- annot_mapping_set_annotation(VALUE self, VALUE annotation)
610
- {
611
- PopplerAnnotMapping *mapping;
612
-
613
- mapping = RVAL2AM(self);
614
- if (mapping->annot)
615
- g_object_unref(mapping->annot);
616
-
617
- mapping->annot = RVAL2POPPLER_ANNOT(annotation);
618
- return Qnil;
395
+ return POPPLERRECTANGLE2RVAL(&rect);
619
396
  }
620
397
 
621
398
  void
622
399
  Init_poppler_page(VALUE mPoppler)
623
400
  {
624
- VALUE cPage, cLinkMapping;
625
- VALUE cPageTransition, cImageMapping, cFormFieldMapping;
626
- VALUE cAnnotationMapping;
627
-
628
- cPage = G_DEF_CLASS(POPPLER_TYPE_PAGE, "Page", mPoppler);
629
- cRectangle = G_DEF_CLASS(POPPLER_TYPE_RECTANGLE, "Rectangle", mPoppler);
630
- #ifdef POPPLER_TYPE_COLOR
631
- rb_cPopplerColor = G_DEF_CLASS(POPPLER_TYPE_COLOR, "Color", mPoppler);
632
- #endif
633
- cLinkMapping = G_DEF_CLASS(POPPLER_TYPE_LINK_MAPPING, "LinkMapping",
634
- mPoppler);
635
- cPageTransition = G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION,
636
- "PageTransition", mPoppler);
637
- cImageMapping = G_DEF_CLASS(POPPLER_TYPE_IMAGE_MAPPING,
638
- "ImageMapping", mPoppler);
639
- cFormFieldMapping = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD_MAPPING,
640
- "FormFieldMapping", mPoppler);
641
- cAnnotationMapping = G_DEF_CLASS(POPPLER_TYPE_ANNOT_MAPPING,
642
- "AnnotationMapping", mPoppler);
401
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PAGE, "Page", mPoppler);
402
+ cRectangle = rb_const_get(mPoppler, rb_intern("Rectangle"));
643
403
  cPSFile = rb_const_get(mPoppler, rb_intern("PSFile"));
644
404
 
645
- rb_define_method(cPage, "render", page_render_generic, -1);
646
- rb_define_method(cPage, "render_for_printing",
647
- page_render_for_printing_generic, -1);
648
- rb_define_method(cPage, "size", page_get_size, 0);
649
- rb_define_method(cPage, "index", page_get_index, 0);
650
- rb_define_method(cPage, "duration", page_get_duration, 0);
651
- rb_define_method(cPage, "transition", page_get_transition, 0);
405
+ RG_DEF_METHOD(render, -1);
406
+ RG_DEF_METHOD(render_for_printing, -1);
407
+ RG_DEF_METHOD(size, 0);
408
+ RG_DEF_METHOD(index, 0);
409
+ RG_DEF_METHOD(duration, 0);
410
+ RG_DEF_METHOD(transition, 0);
652
411
 
653
412
  #if RB_POPPLER_CAIRO_AVAILABLE
654
- rb_define_method(cPage, "thumbnail", page_get_thumbnail, 0);
413
+ RG_DEF_METHOD(thumbnail, 0);
655
414
  #endif
656
415
  #if POPPLER_WITH_GDK
657
- rb_define_method(cPage, "thumbnail_pixbuf", page_get_thumbnail_pixbuf, 0);
416
+ RG_DEF_METHOD(thumbnail_pixbuf, 0);
658
417
  #endif
659
- rb_define_method(cPage, "thumbnail_size", page_get_thumbnail_size, 0);
660
- rb_define_method(cPage, "find_text", page_find_text, 1);
661
- rb_define_method(cPage, "get_text", page_get_text, -1);
662
- rb_define_method(cPage, "get_selection_region",
663
- page_get_selection_region, 3);
664
- rb_define_method(cPage, "link_mapping", page_get_link_mapping, 0);
665
- rb_define_method(cPage, "image_mapping", page_get_image_mapping, 0);
418
+ RG_DEF_METHOD(thumbnail_size, 0);
419
+ RG_DEF_METHOD(find_text, 1);
420
+ RG_DEF_METHOD(get_text, -1);
421
+ RG_DEF_METHOD(get_selection_region, 3);
422
+ RG_DEF_METHOD(link_mapping, 0);
423
+ RG_DEF_METHOD(image_mapping, 0);
666
424
  #if RB_POPPLER_CAIRO_AVAILABLE
667
- rb_define_method(cPage, "get_image", page_get_image, 1);
425
+ RG_DEF_METHOD(get_image, 1);
668
426
  #endif
669
427
 
670
- rb_define_method(cPage, "form_field_mapping",
671
- page_get_form_field_mapping, 0);
672
- rb_define_method(cPage, "annotation_mapping",
673
- page_get_annot_mapping, 0);
674
- rb_define_method(cPage, "render_selection",
675
- page_render_selection_generic, -1);
676
- rb_define_method(cPage, "crop_box", page_get_crop_box, 0);
677
-
678
- G_DEF_SETTERS(cPage);
679
-
680
- /* A rectangle on a page, with coordinates in PDF points. */
681
- rb_define_method(cRectangle, "initialize", rectangle_initialize, 4);
682
- rb_define_method(cRectangle, "x1", rectangle_get_x1, 0);
683
- rb_define_method(cRectangle, "y1", rectangle_get_y1, 0);
684
- rb_define_method(cRectangle, "x2", rectangle_get_x2, 0);
685
- rb_define_method(cRectangle, "y2", rectangle_get_y2, 0);
686
- rb_define_method(cRectangle, "set_x1", rectangle_set_x1, 1);
687
- rb_define_method(cRectangle, "set_y1", rectangle_set_y1, 1);
688
- rb_define_method(cRectangle, "set_x2", rectangle_set_x2, 1);
689
- rb_define_method(cRectangle, "set_y2", rectangle_set_y2, 1);
690
- rb_define_method(cRectangle, "to_a", rectangle_to_a, 0);
691
- rb_define_method(cRectangle, "inspect", rectangle_inspect, 0);
692
-
693
- G_DEF_SETTERS(cRectangle);
694
-
695
- #ifdef POPPLER_TYPE_COLOR
696
- /* A color in RGB */
697
- rb_define_method(rb_cPopplerColor, "initialize", color_initialize, 3);
698
- rb_define_method(rb_cPopplerColor, "red", color_get_red, 0);
699
- rb_define_method(rb_cPopplerColor, "green", color_get_green, 0);
700
- rb_define_method(rb_cPopplerColor, "blue", color_get_blue, 0);
701
- rb_define_method(rb_cPopplerColor, "set_red", color_set_red, 1);
702
- rb_define_method(rb_cPopplerColor, "set_green", color_set_green, 1);
703
- rb_define_method(rb_cPopplerColor, "set_blue", color_set_blue, 1);
704
- rb_define_method(rb_cPopplerColor, "to_a", color_to_a, 0);
705
- rb_define_method(rb_cPopplerColor, "inspect", color_inspect, 0);
706
-
707
- G_DEF_SETTERS(rb_cPopplerColor);
708
- #endif
709
-
710
- /* Mapping between areas on the current page and PopplerActions */
711
- rb_define_method(cLinkMapping, "area", link_mapping_get_area, 0);
712
- rb_define_method(cLinkMapping, "action", link_mapping_get_action, 0);
713
-
714
- rb_define_method(cLinkMapping, "set_area", link_mapping_set_area, 1);
715
- rb_define_method(cLinkMapping, "set_action", link_mapping_set_action, 1);
716
-
717
- G_DEF_SETTERS(cLinkMapping);
718
-
719
- /* Page Transition */
720
- rb_define_method(cPageTransition, "type", page_trans_get_type, 0);
721
- rb_define_method(cPageTransition, "alignment", page_trans_get_alignment, 0);
722
- rb_define_method(cPageTransition, "direction", page_trans_get_direction, 0);
723
- rb_define_method(cPageTransition, "duration", page_trans_get_duration, 0);
724
- rb_define_method(cPageTransition, "angle", page_trans_get_angle, 0);
725
- rb_define_method(cPageTransition, "scale", page_trans_get_scale, 0);
726
- rb_define_method(cPageTransition, "rectangular",
727
- page_trans_get_rectangular, 0);
728
-
729
- rb_define_method(cPageTransition, "set_type", page_trans_set_type, 1);
730
- rb_define_method(cPageTransition, "set_alignment",
731
- page_trans_set_alignment, 1);
732
- rb_define_method(cPageTransition, "set_direction",
733
- page_trans_set_direction, 1);
734
- rb_define_method(cPageTransition, "set_duration",
735
- page_trans_set_duration, 1);
736
- rb_define_method(cPageTransition, "set_angle", page_trans_set_angle, 1);
737
- rb_define_method(cPageTransition, "set_scale", page_trans_set_scale, 1);
738
- rb_define_method(cPageTransition, "set_rectangular",
739
- page_trans_set_rectangular, 1);
740
-
741
- G_DEF_SETTERS(cPageTransition);
742
-
743
-
744
- /* Mapping between areas on the current page and images */
745
- rb_define_method(cImageMapping, "area", image_mapping_get_area, 0);
746
- rb_define_method(cImageMapping, "image_id", image_mapping_get_image_id, 0);
747
- #ifdef RB_POPPLER_CAIRO_AVAILABLE
748
- rb_define_method(cImageMapping, "image", image_mapping_get_image, 0);
749
- #endif
750
-
751
- rb_define_method(cImageMapping, "set_area", image_mapping_set_area, 1);
752
- rb_define_method(cImageMapping, "set_image_id",
753
- image_mapping_set_image_id, 1);
754
-
755
- G_DEF_SETTERS(cImageMapping);
756
-
757
-
758
- /* Mapping between areas on the current page and form fields */
759
- rb_define_method(cFormFieldMapping, "area", form_field_mapping_get_area, 0);
760
- rb_define_method(cFormFieldMapping, "field", form_field_mapping_get_field,
761
- 0);
762
-
763
- rb_define_method(cFormFieldMapping, "set_area",
764
- form_field_mapping_set_area, 1);
765
- rb_define_method(cFormFieldMapping, "set_field",
766
- form_field_mapping_set_field, 1);
767
-
768
- G_DEF_SETTERS(cFormFieldMapping);
769
-
770
- rb_define_method(cAnnotationMapping, "initialize",
771
- annot_mapping_initialize, -1);
772
-
773
- rb_define_method(cAnnotationMapping, "area", annot_mapping_get_area, 0);
774
- rb_define_method(cAnnotationMapping, "annotation",
775
- annot_mapping_get_annotation, 0);
776
-
777
- rb_define_method(cAnnotationMapping, "set_area", annot_mapping_set_area, 1);
778
- rb_define_method(cAnnotationMapping, "set_annotation",
779
- annot_mapping_set_annotation, 1);
428
+ RG_DEF_METHOD(form_field_mapping, 0);
429
+ RG_DEF_METHOD(annotation_mapping, 0);
430
+ RG_DEF_METHOD(render_selection, -1);
431
+ RG_DEF_METHOD(crop_box, 0);
780
432
 
781
- G_DEF_SETTERS(cAnnotationMapping);
433
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
782
434
  }