Class: Cairo::PathCurveTo

Inherits:
PathData show all
Defined in:
ext/cairo/rb_cairo_path.c

Instance Method Summary collapse

Methods inherited from PathData

#close_path?, #curve_to?, #each, #line_to?, #move_to?, #to_a

Constructor Details

#initializeObject



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'ext/cairo/rb_cairo_path.c', line 176

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;
}