Module: OilyPNG::Color
- Extended by:
- Color
- Included in:
- Color
- Defined in:
- lib/oily_png/canvas.rb,
ext/oily_png/oily_png_ext.c
Instance Method Summary collapse
- #a(value) ⇒ Object
- #b(value) ⇒ Object
- #compose_quick(fg_color, bg_color) ⇒ Object
- #euclidean_distance_rgba(color_after, color_before) ⇒ Object
- #g(value) ⇒ Object
- #r(value) ⇒ Object
Instance Method Details
#a(value) ⇒ Object
65 66 67 68 |
# File 'ext/oily_png/color.c', line 65
VALUE oily_png_color_a(VALUE self, VALUE value) {
UNUSED_PARAMETER(self);
return INT2FIX(A_BYTE(NUM2UINT(value)));
}
|
#b(value) ⇒ Object
60 61 62 63 |
# File 'ext/oily_png/color.c', line 60
VALUE oily_png_color_b(VALUE self, VALUE value) {
UNUSED_PARAMETER(self);
return INT2FIX(B_BYTE(NUM2UINT(value)));
}
|
#compose_quick(fg_color, bg_color) ⇒ Object
36 37 38 39 |
# File 'ext/oily_png/color.c', line 36
VALUE oily_png_color_compose_quick(VALUE self, VALUE fg_color, VALUE bg_color) {
UNUSED_PARAMETER(self);
return UINT2NUM(oily_png_compose_color(NUM2UINT(fg_color), NUM2UINT(bg_color)));
}
|
#euclidean_distance_rgba(color_after, color_before) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'ext/oily_png/color.c', line 41
VALUE oily_png_euclidean_distance_rgba(VALUE self, VALUE color_after, VALUE color_before) {
UNUSED_PARAMETER(self);
return rb_float_new(sqrt(pow((R_BYTE(NUM2UINT(color_after)) - R_BYTE(NUM2UINT(color_before))), 2) +
pow((G_BYTE(NUM2UINT(color_after)) - G_BYTE(NUM2UINT(color_before))), 2) +
pow((B_BYTE(NUM2UINT(color_after)) - B_BYTE(NUM2UINT(color_before))), 2) +
pow((A_BYTE(NUM2UINT(color_after)) - A_BYTE(NUM2UINT(color_before))), 2)));
}
|
#g(value) ⇒ Object
55 56 57 58 |
# File 'ext/oily_png/color.c', line 55
VALUE oily_png_color_g(VALUE self, VALUE value) {
UNUSED_PARAMETER(self);
return INT2FIX(G_BYTE(NUM2UINT(value)));
}
|
#r(value) ⇒ Object
50 51 52 53 |
# File 'ext/oily_png/color.c', line 50
VALUE oily_png_color_r(VALUE self, VALUE value) {
UNUSED_PARAMETER(self);
return INT2FIX(R_BYTE(NUM2UINT(value)));
}
|