Method: VIPS::Mask#initialize
- Defined in:
- ext/mask.c
#new(coeffs, scale = 1, offset = 0) ⇒ Object
Create a new Mask object. coeffs is a two-dimensional array where every row must have the same length. Note that some methods require a mask where all values in coeffs are whole integers.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'ext/mask.c', line 97 static VALUE mask_initialize(int argc, VALUE *argv, VALUE obj) { VALUE coeffs, scale, offset; vipsMask *msk; Data_Get_Struct(obj, vipsMask, msk); rb_scan_args(argc, argv, "12", &coeffs, &scale, &offset); if (NIL_P(scale)) scale = INT2NUM(1); if (NIL_P(offset)) offset = INT2NUM(0); if(TYPE(scale) == T_FIXNUM && TYPE(offset) == T_FIXNUM && ary_is_int_2d(coeffs)) { msk->imask = mask_ary2imask(coeffs); msk->imask->scale = NUM2INT(scale); msk->imask->offset = NUM2INT(offset); } msk->dmask = mask_ary2dmask(coeffs); msk->dmask->scale = NUM2DBL(scale); msk->dmask->offset = NUM2DBL(offset); return obj; } |