Module: Axon::Interpolation
- Defined in:
- ext/axon/interpolation.c
Class Method Summary collapse
-
.bilinear(rb_scanline1, rb_scanline2, rb_width, rb_ty, rb_components) ⇒ Object
:nodoc:.
-
.nearest(rb_scanline, rb_width, rb_components) ⇒ Object
:nodoc:.
Class Method Details
.bilinear(rb_scanline1, rb_scanline2, rb_width, rb_ty, rb_components) ⇒ Object
:nodoc:
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'ext/axon/interpolation.c', line 69
static VALUE
bilinear(VALUE self, VALUE rb_scanline1, VALUE rb_scanline2, VALUE rb_width,
VALUE rb_ty, VALUE rb_components)
{
double ty;
unsigned char *scanline1, *scanline2;
int src_line_size;
size_t width, components, src_width;
width = NUM2INT(rb_width);
components = NUM2INT(rb_components);
ty = NUM2DBL(rb_ty);
Check_Type(rb_scanline1, T_STRING);
Check_Type(rb_scanline2, T_STRING);
src_line_size = RSTRING_LEN(rb_scanline1);
if (RSTRING_LEN(rb_scanline2) != src_line_size)
rb_raise(rb_eArgError, "Scanlines don't have the same width.");
src_width = src_line_size / components - 1;
scanline1 = RSTRING_PTR(rb_scanline1);
scanline2 = RSTRING_PTR(rb_scanline2);
return bilinear2(width, src_width, components, ty, scanline1, scanline2);
}
|
.nearest(rb_scanline, rb_width, rb_components) ⇒ Object
:nodoc:
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'ext/axon/interpolation.c', line 121
static VALUE
nearest(VALUE self, VALUE rb_scanline, VALUE rb_width, VALUE rb_components)
{
unsigned char *scanline;
size_t width, src_width, src_line_size, components;
width = NUM2INT(rb_width);
components = NUM2INT(rb_components);
Check_Type(rb_scanline, T_STRING);
src_line_size = RSTRING_LEN(rb_scanline);
scanline = RSTRING_PTR(rb_scanline);
src_width = src_line_size / components;
return nearest2(width, src_width, components, scanline);
}
|