Module: PSDNative::Util
- Defined in:
- ext/psd_native/psd_native_ext.c
Instance Method Summary collapse
Instance Method Details
#clamp(r_num, r_min, r_max) ⇒ Object
11 12 13 14 15 16 17 |
# File 'ext/psd_native/util.c', line 11
VALUE psd_native_util_clamp(VALUE self, VALUE r_num, VALUE r_min, VALUE r_max) {
int num = FIX2INT(r_num);
int min = FIX2INT(r_min);
int max = FIX2INT(r_max);
return num > max ? r_max : (num < min ? r_min : r_num);
}
|
#pad2(i) ⇒ Object
3 4 5 |
# File 'ext/psd_native/util.c', line 3
VALUE psd_native_util_pad2(VALUE self, VALUE i) {
return INT2FIX((FIX2INT(i) + 1) & ~0x01);
}
|
#pad4(i) ⇒ Object
7 8 9 |
# File 'ext/psd_native/util.c', line 7
VALUE psd_native_util_pad4(VALUE self, VALUE i) {
return INT2FIX(((FIX2INT(i) + 4) & ~0x03) - 1);
}
|