gmagick 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bc90ff3ec1b8209e0de9e0fdfa0ff85e85a856a2
4
+ data.tar.gz: c5c0f6649589a03255bf2a793ecd64c8f476a582
5
+ SHA512:
6
+ metadata.gz: da782a343463b9b25cb5d3a1216a5b430fc8c7229ac68e6c6a3eabc3f886c7a4217220356fc3cb9b7ae2c5e22d520b788f726f1a9125430da509723f488152cf
7
+ data.tar.gz: 2e656e513769e6eb93260ae14794e3af200cc0cce73e38e585159f5261ad061514f1bd47be12b5ed3681b1273a9ed7d2b7c2f8f19b18b6815387cc0f36023a35
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ vendor
19
+ lib/gmagickn.*
20
+ html
21
+ spec/files/dst
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gmagick.gemspec
4
+ gemspec
5
+ gem "rake-compiler"
6
+ gem "rdoc"
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 aoyagikouhei
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Gmagick
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'gmagick'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install gmagick
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,38 @@
1
+ require "bundler/gem_helper"
2
+ gem_helper = Bundler::GemHelper.new(Dir.pwd)
3
+ gem_helper.install
4
+ gem_spec = gem_helper.gemspec
5
+
6
+ require 'rdoc/task'
7
+ RDoc::Task.new do |rdoc|
8
+ rdoc.rdoc_files.include("lib/**/*.rb", "ext/gmagick/*.c")
9
+ end
10
+
11
+ require 'rake/clean'
12
+
13
+ require 'rake/testtask'
14
+ Rake::TestTask.new
15
+
16
+ require 'rake/extensiontask'
17
+ module Rake
18
+ class BaseExtensionTask
19
+ def binary(platform = nil)
20
+ ext = case platform
21
+ when /darwin/
22
+ 'bundle'
23
+ when /mingw|mswin|linux/
24
+ 'so'
25
+ when /java/
26
+ 'jar'
27
+ else
28
+ RbConfig::CONFIG['DLEXT']
29
+ end
30
+ "#{@name}n.#{ext}"
31
+ end
32
+ end
33
+ end
34
+
35
+ Rake::ExtensionTask.new(gem_spec.name, gem_spec)
36
+
37
+ require "rspec/core/rake_task"
38
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1 @@
1
+ gmagick.o: gminit.c gmutil.c gmimage.c gmpixel.c gmdrawing.c gmagick.h
@@ -0,0 +1,13 @@
1
+ require "mkmf"
2
+
3
+ if gmconfig = ( find_executable('GraphicsMagickWand-config') )
4
+ $stderr.puts "Using config values from %s" % [ gmconfig ]
5
+ $CPPFLAGS << " " + `"#{gmconfig}" --cppflags`.chomp
6
+ $LDFLAGS << " " + `"#{gmconfig}" --ldflags`.chomp
7
+ $LOCAL_LIBS << " " + `"#{gmconfig}" --libs`.chomp
8
+ else
9
+ $stderr.puts "No GraphicsMagickWand-config... trying anyway. If building fails, please try again with",
10
+ " --with-gm-config=/path/to/GraphicsMagickWand-config"
11
+ end
12
+
13
+ create_makefile("gmagickn")
@@ -0,0 +1,112 @@
1
+ #ifndef _GMAGICK_H_
2
+ #define _GMAGICK_H_
3
+
4
+ #include <stdio.h>
5
+ #include <ruby.h>
6
+ #include <wand/magick_wand.h>
7
+
8
+ typedef struct {
9
+ MagickWand* wand;
10
+ } GmImage;
11
+
12
+ typedef struct {
13
+ PixelWand* wand;
14
+ } GmPixel;
15
+
16
+ typedef struct {
17
+ DrawingWand* wand;
18
+ } GmDrawing;
19
+
20
+ extern VALUE Module_Gmagick;
21
+ extern VALUE Class_Image;
22
+ extern VALUE Class_Pixel;
23
+ extern VALUE Class_Drawing;
24
+
25
+ extern ID id_new;
26
+
27
+ void gum_check_image_exception(MagickWand *wand, MagickPassFail status);
28
+ MagickWand* gmu_get_image_wand(VALUE self);
29
+ PixelWand* gmu_get_pixel_wand(VALUE self);
30
+ DrawingWand* gmu_get_drawing_wand(VALUE self);
31
+ char* gmu_str2cstr(VALUE src, long *len);
32
+ PixelWand* gmu_get_pixel_string_or_pixel(VALUE pixel_arg);
33
+ void gmu_clear_pixel_string_or_pixel(VALUE pixel_arg, PixelWand* pixel);
34
+
35
+ VALUE gmi_alloc(VALUE klass);
36
+ VALUE gmi_initialize(int argc, VALUE *argv, VALUE self);
37
+ VALUE gmi_read_image(VALUE self, VALUE path_arg);
38
+ VALUE gmi_write_image(int argc, VALUE *argv, VALUE self);
39
+ VALUE gmi_get_width(VALUE self);
40
+ VALUE gmi_get_height(VALUE self);
41
+ VALUE gmi_get_format(VALUE self);
42
+ VALUE gmi_get_depth(VALUE self);
43
+ VALUE gmi_get_colors(VALUE self);
44
+ VALUE gmi_get_resolution(VALUE self);
45
+ VALUE gmi_get_number_images(VALUE self);
46
+ VALUE gmi_read_image_blob(VALUE self, VALUE blob_arg);
47
+ VALUE gmi_write_image_blob(VALUE self);
48
+ VALUE gmi_resize(int argc, VALUE *argv, VALUE self);
49
+ VALUE gmi_rotate(VALUE self, VALUE pixel_arg, VALUE degree_arg);
50
+ VALUE gmi_draw(VALUE self, VALUE drawing_arg);
51
+ VALUE gmi_resample(int argc, VALUE *argv, VALUE self);
52
+ VALUE gmi_flip(VALUE self);
53
+ VALUE gmi_flop(VALUE self);
54
+ VALUE gmi_crop(VALUE self, VALUE width_arg, VALUE height_arg, VALUE x_arg, VALUE y_arg);
55
+ VALUE gmi_set_format(VALUE self, VALUE format_arg);
56
+ VALUE gmi_border(VALUE self, VALUE pixel_arg, VALUE width_arg, VALUE height_arg);
57
+ VALUE gmi_frame(VALUE self, VALUE pixel_arg, VALUE width_arg, VALUE height_arg, VALUE inner_arg, VALUE outer_arg);
58
+ VALUE gmi_blur(VALUE self, VALUE radius_arg, VALUE sigma_arg);
59
+ VALUE gmi_swirl(VALUE self, VALUE degree_arg);
60
+ VALUE gmi_charcoal(VALUE self, VALUE radius_arg, VALUE sigma_arg);
61
+ VALUE gmi_oil_paint(VALUE self, VALUE radius_arg);
62
+ VALUE gmi_cycle_colormap(VALUE self, VALUE displace_arg);
63
+ VALUE gmi_solarize(VALUE self, VALUE threshold_arg);
64
+ VALUE gmi_shear(VALUE self, VALUE pixel_arg, VALUE x_arg, VALUE y_arg);
65
+
66
+ VALUE gmp_alloc(VALUE klass);
67
+ VALUE gmp_initialize(int argc, VALUE *argv, VALUE self);
68
+ VALUE gmp_set_color(VALUE self, VALUE color_arg);
69
+ VALUE gmp_get_color(VALUE self);
70
+ VALUE gmp_set_color_count(VALUE self, VALUE color_count_arg);
71
+ VALUE gmp_get_color_count(VALUE self);
72
+
73
+ VALUE gmd_alloc(VALUE klass);
74
+ VALUE gmd_initialize(VALUE self);
75
+ VALUE gmd_annotation(VALUE self, VALUE x_arg, VALUE y_arg, VALUE text_arg);
76
+ VALUE gmd_arc(VALUE self, VALUE sx_arg, VALUE sy_arg, VALUE ex_arg, VALUE ey_arg, VALUE sd_arg, VALUE ed_arg);
77
+ VALUE gmd_bezier(VALUE self, VALUE points_arg);
78
+ VALUE gmd_circle(VALUE self, VALUE ox_arg, VALUE oy_arg, VALUE px_arg, VALUE py_arg);
79
+ VALUE gmd_ellipse(int argc, VALUE *argv, VALUE self);
80
+ VALUE gmd_line(VALUE self, VALUE sx_arg, VALUE sy_arg, VALUE ex_arg, VALUE ey_arg);
81
+ VALUE gmd_point(VALUE self, VALUE x_arg, VALUE y_arg);
82
+ VALUE gmd_rectangle(VALUE self, VALUE x1_arg, VALUE y1_arg, VALUE x2_arg, VALUE y2_arg);
83
+ VALUE gmd_rotate(VALUE self, VALUE degree_arg);
84
+ VALUE gmd_scale(VALUE self, VALUE x_arg, VALUE y_arg);
85
+ VALUE gmd_set_fill_color(VALUE self, VALUE pixel_arg);
86
+ VALUE gmd_get_fill_color(VALUE self);
87
+ VALUE gmd_set_fill_opacity(VALUE self, VALUE opacity_arg);
88
+ VALUE gmd_get_fill_opacity(VALUE self);
89
+ VALUE gmd_set_stroke_color(VALUE self, VALUE pixel_arg);
90
+ VALUE gmd_get_stroke_color(VALUE self);
91
+ VALUE gmd_set_stroke_opacity(VALUE self, VALUE opacity_arg);
92
+ VALUE gmd_get_stroke_opacity(VALUE self);
93
+ VALUE gmd_set_stroke_width(VALUE self, VALUE width_arg);
94
+ VALUE gmd_get_stroke_width(VALUE self);
95
+ VALUE gmd_round_rectangle(VALUE self, VALUE x1_arg, VALUE y1_arg, VALUE x2_arg, VALUE y2_arg, VALUE rx_arg, VALUE ry_arg);
96
+ VALUE gmd_set_font(VALUE self, VALUE name_arg);
97
+ VALUE gmd_get_font(VALUE self);
98
+ VALUE gmd_set_font_family(VALUE self, VALUE family_arg);
99
+ VALUE gmd_get_font_family(VALUE self);
100
+ VALUE gmd_set_font_size(VALUE self, VALUE pointsize_arg);
101
+ VALUE gmd_get_font_size(VALUE self);
102
+ VALUE gmd_set_font_stretch(VALUE self, VALUE stretch_arg);
103
+ VALUE gmd_get_font_stretch(VALUE self);
104
+ VALUE gmd_set_font_style(VALUE self, VALUE style_arg);
105
+ VALUE gmd_get_font_style(VALUE self);
106
+ VALUE gmd_set_font_weight(VALUE self, VALUE weight_arg);
107
+ VALUE gmd_get_font_weight(VALUE self);
108
+ VALUE gmd_set_text_decoration(VALUE self, VALUE decoration_arg);
109
+ VALUE gmd_get_text_decoration(VALUE self);
110
+ VALUE gmd_set_text_encoding(VALUE self, VALUE encoding_arg);
111
+ VALUE gmd_get_text_encoding(VALUE self);
112
+ #endif
@@ -0,0 +1,345 @@
1
+ #include "gmagick.h"
2
+
3
+ static void
4
+ gmd_free(GmDrawing *ptr)
5
+ {
6
+ if (ptr != (GmDrawing *)NULL) {
7
+ if (ptr->wand != (DrawingWand *)NULL) {
8
+ DestroyDrawingWand(ptr->wand);
9
+ }
10
+ ruby_xfree(ptr);
11
+ }
12
+ }
13
+
14
+ VALUE
15
+ gmd_alloc(VALUE klass) {
16
+ GmDrawing *ptr = ALLOC(GmDrawing);
17
+ ptr->wand = (DrawingWand *)NULL;
18
+ return Data_Wrap_Struct(klass, 0, gmd_free, ptr);
19
+ }
20
+
21
+ /*
22
+ * Document-method: new
23
+ *
24
+ * call-seq:
25
+ * Gmagick::Drawing.new -> drawing
26
+ *
27
+ * Create a GraphicsMagick Drawing Object
28
+ *
29
+ * Examples:
30
+ *
31
+ * # Make drawing object
32
+ * Gmagick::Drawing.new
33
+ *
34
+ */
35
+ VALUE
36
+ gmd_initialize(VALUE self) {
37
+ GmDrawing *ptr;
38
+ Data_Get_Struct(self, GmDrawing, ptr);
39
+ ptr->wand = NewDrawingWand();
40
+ return Qnil;
41
+ }
42
+
43
+ VALUE
44
+ gmd_annotation(VALUE self, VALUE x_arg, VALUE y_arg, VALUE text_arg) {
45
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
46
+ double x = NUM2DBL(x_arg);
47
+ double y = NUM2DBL(y_arg);
48
+ char* text = StringValuePtr(text_arg);
49
+ DrawAnnotation(drawing, 50, 50, (unsigned char*)text);
50
+ return Qnil;
51
+ }
52
+
53
+ VALUE
54
+ gmd_set_fill_color(VALUE self, VALUE pixel_arg) {
55
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
56
+ PixelWand *pixel = gmu_get_pixel_string_or_pixel(pixel_arg);
57
+ DrawSetFillColor(drawing, pixel);
58
+ gmu_clear_pixel_string_or_pixel(pixel_arg, pixel);
59
+ return Qnil;
60
+ }
61
+
62
+ VALUE
63
+ gmd_get_fill_color(VALUE self) {
64
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
65
+ VALUE pixel_value = rb_funcall(Class_Pixel, id_new, 0);
66
+ PixelWand *pixel = gmu_get_pixel_wand(pixel_value);
67
+ DrawGetFillColor(drawing, pixel);
68
+ return pixel_value;
69
+ }
70
+
71
+ VALUE
72
+ gmd_set_fill_opacity(VALUE self, VALUE opacity_arg) {
73
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
74
+ double opacity = NUM2DBL(opacity_arg);
75
+ DrawSetFillOpacity(drawing, opacity);
76
+ return Qnil;
77
+ }
78
+
79
+ VALUE
80
+ gmd_get_fill_opacity(VALUE self) {
81
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
82
+ return DBL2NUM(DrawGetFillOpacity(drawing));
83
+ }
84
+
85
+ VALUE gmd_set_stroke_color(VALUE self, VALUE pixel_arg) {
86
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
87
+ PixelWand *pixel = gmu_get_pixel_string_or_pixel(pixel_arg);
88
+ DrawSetStrokeColor(drawing, pixel);
89
+ gmu_clear_pixel_string_or_pixel(pixel_arg, pixel);
90
+ return Qnil;
91
+ }
92
+
93
+ VALUE
94
+ gmd_get_stroke_color(VALUE self) {
95
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
96
+ VALUE pixel_value = rb_funcall(Class_Pixel, id_new, 0);
97
+ PixelWand *pixel = gmu_get_pixel_wand(pixel_value);
98
+ DrawGetStrokeColor(drawing, pixel);
99
+ return pixel_value;
100
+ }
101
+
102
+ VALUE
103
+ gmd_set_stroke_opacity(VALUE self, VALUE opacity_arg) {
104
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
105
+ double opacity = NUM2DBL(opacity_arg);
106
+ DrawSetStrokeOpacity(drawing, opacity);
107
+ return Qnil;
108
+ }
109
+
110
+ VALUE
111
+ gmd_get_stroke_opacity(VALUE self) {
112
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
113
+ return DBL2NUM(DrawGetStrokeOpacity(drawing));
114
+ }
115
+
116
+ VALUE
117
+ gmd_set_stroke_width(VALUE self, VALUE width_arg) {
118
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
119
+ double width = NUM2DBL(width_arg);
120
+ DrawSetStrokeWidth(drawing, width);
121
+ return Qnil;
122
+ }
123
+
124
+ VALUE
125
+ gmd_get_stroke_width(VALUE self) {
126
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
127
+ return DBL2NUM(DrawGetStrokeWidth(drawing));
128
+ }
129
+
130
+ VALUE gmd_round_rectangle(VALUE self, VALUE x1_arg, VALUE y1_arg, VALUE x2_arg, VALUE y2_arg, VALUE rx_arg, VALUE ry_arg) {
131
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
132
+ double x1 = NUM2DBL(x1_arg);
133
+ double y1 = NUM2DBL(y1_arg);
134
+ double x2 = NUM2DBL(x2_arg);
135
+ double y2 = NUM2DBL(y2_arg);
136
+ double rx = NUM2DBL(rx_arg);
137
+ double ry = NUM2DBL(ry_arg);
138
+ DrawRoundRectangle(drawing, x1, y1, x2, y2, rx, ry);
139
+ return Qnil;
140
+ }
141
+
142
+ VALUE
143
+ gmd_set_font(VALUE self, VALUE name_arg) {
144
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
145
+ char *name = StringValuePtr(name_arg);
146
+ DrawSetFont(drawing, name);
147
+ return Qnil;
148
+ }
149
+
150
+ VALUE
151
+ gmd_get_font(VALUE self) {
152
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
153
+ return rb_str_new2(DrawGetFont(drawing));
154
+ }
155
+
156
+ VALUE
157
+ gmd_set_font_family(VALUE self, VALUE family_arg) {
158
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
159
+ char *family = StringValuePtr(family_arg);
160
+ DrawSetFontFamily(drawing, family);
161
+ return Qnil;
162
+ }
163
+
164
+ VALUE
165
+ gmd_get_font_family(VALUE self) {
166
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
167
+ return rb_str_new2(DrawGetFontFamily(drawing));
168
+ }
169
+
170
+ VALUE
171
+ gmd_set_font_size(VALUE self, VALUE pointsize_arg) {
172
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
173
+ double pointsize = NUM2DBL(pointsize_arg);
174
+ DrawSetFontSize(drawing, pointsize);
175
+ return Qnil;
176
+ }
177
+
178
+ VALUE
179
+ gmd_get_font_size(VALUE self) {
180
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
181
+ return DBL2NUM(DrawGetFontSize(drawing));
182
+ }
183
+
184
+ VALUE
185
+ gmd_set_font_stretch(VALUE self, VALUE stretch_arg) {
186
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
187
+ unsigned long stretch = NUM2LONG(stretch_arg);
188
+ DrawSetFontStretch(drawing, stretch);
189
+ return Qnil;
190
+ }
191
+
192
+ VALUE
193
+ gmd_get_font_stretch(VALUE self) {
194
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
195
+ return LONG2NUM(DrawGetFontStretch(drawing));
196
+ }
197
+
198
+ VALUE
199
+ gmd_set_font_style(VALUE self, VALUE style_arg) {
200
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
201
+ unsigned long style = NUM2LONG(style_arg);
202
+ DrawSetFontStyle(drawing, style);
203
+ return Qnil;
204
+ }
205
+
206
+ VALUE
207
+ gmd_get_font_style(VALUE self) {
208
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
209
+ return LONG2NUM(DrawGetFontStyle(drawing));
210
+ }
211
+
212
+ VALUE
213
+ gmd_set_font_weight(VALUE self, VALUE weight_arg) {
214
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
215
+ unsigned long weight = NUM2LONG(weight_arg);
216
+ DrawSetFontWeight(drawing, weight);
217
+ return Qnil;
218
+ }
219
+
220
+ VALUE
221
+ gmd_get_font_weight(VALUE self) {
222
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
223
+ return LONG2NUM(DrawGetFontWeight(drawing));
224
+ }
225
+
226
+ VALUE
227
+ gmd_set_text_decoration(VALUE self, VALUE decoration_arg) {
228
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
229
+ unsigned long decoration = NUM2LONG(decoration_arg);
230
+ DrawSetTextDecoration(drawing, decoration);
231
+ return Qnil;
232
+ }
233
+
234
+ VALUE
235
+ gmd_get_text_decoration(VALUE self) {
236
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
237
+ return LONG2NUM(DrawGetTextDecoration(drawing));
238
+ }
239
+
240
+ VALUE
241
+ gmd_set_text_encoding(VALUE self, VALUE encoding_arg) {
242
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
243
+ char *encoding = StringValuePtr(encoding_arg);
244
+ DrawSetTextEncoding(drawing, encoding);
245
+ return Qnil;
246
+ }
247
+
248
+ VALUE
249
+ gmd_get_text_encoding(VALUE self) {
250
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
251
+ return rb_str_new2(DrawGetTextEncoding(drawing));
252
+ }
253
+
254
+ VALUE
255
+ gmd_arc(VALUE self, VALUE sx_arg, VALUE sy_arg, VALUE ex_arg, VALUE ey_arg, VALUE sd_arg, VALUE ed_arg) {
256
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
257
+ double sx = NUM2DBL(sx_arg);
258
+ double sy = NUM2DBL(sy_arg);
259
+ double ex = NUM2DBL(ex_arg);
260
+ double ey = NUM2DBL(ey_arg);
261
+ double sd = NUM2DBL(sd_arg);
262
+ double ed = NUM2DBL(ed_arg);
263
+ DrawArc(drawing, sx, sy, ex, ey, sd, ed);
264
+ return Qnil;
265
+ }
266
+
267
+ VALUE
268
+ gmd_bezier(VALUE self, VALUE points_arg) {
269
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
270
+ return Qnil;
271
+ }
272
+
273
+ VALUE gmd_circle(VALUE self, VALUE ox_arg, VALUE oy_arg, VALUE px_arg, VALUE py_arg) {
274
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
275
+ double ox = NUM2DBL(ox_arg);
276
+ double oy = NUM2DBL(oy_arg);
277
+ double px = NUM2DBL(px_arg);
278
+ double py = NUM2DBL(py_arg);
279
+ DrawCircle(drawing, ox, oy, px, py);
280
+ return Qnil;
281
+ }
282
+
283
+ VALUE gmd_ellipse(int argc, VALUE *argv, VALUE self) {
284
+ if ((argc < 4) || (argc > 6)) {
285
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 4 or 6)", argc);
286
+ }
287
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
288
+ double ox = NUM2DBL(argv[0]);
289
+ double oy = NUM2DBL(argv[1]);
290
+ double rx = NUM2DBL(argv[2]);
291
+ double ry = NUM2DBL(argv[3]);
292
+ double start = 0;
293
+ double end = 0;
294
+ if (argc > 4) {
295
+ start = NUM2DBL(argv[4]);
296
+ }
297
+ if (argc > 5) {
298
+ end = NUM2DBL(argv[5]);
299
+ }
300
+ DrawEllipse(drawing, ox, oy, rx, ry, start, end);
301
+ return Qnil;
302
+ }
303
+
304
+ VALUE gmd_line(VALUE self, VALUE sx_arg, VALUE sy_arg, VALUE ex_arg, VALUE ey_arg) {
305
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
306
+ double sx = NUM2DBL(sx_arg);
307
+ double sy = NUM2DBL(sy_arg);
308
+ double ex = NUM2DBL(ex_arg);
309
+ double ey = NUM2DBL(ey_arg);
310
+ DrawLine(drawing, sx, sy, ex, ey);
311
+ return Qnil;
312
+ }
313
+
314
+ VALUE gmd_point(VALUE self, VALUE x_arg, VALUE y_arg) {
315
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
316
+ double x = NUM2DBL(x_arg);
317
+ double y = NUM2DBL(y_arg);
318
+ DrawPoint(drawing, x, y);
319
+ return Qnil;
320
+ }
321
+
322
+ VALUE gmd_rectangle(VALUE self, VALUE x1_arg, VALUE y1_arg, VALUE x2_arg, VALUE y2_arg) {
323
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
324
+ double x1 = NUM2DBL(x1_arg);
325
+ double y1 = NUM2DBL(y1_arg);
326
+ double x2 = NUM2DBL(x2_arg);
327
+ double y2 = NUM2DBL(y2_arg);
328
+ DrawRectangle(drawing, x1, y1, x2, y2);
329
+ return Qnil;
330
+ }
331
+
332
+ VALUE gmd_rotate(VALUE self, VALUE degree_arg) {
333
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
334
+ double degree = NUM2DBL(degree_arg);
335
+ DrawRotate(drawing, degree);
336
+ return Qnil;
337
+ }
338
+
339
+ VALUE gmd_scale(VALUE self, VALUE x_arg, VALUE y_arg) {
340
+ DrawingWand *drawing = gmu_get_drawing_wand(self);
341
+ double x = NUM2DBL(x_arg);
342
+ double y = NUM2DBL(y_arg);
343
+ DrawScale(drawing, x, y);
344
+ return Qnil;
345
+ }