ruby-vips 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/ext/header.h ADDED
@@ -0,0 +1,8 @@
1
+ #ifndef RUBY_VIPS_HEADER_H
2
+ #define RUBY_VIPS_HEADER_H
3
+
4
+ extern VALUE mVIPSHeader;
5
+
6
+ VipsBandFmt header_id_to_band_fmt(VALUE);
7
+
8
+ #endif
data/ext/image.c ADDED
@@ -0,0 +1,639 @@
1
+ #include "ruby_vips.h"
2
+ #include "header.h"
3
+
4
+ #include "image.h"
5
+ #include "image_arithmetic.h"
6
+ #include "image_boolean.h"
7
+ #include "image_colour.h"
8
+ #include "image_conversion.h"
9
+ #include "image_convolution.h"
10
+ #include "image_freq_filt.h"
11
+ #include "image_histograms_lut.h"
12
+ #include "image_morphology.h"
13
+ #include "image_mosaicing.h"
14
+ #include "image_relational.h"
15
+ #include "image_resample.h"
16
+
17
+ VALUE cVIPSImage;
18
+
19
+ static ID id_b_w, id_histogram, id_fourier, id_xyz, id_lab, id_cmyk, id_labq,
20
+ id_rgb, id_ucs, id_lch, id_labs, id_srgb, id_yxy, id_rgb16, id_grey16;
21
+
22
+ static ID id_none, id_rad;
23
+
24
+ static void
25
+ img_free(vipsImg *im)
26
+ {
27
+ if(im->in)
28
+ im_close(im->in);
29
+
30
+ if(im->deps)
31
+ xfree(im->deps);
32
+
33
+ xfree(im);
34
+ }
35
+
36
+ static void
37
+ img_mark(vipsImg *im)
38
+ {
39
+ int i;
40
+
41
+ for (i = 0; i < im->deps_len; i++)
42
+ rb_gc_mark(im->deps[i]);
43
+ }
44
+
45
+ VALUE
46
+ img_alloc(VALUE klass)
47
+ {
48
+ vipsImg *im;
49
+ VALUE new = Data_Make_Struct(klass, vipsImg, img_mark, img_free, im);
50
+ im->in = NULL;
51
+ im->deps = NULL;
52
+ im->deps_len = 0;
53
+
54
+ return new;
55
+ }
56
+
57
+ void
58
+ img_add_dep(vipsImg *im, VALUE dep)
59
+ {
60
+ int i;
61
+
62
+ for (i = 0; i < im->deps_len; i++)
63
+ if (im->deps[i] == dep)
64
+ return;
65
+
66
+ im->deps_len++;
67
+ im->deps = realloc(im->deps, im->deps_len * sizeof(VALUE*));
68
+ im->deps[im->deps_len - 1] = dep;
69
+ }
70
+
71
+ VALUE
72
+ img_init(VALUE klass, VipsImage *im)
73
+ {
74
+ vipsImg *data;
75
+ VALUE new;
76
+
77
+ new = img_alloc(klass);
78
+ Data_Get_Struct(new, vipsImg, data);
79
+ data->in = im;
80
+
81
+ return new;
82
+ }
83
+
84
+ VALUE
85
+ img_init_partial_anyclass(VALUE klass)
86
+ {
87
+ VipsImage *im;
88
+
89
+ if (!(im = im_open("img_init_partial", "p")))
90
+ vips_lib_error();
91
+
92
+ return img_init(klass, im);
93
+ }
94
+
95
+ VALUE
96
+ img_init_partial()
97
+ {
98
+ return img_init_partial_anyclass(cVIPSImage);
99
+ }
100
+
101
+ VALUE
102
+ img_spawn(VALUE parent)
103
+ {
104
+ vipsImg *im;
105
+ VALUE new = img_init_partial();
106
+ Data_Get_Struct(new, vipsImg, im);
107
+ img_add_dep(im, parent);
108
+
109
+ return new;
110
+ }
111
+
112
+ VALUE
113
+ img_spawn2(VALUE parent1, VALUE parent2)
114
+ {
115
+ VALUE new = img_spawn(parent1);
116
+ vipsImg *im;
117
+ Data_Get_Struct(new, vipsImg, im);
118
+
119
+ img_add_dep(im, parent2);
120
+ return new;
121
+ }
122
+
123
+ VALUE
124
+ img_spawn3(VALUE parent1, VALUE parent2, VALUE parent3)
125
+ {
126
+ VALUE new = img_spawn2(parent1, parent2);
127
+ vipsImg *im;
128
+ Data_Get_Struct(new, vipsImg, im);
129
+
130
+ img_add_dep(im, parent3);
131
+ return new;
132
+ }
133
+
134
+ ID
135
+ img_vtype_to_id(VipsType vtype)
136
+ {
137
+ switch(vtype) {
138
+ case IM_TYPE_B_W: return id_b_w;
139
+ case IM_TYPE_HISTOGRAM: return id_histogram;
140
+ case IM_TYPE_FOURIER: return id_fourier;
141
+ case IM_TYPE_XYZ: return id_xyz;
142
+ case IM_TYPE_LAB: return id_lab;
143
+ case IM_TYPE_CMYK: return id_cmyk;
144
+ case IM_TYPE_LABQ: return id_labq;
145
+ case IM_TYPE_RGB: return id_rgb;
146
+ case IM_TYPE_UCS: return id_ucs;
147
+ case IM_TYPE_LCH: return id_lch;
148
+ case IM_TYPE_LABS: return id_labs;
149
+ case IM_TYPE_sRGB: return id_srgb;
150
+ case IM_TYPE_YXY: return id_yxy;
151
+ case IM_TYPE_RGB16: return id_rgb16;
152
+ case IM_TYPE_GREY16: return id_grey16;
153
+ }
154
+ return id_b_w;
155
+ }
156
+
157
+ ID
158
+ img_coding_to_id(VipsCoding coding)
159
+ {
160
+ switch(coding) {
161
+ case IM_CODING_NONE: return id_none;
162
+ case IM_CODING_LABQ: return id_labq;
163
+ case IM_CODING_RAD: return id_rad;
164
+ }
165
+ return id_none;
166
+ }
167
+
168
+ /*
169
+ * call-seq:
170
+ * im.vtype -> image_type_symbol
171
+ *
172
+ * Returns the type of image that Vips has assigned to *self*. This can by any
173
+ * of:
174
+ *
175
+ * :B_W, :HISTOGRAM, :FOURIER, :XYZ, :LAB, :CMYK, :LABQ, :RGB, :UCS, :LCH,
176
+ * :LABS, :sRGB, :YXY, :RGB16, :GREY16
177
+ */
178
+
179
+ static VALUE
180
+ img_vtype(VALUE obj)
181
+ {
182
+ GetImg(obj, data, im);
183
+
184
+ if (im)
185
+ return ID2SYM(img_vtype_to_id(im->Type));
186
+
187
+ return Qnil;
188
+ }
189
+
190
+ /*
191
+ * call-seq:
192
+ * im.coding -> coding_symbol
193
+ *
194
+ * Returns the data coding for this image. Coding can be one of:
195
+ * :NONE, :LABQ, :RAD.
196
+ */
197
+
198
+ static VALUE
199
+ img_coding(VALUE obj)
200
+ {
201
+ GetImg(obj, data, im);
202
+
203
+ if (im)
204
+ return ID2SYM(img_coding_to_id(im->Coding));
205
+
206
+ return Qnil;
207
+ }
208
+
209
+ /*
210
+ * call-seq:
211
+ * im.kill -> number
212
+ *
213
+ * Returns whether this image has been flagged to stop processing.
214
+ */
215
+
216
+ static VALUE
217
+ img_kill(VALUE obj)
218
+ {
219
+ GetImg(obj, data, im);
220
+ return INT2FIX(im->kill);
221
+ }
222
+
223
+ /*
224
+ * call-seq:
225
+ * im.filename -> string
226
+ *
227
+ * Returns the path from which *self* was read.
228
+ */
229
+
230
+ static VALUE
231
+ img_filename(VALUE obj)
232
+ {
233
+ GetImg(obj, data, im);
234
+
235
+ if (im)
236
+ return rb_tainted_str_new2(im->filename);
237
+
238
+ return Qnil;
239
+ }
240
+
241
+
242
+ #define GETPIX( TYPE, CONVERSION ) { \
243
+ TYPE *p = (TYPE *) IM_IMAGE_ADDR(im, x, y); \
244
+ \
245
+ if (sz == 1) \
246
+ return CONVERSION(*p); \
247
+ \
248
+ ary = rb_ary_new2(sz); \
249
+ for (i = 0; i < sz; i++) \
250
+ rb_ary_push(ary, CONVERSION(p[i])); \
251
+ \
252
+ return ary; \
253
+ }
254
+
255
+ #define CGETPIX( TYPE, CONVERSION ) { \
256
+ TYPE *p = (TYPE *) IM_IMAGE_ADDR(im, x, y); \
257
+ \
258
+ ary = rb_ary_new2(sz); \
259
+ for (i = 0; i < sz; i++) { \
260
+ rb_ary_push(ary, rb_ary_new3(2, CONVERSION(p[0]), CONVERSION(p[1]))); \
261
+ p += 2; \
262
+ } \
263
+ \
264
+ return ary; \
265
+ }
266
+
267
+ static VALUE
268
+ img_pixel_to_rb(VipsImage *im, int x, int y)
269
+ {
270
+ const int sz = im->Bands;
271
+ int i;
272
+ VALUE ary;
273
+
274
+ switch( im->BandFmt ) {
275
+ case IM_BANDFMT_UCHAR: GETPIX( unsigned char, UINT2NUM ); break;
276
+ case IM_BANDFMT_CHAR: GETPIX( signed char, INT2NUM ); break;
277
+ case IM_BANDFMT_USHORT: GETPIX( unsigned short, UINT2NUM ); break;
278
+ case IM_BANDFMT_SHORT: GETPIX( signed short, INT2NUM ); break;
279
+ case IM_BANDFMT_UINT: GETPIX( unsigned int, UINT2NUM ); break;
280
+ case IM_BANDFMT_INT: GETPIX( signed int, INT2FIX ); break;
281
+ case IM_BANDFMT_FLOAT: GETPIX( float, rb_float_new ); break;
282
+
283
+ case IM_BANDFMT_DOUBLE: GETPIX( double, rb_float_new ); break;
284
+ case IM_BANDFMT_COMPLEX: CGETPIX( float, rb_float_new ); break;
285
+ case IM_BANDFMT_DPCOMPLEX: CGETPIX( double, rb_float_new ); break;
286
+ }
287
+ }
288
+
289
+ /*
290
+ * call-seq:
291
+ * im[x, y] -> number, ...
292
+ *
293
+ * Returns the band values at the given <i>x</i>, <i>y</i> location of the
294
+ * image. The upper left corner of the image is at 0, 0, and the lower right
295
+ * corner is at im.x_size - 1, im.y_size - 1.
296
+ *
297
+ * If it is a one-band image, then this method returns the value without an
298
+ * array.
299
+ */
300
+
301
+ static VALUE
302
+ img_aref(VALUE obj, VALUE v_x, VALUE v_y)
303
+ {
304
+ int x = NUM2INT(v_x);
305
+ int y = NUM2INT(v_y);
306
+ GetImg(obj, data, im);
307
+
308
+ if (im_incheck(im) || im_check_uncoded("img_aref", im))
309
+ vips_lib_error();
310
+
311
+ if (x >= im->Xsize || x < 0 || y >= im->Ysize || y < 0)
312
+ rb_raise(rb_eIndexError, "Index out of bounds");
313
+
314
+ return img_pixel_to_rb(im, x, y);
315
+ }
316
+
317
+ /*
318
+ * call-seq:
319
+ * im.each_pixel{|value, x, y|}
320
+ *
321
+ * Yields every pixel in the image, with coordinates.
322
+ */
323
+
324
+ static VALUE
325
+ img_each_pixel(VALUE obj)
326
+ {
327
+ int x, y;
328
+ VALUE pixel;
329
+ GetImg(obj, data, im);
330
+
331
+ if (im_incheck(im) || im_check_uncoded("img_each_pixel", im))
332
+ return( Qnil );
333
+
334
+ for(y = 0; y < im->Ysize; y++) {
335
+ for(x = 0; x < im->Xsize; x++) {
336
+ pixel = img_pixel_to_rb(im, x, y);
337
+ rb_yield(rb_ary_new3(3, pixel, INT2FIX(x), INT2FIX(y)));
338
+ }
339
+ }
340
+
341
+ return obj;
342
+ }
343
+
344
+ /*
345
+ * call-seq:
346
+ * im.data -> data_string
347
+ *
348
+ * Returns the uncompressed data of the image.
349
+ */
350
+
351
+ static VALUE
352
+ img_data(VALUE obj)
353
+ {
354
+ GetImg(obj, data, im);
355
+
356
+ if (im_incheck(im) || im_check_uncoded("img_aref", im))
357
+ return( Qnil );
358
+
359
+ return rb_tainted_str_new(im->data, IM_IMAGE_SIZEOF_LINE(im) * im->Ysize);
360
+ }
361
+
362
+ /*
363
+ * Image objects reference in-memory images. All operations that manipulate and
364
+ * return an image will simply add the operation to the pipeline and return an
365
+ * image that references the image after the operation. The actual operation is
366
+ * not performed until the image is written to a file or to a string.
367
+ */
368
+ void
369
+ init_Image(void)
370
+ {
371
+ cVIPSImage = rb_define_class_under(mVIPS, "Image", rb_cObject);
372
+ rb_define_alloc_func(cVIPSImage, img_alloc);
373
+ rb_include_module(cVIPSImage, mVIPSHeader);
374
+
375
+ rb_define_singleton_method(cVIPSImage, "linreg", img_s_linreg, -1); // in image_arithmetic.c
376
+ rb_define_singleton_method(cVIPSImage, "gaussnoise", img_s_gaussnoise, 4); // in image_conversion.c
377
+ rb_define_singleton_method(cVIPSImage, "black", img_s_black, 3); // in image_conversion.c
378
+ rb_define_singleton_method(cVIPSImage, "text", img_s_text, 5); // in image_conversion.c
379
+ rb_define_singleton_method(cVIPSImage, "fmask_ideal_highpass", img_s_fmask_ideal_highpass, 3); // in image_freq_filt.c
380
+ rb_define_singleton_method(cVIPSImage, "fmask_ideal_lowpass", img_s_fmask_ideal_lowpass, 3); // in image_freq_filt.c
381
+ rb_define_singleton_method(cVIPSImage, "fmask_butterworth_highpass", img_s_fmask_butterworth_highpass, 5); // in image_freq_filt.c
382
+ rb_define_singleton_method(cVIPSImage, "fmask_butterworth_lowpass", img_s_fmask_butterworth_lowpass, 5); // in image_freq_filt.c
383
+ rb_define_singleton_method(cVIPSImage, "fmask_gauss_highpass", img_s_fmask_gauss_highpass, 4); // in image_freq_filt.c
384
+ rb_define_singleton_method(cVIPSImage, "fmask_gauss_lowpass", img_s_fmask_gauss_lowpass, 4); // in image_freq_filt.c
385
+ rb_define_singleton_method(cVIPSImage, "fmask_ideal_ringpass", img_s_fmask_ideal_ringpass, 4); // in image_freq_filt.c
386
+ rb_define_singleton_method(cVIPSImage, "fmask_ideal_ringreject", img_s_fmask_ideal_ringreject, 4); // in image_freq_filt.c
387
+ rb_define_singleton_method(cVIPSImage, "fmask_butterworth_ringpass", img_s_fmask_butterworth_ringpass, 6); // in image_freq_filt.c
388
+ rb_define_singleton_method(cVIPSImage, "fmask_butterworth_ringreject", img_s_fmask_butterworth_ringreject, 6); // in image_freq_filt.c
389
+ rb_define_singleton_method(cVIPSImage, "fmask_gauss_ringpass", img_s_fmask_gauss_ringpass, 5); // in image_freq_filt.c
390
+ rb_define_singleton_method(cVIPSImage, "fmask_gauss_ringreject", img_s_fmask_gauss_ringreject, 5); // in image_freq_filt.c
391
+ rb_define_singleton_method(cVIPSImage, "fmask_ideal_bandpass", img_s_fmask_ideal_bandpass, 5); // in image_freq_filt.c
392
+ rb_define_singleton_method(cVIPSImage, "fmask_ideal_bandreject", img_s_fmask_ideal_bandreject, 5); // in image_freq_filt.c
393
+ rb_define_singleton_method(cVIPSImage, "fmask_butterworth_bandpass", img_s_fmask_butterworth_bandpass, 7); // in image_freq_filt.c
394
+ rb_define_singleton_method(cVIPSImage, "fmask_butterworth_bandreject", img_s_fmask_butterworth_bandreject, 7); // in image_freq_filt.c
395
+ rb_define_singleton_method(cVIPSImage, "fmask_gauss_bandpass", img_s_fmask_gauss_bandpass, 6); // in image_freq_filt.c
396
+ rb_define_singleton_method(cVIPSImage, "fmask_gauss_bandreject", img_s_fmask_gauss_bandreject, 6); // in image_freq_filt.c
397
+ rb_define_singleton_method(cVIPSImage, "fmask_fractal_flt", img_s_fmask_fractal_flt, 3); // in image_freq_filt.c
398
+ rb_define_singleton_method(cVIPSImage, "fractsurf", img_s_fractsurf, 2); // in image_freq_filt.c
399
+ rb_define_singleton_method(cVIPSImage, "identity", img_s_identity, 1); // in image_histograms_lut.c
400
+ rb_define_singleton_method(cVIPSImage, "identity_ushort", img_s_identity_ushort, 2); // in image_histograms_lut.c
401
+ rb_define_singleton_method(cVIPSImage, "invertlut", img_s_invertlut, 2); // in image_histograms_lut.c
402
+ rb_define_singleton_method(cVIPSImage, "buildlut", img_s_buildlut, 1); // in image_histograms_lut.c
403
+ rb_define_singleton_method(cVIPSImage, "tone_build_range", img_s_tone_build_range, 10); // in image_histograms_lut.c
404
+ rb_define_singleton_method(cVIPSImage, "tone_build", img_s_tone_build, 8); // in image_histograms_lut.c
405
+
406
+ rb_define_method(cVIPSImage, "[]", img_aref, 2);
407
+ rb_define_method(cVIPSImage, "each_pixel", img_each_pixel, 0);
408
+ rb_define_method(cVIPSImage, "data", img_data, 0);
409
+ rb_define_method(cVIPSImage, "vtype", img_vtype, 0);
410
+ rb_define_method(cVIPSImage, "coding", img_coding, 0);
411
+ rb_define_method(cVIPSImage, "filename", img_filename, 0);
412
+ rb_define_method(cVIPSImage, "kill", img_kill, 0);
413
+ rb_define_method(cVIPSImage, "measure_area", img_measure_area, 7); // in image_arithmetic.c
414
+ rb_define_method(cVIPSImage, "stats", img_stats, 0); // in image_arithmetic.c
415
+ rb_define_method(cVIPSImage, "max", img_max, 0); // in image_arithmetic.c
416
+ rb_define_method(cVIPSImage, "min", img_min, 0); // in image_arithmetic.c
417
+ rb_define_method(cVIPSImage, "avg", img_avg, 0); // in image_arithmetic.c
418
+ rb_define_method(cVIPSImage, "deviate", img_deviate, 0); // in image_arithmetic.c
419
+ rb_define_method(cVIPSImage, "maxpos", img_maxpos, -1); // in image_arithmetic.c
420
+ rb_define_method(cVIPSImage, "minpos", img_minpos, -1); // in image_arithmetic.c
421
+ rb_define_method(cVIPSImage, "maxpos_avg", img_maxpos_avg, 0); // in image_arithmetic.c
422
+ rb_define_method(cVIPSImage, "bandmean", img_bandmean, 0); // in image_arithmetic.c
423
+ rb_define_method(cVIPSImage, "add", img_add, 1); // in image_arithmetic.c
424
+ rb_define_alias(cVIPSImage, "+", "add");
425
+ rb_define_method(cVIPSImage, "subtract", img_subtract, 1); // in image_arithmetic.c
426
+ rb_define_alias(cVIPSImage, "-", "subtract");
427
+ rb_define_method(cVIPSImage, "invert", img_invert, 0); // in image_arithmetic.c
428
+ rb_define_method(cVIPSImage, "lin", img_lin, 2); // in image_arithmetic.c
429
+ rb_define_method(cVIPSImage, "multiply", img_multiply, 1); // in image_arithmetic.c
430
+ rb_define_alias(cVIPSImage, "*", "multiply");
431
+ rb_define_method(cVIPSImage, "divide", img_divide, 1); // in image_arithmetic.c
432
+ rb_define_alias(cVIPSImage, "/", "divide");
433
+ rb_define_method(cVIPSImage, "remainder", img_remainder, -1); // in image_arithmetic.c
434
+ rb_define_method(cVIPSImage, "%", img_remainder_binop, 1);
435
+ rb_define_method(cVIPSImage, "recomb", img_recomb, 1); // in image_arithmetic.c
436
+ rb_define_method(cVIPSImage, "sign", img_sign, 0); // in image_arithmetic.c
437
+ rb_define_method(cVIPSImage, "abs", img_abs, 0); // in image_arithmetic.c
438
+ rb_define_method(cVIPSImage, "floor", img_floor, 0); // in image_arithmetic.c
439
+ rb_define_method(cVIPSImage, "rint", img_rint, 0); // in image_arithmetic.c
440
+ rb_define_method(cVIPSImage, "ceil", img_ceil, 0); // in image_arithmetic.c
441
+ rb_define_method(cVIPSImage, "point", img_point, 4); // in image_arithmetic.c
442
+ rb_define_method(cVIPSImage, "pow", img_pow, -1); // in image_arithmetic.c
443
+ rb_define_method(cVIPSImage, "**", img_pow_binop, 1); // in image_arithmetic.c
444
+ rb_define_method(cVIPSImage, "expn", img_expn, -1); // in image_arithmetic.c
445
+ rb_define_method(cVIPSImage, "log", img_log, 0); // in image_arithmetic.c
446
+ rb_define_method(cVIPSImage, "log10", img_log10, 0); // in image_arithmetic.c
447
+ rb_define_method(cVIPSImage, "sin", img_sin, 0); // in image_arithmetic.c
448
+ rb_define_method(cVIPSImage, "cos", img_cos, 0); // in image_arithmetic.c
449
+ rb_define_method(cVIPSImage, "tan", img_tan, 0); // in image_arithmetic.c
450
+ rb_define_method(cVIPSImage, "asin", img_asin, 0); // in image_arithmetic.c
451
+ rb_define_method(cVIPSImage, "acos", img_acos, 0); // in image_arithmetic.c
452
+ rb_define_method(cVIPSImage, "atan", img_atan, 0); // in image_arithmetic.c
453
+ rb_define_method(cVIPSImage, "cross_phase", img_cross_phase, 1); // in image_arithmetic.c
454
+ rb_define_method(cVIPSImage, "and", img_and, -1); // in image_boolean.c
455
+ rb_define_method(cVIPSImage, "&", img_and_binop, 1);
456
+ rb_define_method(cVIPSImage, "or", img_or, -1); // in image_boolean.c
457
+ rb_define_method(cVIPSImage, "|", img_or_binop, 1);
458
+ rb_define_method(cVIPSImage, "xor", img_xor, -1); // in image_boolean.c
459
+ rb_define_method(cVIPSImage, "^", img_xor_binop, 1);
460
+ rb_define_method(cVIPSImage, "<<", img_shiftleft, 1); // in image_boolean.c
461
+ rb_define_method(cVIPSImage, ">>", img_shiftright, 1); // in image_boolean.c
462
+ rb_define_method(cVIPSImage, "lab_to_lch", img_lab_to_lch, 0); // in image_colour.c
463
+ rb_define_method(cVIPSImage, "lch_to_lab", img_lch_to_lab, 0); // in image_colour.c
464
+ rb_define_method(cVIPSImage, "labq_to_xyz", img_labq_to_xyz, 0); // in image_colour.c
465
+ rb_define_method(cVIPSImage, "rad_to_float", img_rad_to_float, 0); // in image_colour.c
466
+ rb_define_method(cVIPSImage, "float_to_rad", img_float_to_rad, 0); // in image_colour.c
467
+ rb_define_method(cVIPSImage, "lch_to_ucs", img_lch_to_ucs, 0); // in image_colour.c
468
+ rb_define_method(cVIPSImage, "lab_to_labq", img_lab_to_labq, 0); // in image_colour.c
469
+ rb_define_method(cVIPSImage, "lab_to_labs", img_lab_to_labs, 0); // in image_colour.c
470
+ rb_define_method(cVIPSImage, "lab_to_xyz", img_lab_to_xyz, 0); // in image_colour.c
471
+ rb_define_method(cVIPSImage, "lab_to_xyz_temp", img_lab_to_xyz_temp, 3); // in image_colour.c
472
+ rb_define_method(cVIPSImage, "lab_to_ucs", img_lab_to_ucs, 0); // in image_colour.c
473
+ rb_define_method(cVIPSImage, "labq_to_lab", img_labq_to_lab, 0); // in image_colour.c
474
+ rb_define_method(cVIPSImage, "labq_to_labs", img_labq_to_labs, 0); // in image_colour.c
475
+ rb_define_method(cVIPSImage, "labs_to_labq", img_labs_to_labq, 0); // in image_colour.c
476
+ rb_define_method(cVIPSImage, "labs_to_lab", img_labs_to_lab, 0); // in image_colour.c
477
+ rb_define_method(cVIPSImage, "ucs_to_xyz", img_ucs_to_xyz, 0); // in image_colour.c
478
+ rb_define_method(cVIPSImage, "ucs_to_lch", img_ucs_to_lch, 0); // in image_colour.c
479
+ rb_define_method(cVIPSImage, "ucs_to_lab", img_ucs_to_lab, 0); // in image_colour.c
480
+ rb_define_method(cVIPSImage, "xyz_to_lab", img_xyz_to_lab, 0); // in image_colour.c
481
+ rb_define_method(cVIPSImage, "xyz_to_lab_temp", img_xyz_to_lab_temp, 3); // in image_colour.c
482
+ rb_define_method(cVIPSImage, "xyz_to_ucs", img_xyz_to_ucs, 0); // in image_colour.c
483
+ rb_define_method(cVIPSImage, "srgb_to_xyz", img_srgb_to_xyz, 0); // in image_colour.c
484
+ rb_define_method(cVIPSImage, "xyz_to_srgb", img_xyz_to_srgb, 0); // in image_colour.c
485
+ rb_define_method(cVIPSImage, "yxy_to_xyz", img_yxy_to_xyz, 0); // in image_colour.c
486
+ rb_define_method(cVIPSImage, "xyz_to_yxy", img_xyz_to_yxy, 0); // in image_colour.c
487
+ rb_define_method(cVIPSImage, "decmc_from_lab", img_decmc_from_lab, 1); // in image_colour.c
488
+ rb_define_method(cVIPSImage, "de00_from_lab", img_de00_from_lab, 1); // in image_colour.c
489
+ rb_define_method(cVIPSImage, "de_from_xyz", img_de_from_xyz, 1); // in image_colour.c
490
+ rb_define_method(cVIPSImage, "de_from_lab", img_de_from_lab, 1); // in image_colour.c
491
+ rb_define_method(cVIPSImage, "im_lab_morph", img_lab_morph, 5); // in image_colour.c
492
+ rb_define_method(cVIPSImage, "icc_transform", img_icc_transform, 3); // in image_colour.c
493
+ rb_define_method(cVIPSImage, "icc_import", img_icc_import, 2); // in image_colour.c
494
+ rb_define_method(cVIPSImage, "icc_import_embedded", img_icc_import_embedded, 1); // in image_colour.c
495
+ rb_define_method(cVIPSImage, "icc_export_depth", img_icc_export_depth, 3); // in image_colour.c
496
+ rb_define_method(cVIPSImage, "icc_ac2rc", img_icc_ac2rc, 1); // in image_colour.c
497
+ rb_define_method(cVIPSImage, "to_mask", img_to_mask, 0); // in image_conversion.c
498
+ rb_define_method(cVIPSImage, "copy_file", img_copy_file, 0); // in image_conversion.c
499
+ rb_define_method(cVIPSImage, "dup", img_dup, 0); // in image_conversion.c
500
+ rb_define_method(cVIPSImage, "clip2fmt", img_clip2fmt, 1); // in image_conversion.c
501
+ rb_define_method(cVIPSImage, "scale", img_scale, 0); // in image_conversion.c
502
+ rb_define_method(cVIPSImage, "msb", img_msb, -1); // in image_conversion.c
503
+ rb_define_method(cVIPSImage, "copy_swap", img_copy_swap, 0); // in image_conversion.c
504
+ rb_define_method(cVIPSImage, "copy_native", img_copy_native, 1); // in image_conversion.c
505
+ rb_define_method(cVIPSImage, "c2amph", img_c2amph, 0); // in image_conversion.c
506
+ rb_define_method(cVIPSImage, "c2rect", img_c2rect, 0); // in image_conversion.c
507
+ rb_define_method(cVIPSImage, "ri2c", img_ri2c, 1); // in image_conversion.c
508
+ rb_define_method(cVIPSImage, "c2imag", img_c2imag, 0); // in image_conversion.c
509
+ rb_define_method(cVIPSImage, "c2real", img_c2real, 0); // in image_conversion.c
510
+ rb_define_method(cVIPSImage, "scaleps", img_scaleps, 0); // in image_conversion.c
511
+ rb_define_method(cVIPSImage, "falsecolour", img_falsecolour, 0); // in image_conversion.c
512
+ rb_define_method(cVIPSImage, "extract_band", img_extract_band, -1); // in image_conversion.c
513
+ rb_define_method(cVIPSImage, "extract_area", img_extract_area, -1); // in image_conversion.c
514
+ rb_define_method(cVIPSImage, "embed", img_embed, 5); // in image_conversion.c
515
+ rb_define_method(cVIPSImage, "bandjoin", img_bandjoin, -1); // in image_conversion.c
516
+ rb_define_method(cVIPSImage, "insert", img_insert, -1); // in image_conversion.c
517
+ rb_define_method(cVIPSImage, "insert_noexpand", img_insert_noexpand, 3); // in image_conversion.c
518
+ rb_define_method(cVIPSImage, "lrjoin", img_lrjoin, 1); // in image_conversion.c
519
+ rb_define_method(cVIPSImage, "tbjoin", img_tbjoin, 1); // in image_conversion.c
520
+ rb_define_method(cVIPSImage, "replicate", img_replicate, 2); // in image_conversion.c
521
+ rb_define_method(cVIPSImage, "grid", img_grid, 3); // in image_conversion.c
522
+ rb_define_method(cVIPSImage, "wrap", img_wrap, 2); // in image_conversion.c
523
+ rb_define_method(cVIPSImage, "fliphor", img_fliphor, 0); // in image_conversion.c
524
+ rb_define_method(cVIPSImage, "flipver", img_flipver, 0); // in image_conversion.c
525
+ rb_define_method(cVIPSImage, "rot90", img_rot90, 0); // in image_conversion.c
526
+ rb_define_method(cVIPSImage, "rot180", img_rot180, 0); // in image_conversion.c
527
+ rb_define_method(cVIPSImage, "rot270", img_rot270, 0); // in image_conversion.c
528
+ rb_define_method(cVIPSImage, "subsample", img_subsample, -1); // in image_conversion.c
529
+ rb_define_method(cVIPSImage, "zoom", img_zoom, -1); // in image_conversion.c
530
+ rb_define_method(cVIPSImage, "conv", img_conv, 1); // in image_convolution.c
531
+ rb_define_method(cVIPSImage, "convsep", img_convsep, 1); // in image_convolution.c
532
+ rb_define_method(cVIPSImage, "compass", img_compass, 1); // in image_convolution.c
533
+ rb_define_method(cVIPSImage, "gradient", img_gradient, 1); // in image_convolution.c
534
+ rb_define_method(cVIPSImage, "lindetect", img_lindetect, 1); // in image_convolution.c
535
+ rb_define_method(cVIPSImage, "sharpen", img_sharpen, 6); // in image_convolution.c
536
+ rb_define_method(cVIPSImage, "grad_x", img_grad_x, 0); // in image_convolution.c
537
+ rb_define_method(cVIPSImage, "grad_y", img_grad_y, 0); // in image_convolution.c
538
+ rb_define_method(cVIPSImage, "fastcor", img_fastcor, 1); // in image_convolution.c
539
+ rb_define_method(cVIPSImage, "spcor", img_spcor, 1); // in image_convolution.c
540
+ rb_define_method(cVIPSImage, "gradcor", img_gradcor, 1); // in image_convolution.c
541
+ rb_define_method(cVIPSImage, "contrast_surface", img_contrast_surface, 2); // in image_convolution.c
542
+ rb_define_method(cVIPSImage, "addgnoise", img_addgnoise, 1); // in image_convolution.c
543
+ rb_define_method(cVIPSImage, "fwfft", img_fwfft, 0); // in image_freq_filt.c
544
+ rb_define_method(cVIPSImage, "invfft", img_invfft, 0); // in image_freq_filt.c
545
+ rb_define_method(cVIPSImage, "rotquad", img_rotquad, 0); // in image_freq_filt.c
546
+ rb_define_method(cVIPSImage, "invfftr", img_invfftr, 0); // in image_freq_filt.c
547
+ rb_define_method(cVIPSImage, "freqflt", img_freqflt, 1); // in image_freq_filt.c
548
+ rb_define_method(cVIPSImage, "disp_ps", img_disp_ps, 0); // in image_freq_filt.c
549
+ rb_define_method(cVIPSImage, "phasecor_fft", img_phasecor_fft, 1); // in image_freq_filt.c
550
+ rb_define_method(cVIPSImage, "histgr", img_histgr, -1); // in image_histograms_lut.c
551
+ rb_define_method(cVIPSImage, "histnd", img_histnd, 1); // in image_histograms_lut.c
552
+ rb_define_method(cVIPSImage, "hist_indexed", img_hist_indexed, 1); // in image_histograms_lut.c
553
+ rb_define_method(cVIPSImage, "project", img_project, 0); // in image_histograms_lut.c
554
+ rb_define_method(cVIPSImage, "histnorm", img_histnorm, 0); // in image_histograms_lut.c
555
+ rb_define_method(cVIPSImage, "histcum", img_histcum, 0); // in image_histograms_lut.c
556
+ rb_define_method(cVIPSImage, "histeq", img_histeq, 0); // in image_histograms_lut.c
557
+ rb_define_method(cVIPSImage, "histspec", img_histspec, 1); // in image_histograms_lut.c
558
+ rb_define_method(cVIPSImage, "monotonic?", img_monotonic_p, 0); // in image_histograms_lut.c
559
+ rb_define_method(cVIPSImage, "hist", img_hist, -1); // in image_histograms_lut.c
560
+ rb_define_method(cVIPSImage, "hsp", img_hsp, 1); // in image_histograms_lut.c
561
+ rb_define_method(cVIPSImage, "gammacorrect", img_gammacorrect, 1); // in image_histograms_lut.c
562
+ rb_define_method(cVIPSImage, "mpercent_hist", img_mpercent_hist, 1); // in image_histograms_lut.c
563
+ rb_define_method(cVIPSImage, "mpercent", img_mpercent, 1); // in image_histograms_lut.c
564
+ rb_define_method(cVIPSImage, "heq", img_heq, -1); // in image_histograms_lut.c
565
+ rb_define_method(cVIPSImage, "lhisteq", img_lhisteq, 2); // in image_histograms_lut.c
566
+ rb_define_method(cVIPSImage, "stdif", img_stdif, 6); // in image_histograms_lut.c
567
+ rb_define_method(cVIPSImage, "tone_analyze", img_tone_analyze, 6); // in image_histograms_lut.c
568
+ rb_define_method(cVIPSImage, "maplut", img_maplut, 1); // in image_histograms_lut.c
569
+ rb_define_method(cVIPSImage, "histplot", img_histplot, 0); // in image_histograms_lut.c
570
+ rb_define_method(cVIPSImage, "dilate", img_dilate, 1); // in image_morphology.c
571
+ rb_define_method(cVIPSImage, "erode", img_erode, 1); // in image_morphology.c
572
+ rb_define_method(cVIPSImage, "rank", img_rank, 3); // in image_morphology.c
573
+ rb_define_method(cVIPSImage, "rank_image", img_rank_image, -1); // in image_morphology.c
574
+ rb_define_method(cVIPSImage, "maxvalue", img_maxvalue, -1); // in image_morphology.c
575
+ rb_define_method(cVIPSImage, "cntlines_h", img_cntlines_h, 0); // in image_morphology.c
576
+ rb_define_method(cVIPSImage, "cntlines_v", img_cntlines_v, 0); // in image_morphology.c
577
+ rb_define_method(cVIPSImage, "zerox_pos", img_zerox_pos, 0); // in image_morphology.c
578
+ rb_define_method(cVIPSImage, "zerox_neg", img_zerox_neg, 0); // in image_morphology.c
579
+ rb_define_method(cVIPSImage, "profile_h", img_profile_h, 0); // in image_morphology.c
580
+ rb_define_method(cVIPSImage, "profile_v", img_profile_v, 0); // in image_morphology.c
581
+ rb_define_method(cVIPSImage, "label_regions", img_label_regions, 0); // in image_morphology.c
582
+ rb_define_method(cVIPSImage, "lrmerge", img_lrmerge, -1); // in image_mosaicing.c
583
+ rb_define_method(cVIPSImage, "tbmerge", img_tbmerge, -1); // in image_mosaicing.c
584
+ rb_define_method(cVIPSImage, "lrmerge1", img_lrmerge1, -1); // in image_mosaicing.c
585
+ rb_define_method(cVIPSImage, "tbmerge1", img_tbmerge1, -1); // in image_mosaicing.c
586
+ rb_define_method(cVIPSImage, "lrmosaic", img_lrmosaic, -1); // in image_mosaicing.c
587
+ rb_define_method(cVIPSImage, "tbmosaic", img_tbmosaic, -1); // in image_mosaicing.c
588
+ rb_define_method(cVIPSImage, "lrmosaic1", img_lrmosaic1, -1); // in image_mosaicing.c
589
+ rb_define_method(cVIPSImage, "tbmosaic1", img_tbmosaic1, -1); // in image_mosaicing.c
590
+ rb_define_method(cVIPSImage, "global_balance", img_global_balance, 1); // in image_mosaicing.c
591
+ rb_define_method(cVIPSImage, "global_balancef", img_global_balancef, 1); // in image_mosaicing.c
592
+ rb_define_method(cVIPSImage, "correl", img_correl, 7); // in image_mosaicing.c
593
+ rb_define_method(cVIPSImage, "align_bands", img_align_bands, 0); // in image_mosaicing.c
594
+ rb_define_method(cVIPSImage, "maxpos_subpel", img_maxpos_subpel, 0); // in image_mosaicing.c
595
+ rb_define_method(cVIPSImage, "equal", img_equal, -1); // in image_relational.c
596
+ rb_define_method(cVIPSImage, "notequal", img_notequal, -1); // in image_relational.c
597
+ rb_define_method(cVIPSImage, "less", img_less, -1); // in image_relational.c
598
+ rb_define_method(cVIPSImage, "lesseq", img_lesseq, -1); // in image_relational.c
599
+ rb_define_method(cVIPSImage, "more", img_more, -1); // in image_relational.c
600
+ rb_define_method(cVIPSImage, "moreeq", img_moreeq, -1); // in image_relational.c
601
+ rb_define_method(cVIPSImage, "ifthenelse", img_ifthenelse, 2); // in image_relational.c
602
+ rb_define_method(cVIPSImage, "blend", img_blend, 2); // in image_relational.c
603
+ rb_define_method(cVIPSImage, "affinei", img_affinei, -1); // in image_resample.c
604
+ rb_define_method(cVIPSImage, "affinei_resize", img_affinei_resize, -1); // in image_resample.c
605
+ rb_define_method(cVIPSImage, "stretch3", img_stretch3, -1); // in image_resample.c
606
+ rb_define_method(cVIPSImage, "shrink", img_shrink, -1); // in image_resample.c
607
+ rb_define_method(cVIPSImage, "rightshift_size", img_rightshift_size, 3); // in image_resample.c
608
+ rb_define_method(cVIPSImage, "match_linear", img_match_linear, 9); // in image_resample.c
609
+ rb_define_method(cVIPSImage, "match_linear_search", img_match_linear_search, 11); // in image_resample.c
610
+
611
+ id_b_w = rb_intern("B_W");
612
+ id_histogram = rb_intern("HISTOGRAM");
613
+ id_fourier = rb_intern("FOURIER");
614
+ id_xyz = rb_intern("XYZ");
615
+ id_lab = rb_intern("LAB");
616
+ id_cmyk = rb_intern("CMYK");
617
+ id_labq = rb_intern("LABQ");
618
+ id_rgb = rb_intern("RGB");
619
+ id_ucs = rb_intern("UCS");
620
+ id_lch = rb_intern("LCH");
621
+ id_labs = rb_intern("LABS");
622
+ id_srgb = rb_intern("sRGB");
623
+ id_yxy = rb_intern("YXY");
624
+ id_rgb16 = rb_intern("RGB16");
625
+ id_grey16 = rb_intern("GREY16");
626
+
627
+ id_none = rb_intern("NONE");
628
+ id_rad = rb_intern("RAD");
629
+
630
+ init_Image_colour();
631
+ init_Image_conversion();
632
+ init_Image_mosaicing();
633
+
634
+ #if 0
635
+ mVIPS = rb_define_module("VIPS");
636
+ mVIPSHeader = rb_define_module_under(mVIPS, "Header");
637
+ #endif
638
+ }
639
+