Пример #1
0
/*
 * call-seq:
 *   to_s -> "<OpenCV::CvPoint:(self.x,self.y)>"
 *
 * Return x and y by String.
 */
VALUE
rb_to_s(VALUE self)
{
  const int i = 4;
  VALUE str[i];
  str[0] = rb_str_new2("<%s:(%d,%d)>");
  str[1] = rb_str_new2(rb_class2name(CLASS_OF(self)));
  str[2] = rb_x(self);
  str[3] = rb_y(self);
  return rb_f_sprintf(i, str);
}
Пример #2
0
/*
 * call-seq:
 *   to_ary -> [x, y]
 *
 * Return x and y by Array.
 */
VALUE
rb_to_ary(VALUE self)
{
  return rb_ary_new3(2, rb_x(self), rb_y(self));
}