class Cairo::PathCurveTo

Public Class Methods

new(*args) click to toggle source
static VALUE
cr_path_curve_to_initialize (int argc, VALUE *argv, VALUE self)
{
  VALUE point1, point2, point3, x1, y1, x2, y2, x3, y3;
  VALUE super_argv[2];

  rb_scan_args (argc, argv, "33", &x1, &y1, &x2, &y2, &x3, &y3);

  if (argc == 3)
    {
      point1 = x1;
      point2 = y1;
      point3 = x2;
    }
  else if (argc == 6)
    {
      point1 = cr_point_new (x1, y1);
      point2 = cr_point_new (x2, y2);
      point3 = cr_point_new (x3, y3);
    }
  else
    {
      VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv));
      rb_raise (rb_eArgError,
                "invalid argument: %s (expect "
                "(point1, point2, point3) or "
                "(x1, y1, x2, y2, x3, y3))",
                StringValuePtr (inspected_arg));
    }

  super_argv[0] = INT2NUM (CAIRO_PATH_CURVE_TO);
  super_argv[1] = rb_ary_new3 (3, point1, point2, point3);
  rb_call_super (2, super_argv);
  return Qnil;
}