devil 0.1.9.1 → 0.1.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,228 +1,228 @@
1
- #include <ruby.h>
2
- #include <IL/ilu.h>
3
- #include "ruby_devil_ext.h"
4
-
5
- static VALUE mILU;
6
-
7
- static VALUE ilu_Init(VALUE obj) {
8
- iluInit();
9
- return Qnil;
10
- }
11
-
12
- static VALUE ilu_ErrorString(VALUE obj, VALUE rb_error) {
13
- ILenum num = NUM2INT(rb_error);
14
- const char* error = iluErrorString(num);
15
- return rb_str_new2(error);
16
- }
17
-
18
- static VALUE ilu_Alienify(VALUE obj) {
19
- ILboolean flag = iluAlienify();
20
- return flag ? Qtrue : Qfalse;
21
- }
22
-
23
- static VALUE ilu_BlurAvg(VALUE obj, VALUE rb_iter) {
24
- ILuint iter = NUM2INT(rb_iter);
25
- ILboolean flag = iluBlurAvg(iter);
26
- return flag ? Qtrue : Qfalse;
27
- }
28
-
29
- static VALUE ilu_BlurGaussian(VALUE obj, VALUE rb_iter) {
30
- ILuint iter = NUM2INT(rb_iter);
31
- ILboolean flag = iluBlurGaussian(iter);
32
- return flag ? Qtrue : Qfalse;
33
- }
34
-
35
- static VALUE ilu_Contrast(VALUE obj, VALUE rb_cont) {
36
- ILfloat cont = NUM2DBL(rb_cont);
37
- ILboolean flag = iluContrast(cont);
38
- return flag ? Qtrue : Qfalse;
39
- }
40
-
41
- static VALUE ilu_Equalize(VALUE obj) {
42
- ILboolean flag = iluEqualize();
43
- return flag ? Qtrue : Qfalse;
44
- }
45
-
46
- static VALUE ilu_GammaCorrect (VALUE obj, VALUE rb_gamma) {
47
- ILfloat gamma = NUM2DBL(rb_gamma);
48
- ILboolean flag = iluGammaCorrect(gamma);
49
- return flag ? Qtrue : Qfalse;
50
- }
51
- static VALUE ilu_Negative (VALUE obj) {
52
- ILboolean flag = iluNegative();
53
- return flag ? Qtrue : Qfalse;
54
- }
55
- static VALUE ilu_Noisify (VALUE obj, VALUE rb_tolerance) {
56
- ILclampf tolerance = NUM2DBL(rb_tolerance);
57
- ILboolean flag = iluNoisify(tolerance);
58
- return flag ? Qtrue : Qfalse;
59
- }
60
- static VALUE ilu_Pixelize (VALUE obj, VALUE rb_pix_size) {
61
- ILuint pix = NUM2INT(rb_pix_size);
62
- ILboolean flag = iluPixelize(pix);
63
- return flag ? Qtrue : Qfalse;
64
- }
65
- static VALUE ilu_Sharpen (VALUE obj, VALUE rb_factor, VALUE rb_iter) {
66
- ILfloat factor = NUM2DBL(rb_factor);
67
- ILuint iter = NUM2INT(rb_iter);
68
- ILboolean flag = iluSharpen(factor, iter);
69
- return flag ? Qtrue : Qfalse;
70
- }
71
-
72
- static VALUE ilu_Scale(VALUE obj, VALUE rb_Width, VALUE rb_Height, VALUE rb_Depth) {
73
- ILuint Width = NUM2INT(rb_Width);
74
- ILuint Height = NUM2INT(rb_Height);
75
- ILuint Depth = NUM2INT(rb_Depth);
76
- ILboolean flag = iluScale(Width, Height, Depth);
77
- return flag ? Qtrue : Qfalse;
78
- }
79
-
80
- static VALUE ilu_ImageParameter(VALUE obj, VALUE rb_PName, VALUE rb_Param) {
81
- ILenum PName = NUM2INT(rb_PName);
82
- ILenum Param = NUM2INT(rb_Param);
83
- iluImageParameter(PName, Param);
84
- return Qnil;
85
- }
86
-
87
- static VALUE ilu_BuildMipmaps(VALUE obj) {
88
- ILboolean flag = iluBuildMipmaps();
89
- return flag ? Qtrue : Qfalse;
90
- }
91
-
92
- /* functions added by banisterfiend */
93
- static VALUE ilu_FlipImage(VALUE obj) {
94
- ILboolean flag = iluFlipImage();
95
- return flag ? Qtrue : Qfalse;
96
- }
97
-
98
- static VALUE ilu_Rotate(VALUE obj, VALUE rb_angle) {
99
- ILfloat angle = NUM2DBL(rb_angle);
100
-
101
- ILboolean flag = iluRotate(angle);
102
-
103
- return flag ? Qtrue : Qfalse;
104
- }
105
-
106
- static VALUE ilu_Crop(VALUE obj, VALUE rb_XOff, VALUE rb_YOff, VALUE rb_ZOff, VALUE rb_width, VALUE rb_height, VALUE rb_depth)
107
- {
108
- ILuint XOff = NUM2INT(rb_XOff);
109
- ILuint YOff = NUM2INT(rb_YOff);
110
- ILuint ZOff = NUM2INT(rb_ZOff);
111
- ILuint width = NUM2INT(rb_width);
112
- ILuint height = NUM2INT(rb_height);
113
- ILuint depth = NUM2INT(rb_depth);
114
-
115
- ILboolean flag = iluCrop(XOff, YOff, ZOff, width, height, depth);
116
-
117
- return flag ? Qtrue : Qfalse;
118
- }
119
-
120
- static VALUE ilu_EnlargeCanvas(VALUE obj, VALUE rb_width, VALUE rb_height, VALUE rb_depth)
121
- {
122
- ILuint width = NUM2INT(rb_width);
123
- ILuint height = NUM2INT(rb_height);
124
- ILuint depth = NUM2INT(rb_depth);
125
-
126
- ILboolean flag = iluEnlargeCanvas(width, height, depth);
127
-
128
- return flag ? Qtrue : Qfalse;
129
- }
130
-
131
- static VALUE ilu_EdgeDetectP(VALUE obj)
132
- {
133
- ILboolean flag = iluEdgeDetectP();
134
-
135
- return flag ? Qtrue : Qfalse;
136
- }
137
-
138
- static VALUE ilu_EdgeDetectS(VALUE obj)
139
- {
140
- ILboolean flag = iluEdgeDetectS();
141
-
142
- return flag ? Qtrue : Qfalse;
143
- }
144
-
145
- static VALUE ilu_Emboss(VALUE obj)
146
- {
147
- ILboolean flag = iluEmboss();
148
-
149
- return flag ? Qtrue : Qfalse;
150
- }
151
-
152
- static VALUE ilu_Mirror(VALUE obj)
153
- {
154
- ILboolean flag = iluMirror();
155
-
156
- return flag ? Qtrue : Qfalse;
157
- }
158
-
159
- static VALUE ilu_SwapColours(VALUE obj)
160
- {
161
- ILboolean flag = iluSwapColours();
162
-
163
- return flag ? Qtrue : Qfalse;
164
- }
165
-
166
- static VALUE ilu_CompareImage(VALUE obj, VALUE rb_cmp_img)
167
- {
168
- ILuint cmp_img = NUM2INT(rb_cmp_img);
169
-
170
- ILboolean flag = iluCompareImage(rb_cmp_img);
171
-
172
- return flag ? Qtrue : Qfalse;
173
- }
174
- /* end of functions added by banisterfiend */
175
-
176
- void
177
- InitializeILU() {
178
- mILU = rb_define_module("ILU");
179
- rb_define_module_function(mILU, "Init", ilu_Init, 0);
180
- rb_define_module_function(mILU, "ErrorString", ilu_ErrorString, 1);
181
- rb_define_module_function(mILU, "Alienify", ilu_Alienify, 0);
182
- rb_define_module_function(mILU, "BlurAvg", ilu_BlurAvg, 1);
183
- rb_define_module_function(mILU, "BlurGaussian", ilu_BlurGaussian, 1);
184
- rb_define_module_function(mILU, "Contrast",ilu_Contrast , 1);
185
- rb_define_module_function(mILU, "Equalize",ilu_Equalize , 0);
186
- rb_define_module_function(mILU, "GammaCorrect",ilu_GammaCorrect , 1);
187
- rb_define_module_function(mILU, "Negative", ilu_Negative , 0);
188
- rb_define_module_function(mILU, "Noisify", ilu_Noisify , 1);
189
- rb_define_module_function(mILU, "Pixelize", ilu_Pixelize , 1);
190
- rb_define_module_function(mILU, "Sharpen", ilu_Sharpen, 2);
191
- rb_define_module_function(mILU, "Scale", ilu_Scale , 3);
192
- rb_define_module_function(mILU, "ImageParameter", ilu_ImageParameter , 2);
193
- rb_define_module_function(mILU, "BuildMipmaps", ilu_BuildMipmaps, 0);
194
-
195
- /* methods added by banisterfiend */
196
- rb_define_module_function(mILU, "FlipImage", ilu_FlipImage, 0);
197
- rb_define_module_function(mILU, "Rotate", ilu_Rotate, 1);
198
- rb_define_module_function(mILU, "Crop", ilu_Crop, 6);
199
- rb_define_module_function(mILU, "EnlargeCanvas", ilu_EnlargeCanvas, 3);
200
- rb_define_module_function(mILU, "EdgeDetectP", ilu_EdgeDetectP, 0);
201
- rb_define_module_function(mILU, "EdgeDetectS", ilu_EdgeDetectS, 0);
202
- rb_define_module_function(mILU, "Emboss", ilu_Emboss, 0);
203
- rb_define_module_function(mILU, "Mirror", ilu_Mirror, 0);
204
- rb_define_module_function(mILU, "SwapColours", ilu_SwapColours, 0);
205
- rb_define_module_function(mILU, "CompareImage", ilu_CompareImage, 1);
206
- /* end of functions added by banisterfiend */
207
-
208
- /* constants added by banisterfiend */
209
- rb_define_const(mILU, "FILTER", INT2NUM(ILU_FILTER));
210
- rb_define_const(mILU, "NEAREST", INT2NUM(ILU_NEAREST));
211
- rb_define_const(mILU, "LINEAR", INT2NUM(ILU_LINEAR));
212
- rb_define_const(mILU, "BILINEAR", INT2NUM(ILU_BILINEAR));
213
- rb_define_const(mILU, "SCALE_BOX", INT2NUM(ILU_SCALE_BOX));
214
- rb_define_const(mILU, "SCALE_TRIANGLE", INT2NUM(ILU_SCALE_TRIANGLE));
215
- rb_define_const(mILU, "SCALE_BELL", INT2NUM(ILU_SCALE_BELL));
216
- rb_define_const(mILU, "SCALE_BSPLINE", INT2NUM(ILU_SCALE_BSPLINE));
217
- rb_define_const(mILU, "SCALE_LANCZOS3", INT2NUM(ILU_SCALE_LANCZOS3));
218
- rb_define_const(mILU, "SCALE_MITCHELL", INT2NUM(ILU_SCALE_MITCHELL));
219
-
220
- rb_define_const(mILU, "PLACEMENT", INT2NUM(ILU_PLACEMENT));
221
- rb_define_const(mILU, "UPPER_LEFT", INT2NUM(ILU_UPPER_LEFT));
222
- rb_define_const(mILU, "LOWER_LEFT", INT2NUM(ILU_LOWER_LEFT));
223
- rb_define_const(mILU, "LOWER_RIGHT", INT2NUM(ILU_LOWER_RIGHT));
224
- rb_define_const(mILU, "UPPER_RIGHT", INT2NUM(ILU_UPPER_RIGHT));
225
- rb_define_const(mILU, "CENTER", INT2NUM(ILU_CENTER));
226
- /* end of constants added by banisterfiend */
227
-
228
- }
1
+ #include <ruby.h>
2
+ #include <IL/ilu.h>
3
+ #include "ruby_devil_ext.h"
4
+
5
+ static VALUE mILU;
6
+
7
+ static VALUE ilu_Init(VALUE obj) {
8
+ iluInit();
9
+ return Qnil;
10
+ }
11
+
12
+ static VALUE ilu_ErrorString(VALUE obj, VALUE rb_error) {
13
+ ILenum num = NUM2INT(rb_error);
14
+ const char* error = iluErrorString(num);
15
+ return rb_str_new2(error);
16
+ }
17
+
18
+ static VALUE ilu_Alienify(VALUE obj) {
19
+ ILboolean flag = iluAlienify();
20
+ return flag ? Qtrue : Qfalse;
21
+ }
22
+
23
+ static VALUE ilu_BlurAvg(VALUE obj, VALUE rb_iter) {
24
+ ILuint iter = NUM2INT(rb_iter);
25
+ ILboolean flag = iluBlurAvg(iter);
26
+ return flag ? Qtrue : Qfalse;
27
+ }
28
+
29
+ static VALUE ilu_BlurGaussian(VALUE obj, VALUE rb_iter) {
30
+ ILuint iter = NUM2INT(rb_iter);
31
+ ILboolean flag = iluBlurGaussian(iter);
32
+ return flag ? Qtrue : Qfalse;
33
+ }
34
+
35
+ static VALUE ilu_Contrast(VALUE obj, VALUE rb_cont) {
36
+ ILfloat cont = NUM2DBL(rb_cont);
37
+ ILboolean flag = iluContrast(cont);
38
+ return flag ? Qtrue : Qfalse;
39
+ }
40
+
41
+ static VALUE ilu_Equalize(VALUE obj) {
42
+ ILboolean flag = iluEqualize();
43
+ return flag ? Qtrue : Qfalse;
44
+ }
45
+
46
+ static VALUE ilu_GammaCorrect (VALUE obj, VALUE rb_gamma) {
47
+ ILfloat gamma = NUM2DBL(rb_gamma);
48
+ ILboolean flag = iluGammaCorrect(gamma);
49
+ return flag ? Qtrue : Qfalse;
50
+ }
51
+ static VALUE ilu_Negative (VALUE obj) {
52
+ ILboolean flag = iluNegative();
53
+ return flag ? Qtrue : Qfalse;
54
+ }
55
+ static VALUE ilu_Noisify (VALUE obj, VALUE rb_tolerance) {
56
+ ILclampf tolerance = NUM2DBL(rb_tolerance);
57
+ ILboolean flag = iluNoisify(tolerance);
58
+ return flag ? Qtrue : Qfalse;
59
+ }
60
+ static VALUE ilu_Pixelize (VALUE obj, VALUE rb_pix_size) {
61
+ ILuint pix = NUM2INT(rb_pix_size);
62
+ ILboolean flag = iluPixelize(pix);
63
+ return flag ? Qtrue : Qfalse;
64
+ }
65
+ static VALUE ilu_Sharpen (VALUE obj, VALUE rb_factor, VALUE rb_iter) {
66
+ ILfloat factor = NUM2DBL(rb_factor);
67
+ ILuint iter = NUM2INT(rb_iter);
68
+ ILboolean flag = iluSharpen(factor, iter);
69
+ return flag ? Qtrue : Qfalse;
70
+ }
71
+
72
+ static VALUE ilu_Scale(VALUE obj, VALUE rb_Width, VALUE rb_Height, VALUE rb_Depth) {
73
+ ILuint Width = NUM2INT(rb_Width);
74
+ ILuint Height = NUM2INT(rb_Height);
75
+ ILuint Depth = NUM2INT(rb_Depth);
76
+ ILboolean flag = iluScale(Width, Height, Depth);
77
+ return flag ? Qtrue : Qfalse;
78
+ }
79
+
80
+ static VALUE ilu_ImageParameter(VALUE obj, VALUE rb_PName, VALUE rb_Param) {
81
+ ILenum PName = NUM2INT(rb_PName);
82
+ ILenum Param = NUM2INT(rb_Param);
83
+ iluImageParameter(PName, Param);
84
+ return Qnil;
85
+ }
86
+
87
+ static VALUE ilu_BuildMipmaps(VALUE obj) {
88
+ ILboolean flag = iluBuildMipmaps();
89
+ return flag ? Qtrue : Qfalse;
90
+ }
91
+
92
+ /* functions added by banisterfiend */
93
+ static VALUE ilu_FlipImage(VALUE obj) {
94
+ ILboolean flag = iluFlipImage();
95
+ return flag ? Qtrue : Qfalse;
96
+ }
97
+
98
+ static VALUE ilu_Rotate(VALUE obj, VALUE rb_angle) {
99
+ ILfloat angle = NUM2DBL(rb_angle);
100
+
101
+ ILboolean flag = iluRotate(angle);
102
+
103
+ return flag ? Qtrue : Qfalse;
104
+ }
105
+
106
+ static VALUE ilu_Crop(VALUE obj, VALUE rb_XOff, VALUE rb_YOff, VALUE rb_ZOff, VALUE rb_width, VALUE rb_height, VALUE rb_depth)
107
+ {
108
+ ILuint XOff = NUM2INT(rb_XOff);
109
+ ILuint YOff = NUM2INT(rb_YOff);
110
+ ILuint ZOff = NUM2INT(rb_ZOff);
111
+ ILuint width = NUM2INT(rb_width);
112
+ ILuint height = NUM2INT(rb_height);
113
+ ILuint depth = NUM2INT(rb_depth);
114
+
115
+ ILboolean flag = iluCrop(XOff, YOff, ZOff, width, height, depth);
116
+
117
+ return flag ? Qtrue : Qfalse;
118
+ }
119
+
120
+ static VALUE ilu_EnlargeCanvas(VALUE obj, VALUE rb_width, VALUE rb_height, VALUE rb_depth)
121
+ {
122
+ ILuint width = NUM2INT(rb_width);
123
+ ILuint height = NUM2INT(rb_height);
124
+ ILuint depth = NUM2INT(rb_depth);
125
+
126
+ ILboolean flag = iluEnlargeCanvas(width, height, depth);
127
+
128
+ return flag ? Qtrue : Qfalse;
129
+ }
130
+
131
+ static VALUE ilu_EdgeDetectP(VALUE obj)
132
+ {
133
+ ILboolean flag = iluEdgeDetectP();
134
+
135
+ return flag ? Qtrue : Qfalse;
136
+ }
137
+
138
+ static VALUE ilu_EdgeDetectS(VALUE obj)
139
+ {
140
+ ILboolean flag = iluEdgeDetectS();
141
+
142
+ return flag ? Qtrue : Qfalse;
143
+ }
144
+
145
+ static VALUE ilu_Emboss(VALUE obj)
146
+ {
147
+ ILboolean flag = iluEmboss();
148
+
149
+ return flag ? Qtrue : Qfalse;
150
+ }
151
+
152
+ static VALUE ilu_Mirror(VALUE obj)
153
+ {
154
+ ILboolean flag = iluMirror();
155
+
156
+ return flag ? Qtrue : Qfalse;
157
+ }
158
+
159
+ static VALUE ilu_SwapColours(VALUE obj)
160
+ {
161
+ ILboolean flag = iluSwapColours();
162
+
163
+ return flag ? Qtrue : Qfalse;
164
+ }
165
+
166
+ static VALUE ilu_CompareImage(VALUE obj, VALUE rb_cmp_img)
167
+ {
168
+ ILuint cmp_img = NUM2INT(rb_cmp_img);
169
+
170
+ ILboolean flag = iluCompareImage(rb_cmp_img);
171
+
172
+ return flag ? Qtrue : Qfalse;
173
+ }
174
+ /* end of functions added by banisterfiend */
175
+
176
+ void
177
+ InitializeILU() {
178
+ mILU = rb_define_module("ILU");
179
+ rb_define_module_function(mILU, "Init", ilu_Init, 0);
180
+ rb_define_module_function(mILU, "ErrorString", ilu_ErrorString, 1);
181
+ rb_define_module_function(mILU, "Alienify", ilu_Alienify, 0);
182
+ rb_define_module_function(mILU, "BlurAvg", ilu_BlurAvg, 1);
183
+ rb_define_module_function(mILU, "BlurGaussian", ilu_BlurGaussian, 1);
184
+ rb_define_module_function(mILU, "Contrast",ilu_Contrast , 1);
185
+ rb_define_module_function(mILU, "Equalize",ilu_Equalize , 0);
186
+ rb_define_module_function(mILU, "GammaCorrect",ilu_GammaCorrect , 1);
187
+ rb_define_module_function(mILU, "Negative", ilu_Negative , 0);
188
+ rb_define_module_function(mILU, "Noisify", ilu_Noisify , 1);
189
+ rb_define_module_function(mILU, "Pixelize", ilu_Pixelize , 1);
190
+ rb_define_module_function(mILU, "Sharpen", ilu_Sharpen, 2);
191
+ rb_define_module_function(mILU, "Scale", ilu_Scale , 3);
192
+ rb_define_module_function(mILU, "ImageParameter", ilu_ImageParameter , 2);
193
+ rb_define_module_function(mILU, "BuildMipmaps", ilu_BuildMipmaps, 0);
194
+
195
+ /* methods added by banisterfiend */
196
+ rb_define_module_function(mILU, "FlipImage", ilu_FlipImage, 0);
197
+ rb_define_module_function(mILU, "Rotate", ilu_Rotate, 1);
198
+ rb_define_module_function(mILU, "Crop", ilu_Crop, 6);
199
+ rb_define_module_function(mILU, "EnlargeCanvas", ilu_EnlargeCanvas, 3);
200
+ rb_define_module_function(mILU, "EdgeDetectP", ilu_EdgeDetectP, 0);
201
+ rb_define_module_function(mILU, "EdgeDetectS", ilu_EdgeDetectS, 0);
202
+ rb_define_module_function(mILU, "Emboss", ilu_Emboss, 0);
203
+ rb_define_module_function(mILU, "Mirror", ilu_Mirror, 0);
204
+ rb_define_module_function(mILU, "SwapColours", ilu_SwapColours, 0);
205
+ rb_define_module_function(mILU, "CompareImage", ilu_CompareImage, 1);
206
+ /* end of functions added by banisterfiend */
207
+
208
+ /* constants added by banisterfiend */
209
+ rb_define_const(mILU, "FILTER", INT2NUM(ILU_FILTER));
210
+ rb_define_const(mILU, "NEAREST", INT2NUM(ILU_NEAREST));
211
+ rb_define_const(mILU, "LINEAR", INT2NUM(ILU_LINEAR));
212
+ rb_define_const(mILU, "BILINEAR", INT2NUM(ILU_BILINEAR));
213
+ rb_define_const(mILU, "SCALE_BOX", INT2NUM(ILU_SCALE_BOX));
214
+ rb_define_const(mILU, "SCALE_TRIANGLE", INT2NUM(ILU_SCALE_TRIANGLE));
215
+ rb_define_const(mILU, "SCALE_BELL", INT2NUM(ILU_SCALE_BELL));
216
+ rb_define_const(mILU, "SCALE_BSPLINE", INT2NUM(ILU_SCALE_BSPLINE));
217
+ rb_define_const(mILU, "SCALE_LANCZOS3", INT2NUM(ILU_SCALE_LANCZOS3));
218
+ rb_define_const(mILU, "SCALE_MITCHELL", INT2NUM(ILU_SCALE_MITCHELL));
219
+
220
+ rb_define_const(mILU, "PLACEMENT", INT2NUM(ILU_PLACEMENT));
221
+ rb_define_const(mILU, "UPPER_LEFT", INT2NUM(ILU_UPPER_LEFT));
222
+ rb_define_const(mILU, "LOWER_LEFT", INT2NUM(ILU_LOWER_LEFT));
223
+ rb_define_const(mILU, "LOWER_RIGHT", INT2NUM(ILU_LOWER_RIGHT));
224
+ rb_define_const(mILU, "UPPER_RIGHT", INT2NUM(ILU_UPPER_RIGHT));
225
+ rb_define_const(mILU, "CENTER", INT2NUM(ILU_CENTER));
226
+ /* end of constants added by banisterfiend */
227
+
228
+ }