static SeedValue seed_cairo_pattern_add_color_stop_rgba (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { gdouble offset, r, g, b, a; cairo_pattern_t *pat; CHECK_THIS(); if (argument_count != 5) { EXPECTED_EXCEPTION("add_color_stop_rgba", "5 arguments"); } pat = seed_object_get_private (this_object); offset = seed_value_to_double (ctx, arguments[0], exception); r = seed_value_to_double (ctx, arguments[1], exception); g = seed_value_to_double (ctx, arguments[2], exception); b = seed_value_to_double (ctx, arguments[3], exception); a = seed_value_to_double (ctx, arguments[4], exception); cairo_pattern_add_color_stop_rgba (pat, offset, r, g, b, a); return seed_make_undefined (ctx); }
static SeedValue seed_cairo_matrix_transform_point (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { SeedValue ret[2]; gdouble x, y; cairo_matrix_t m; if (argument_count != 3) { EXPECTED_EXCEPTION("transform_point", "3 arguments"); } if (!seed_value_to_cairo_matrix (ctx, arguments[0], &m, exception)) { seed_make_exception (ctx, exception, "ArgumentError", "transform_point needs an array [xx, yx, xy, yy, x0, y0]"); } x = seed_value_to_double (ctx, arguments[1], exception); y = seed_value_to_double (ctx, arguments[2], exception); cairo_matrix_transform_point (&m, &x, &y); ret[0] = seed_value_from_double (ctx, x, exception); ret[1] = seed_value_from_double (ctx, y, exception); return seed_make_array (ctx, ret, 2, exception); }
static SeedValue seed_cairo_surface_create_similar (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { gint width, height; cairo_surface_t *surface, *ret; cairo_content_t content; CHECK_THIS(); if (argument_count != 3) { EXPECTED_EXCEPTION("create_similar", "3 arguments"); } surface = seed_object_to_cairo_surface (ctx, this_object, exception); if (!surface) return seed_make_undefined (ctx); content = seed_value_to_long (ctx, arguments[0], exception); width = seed_value_to_int (ctx, arguments[1], exception); height = seed_value_to_int (ctx, arguments[2], exception); ret = cairo_surface_create_similar (surface, content, width, height); return seed_object_from_cairo_surface (ctx, ret); }
static SeedValue seed_cairo_matrix_rotate (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { gdouble angle; cairo_matrix_t m; if (argument_count != 2) { EXPECTED_EXCEPTION("rotate", "2 arguments"); } if (!seed_value_to_cairo_matrix (ctx, arguments[0], &m, exception)) { seed_make_exception (ctx, exception, "ArgumentError", "rotate needs an array [xx, yx, xy, yy, x0, y0]"); } angle = seed_value_to_double (ctx, arguments[1], exception); cairo_matrix_rotate (&m, angle); return seed_value_from_cairo_matrix (ctx, &m, exception); }
static SeedValue seed_cairo_surface_write_to_png (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { cairo_status_t ret; cairo_surface_t *surf; gchar *filename; CHECK_THIS(); if (argument_count != 1) { EXPECTED_EXCEPTION("write_to_png", "1 argument"); } surf = seed_object_get_private (this_object); filename = seed_value_to_string (ctx, arguments[0], exception); ret = cairo_surface_write_to_png (surf, filename); g_free (filename); return seed_value_from_long (ctx, ret, exception); }
static SeedValue seed_cairo_surface_mark_dirty_rectangle(SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { cairo_surface_t *surf; guint x, y, width, height; CHECK_THIS(); if (argument_count != 4) { EXPECTED_EXCEPTION("mark_dirty_rectangle", "4 arguments"); } surf = seed_object_to_cairo_surface (ctx, this_object, exception); x = seed_value_to_int (ctx, arguments[0], exception); y = seed_value_to_int (ctx, arguments[1], exception); width = seed_value_to_int (ctx, arguments[2], exception); height = seed_value_to_int (ctx, arguments[3], exception); cairo_surface_mark_dirty_rectangle (surf, x, y, width, height); return seed_make_undefined (ctx); }
SeedValue seed_cairo_status_to_string (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { cairo_status_t status; if (argument_count != 1) { EXPECTED_EXCEPTION("status_to_string", "1 argument"); } status = seed_value_to_long (ctx, arguments[0], exception); return seed_value_from_string (ctx, cairo_status_to_string (status), exception); }
static SeedObject seed_cairo_construct_linear_gradient (SeedContext ctx, SeedObject constructor, size_t argument_count, const SeedValue arguments[], SeedException * exception) { gdouble x0,y0,x1,y1; if (argument_count != 4) { EXPECTED_EXCEPTION("LinearGradient constructor", "4 arguments"); } x0 = seed_value_to_double (ctx, arguments[0], exception); y0 = seed_value_to_double (ctx, arguments[1], exception); x1 = seed_value_to_double (ctx, arguments[2], exception); y1 = seed_value_to_double (ctx, arguments[3], exception); return seed_object_from_cairo_pattern (ctx, cairo_pattern_create_linear (x0, y0, x1, y1)); }
static SeedValue seed_cairo_matrix_init_rotate (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { gdouble angle; cairo_matrix_t m; if (argument_count != 1) { EXPECTED_EXCEPTION("init_rotate", "1 arguments"); } angle = seed_value_to_double (ctx, arguments[0], exception); cairo_matrix_init_rotate (&m, angle); return seed_value_from_cairo_matrix (ctx, &m, exception); }
static SeedValue seed_cairo_matrix_init_translate (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { gdouble x, y; cairo_matrix_t m; if (argument_count != 2) { EXPECTED_EXCEPTION("init_translate", "2 arguments"); } x = seed_value_to_double (ctx, arguments[0], exception); y = seed_value_to_double (ctx, arguments[1], exception); cairo_matrix_init_translate (&m, x, y); return seed_value_from_cairo_matrix (ctx, &m, exception); }
static SeedObject seed_cairo_construct_pdf_surface (SeedContext ctx, SeedObject constructor, size_t argument_count, const SeedValue arguments[], SeedException * exception) { cairo_surface_t *ret; gchar *filename = NULL; gdouble width, height; if (argument_count != 3) { EXPECTED_EXCEPTION("PDFSurface", "3 arguments"); } if (!seed_value_is_null (ctx, arguments[0])) filename = seed_value_to_string (ctx, arguments[0], exception); width = seed_value_to_double (ctx, arguments[1], exception); height = seed_value_to_double (ctx, arguments[2], exception); ret = cairo_pdf_surface_create (filename, width, height); return seed_object_from_cairo_pdf_surface (ctx, ret); }
static SeedObject seed_cairo_construct_radial_gradient (SeedContext ctx, SeedObject constructor, size_t argument_count, const SeedValue arguments[], SeedException * exception) { gdouble cx0, cy0, r0, cx1, cy1, r1; if (argument_count != 6) { EXPECTED_EXCEPTION("RadialGradient constructor", "6 arguments"); } cx0 = seed_value_to_double (ctx, arguments[0], exception); cy0 = seed_value_to_double (ctx, arguments[1], exception); r0 = seed_value_to_double (ctx, arguments[2], exception); cx1 = seed_value_to_double (ctx, arguments[3], exception); cy1 = seed_value_to_double (ctx, arguments[4], exception); r1 = seed_value_to_double (ctx, arguments[5], exception); return seed_object_from_cairo_pattern (ctx, cairo_pattern_create_radial (cx0, cy0, r0, cx1, cy1, r1)); }
static SeedValue seed_cairo_pdf_surface_set_size (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception) { cairo_surface_t *surf; gdouble x, y; CHECK_THIS(); if (argument_count != 2) { EXPECTED_EXCEPTION("set_size", "2 arguments"); } surf = seed_object_get_private (this_object); x = seed_value_to_double (ctx, arguments[0], exception); y = seed_value_to_double (ctx, arguments[1], exception); cairo_pdf_surface_set_size (surf, x, y); return seed_make_undefined (ctx); }