static VALUE cr_mask(VALUE self, VALUE pattern) { cairo_mask (_SELF, RVAL2CRPATTERN (pattern)); cr_check_status (_SELF); return self; }
static VALUE cr_get_source (VALUE self) { VALUE rb_source = Qnil; cairo_pattern_t *source; source = cairo_get_source (_SELF); if (source) { rb_cairo_check_status (cairo_pattern_status (source)); rb_source = rb_ivar_get (self, cr_id_source); if (NIL_P (rb_source) || RVAL2CRPATTERN (rb_source) != source) { rb_source = CRPATTERN2RVAL (source); rb_ivar_set (self, cr_id_source, rb_source); } } else { rb_source = Qnil; rb_ivar_set (self, cr_id_source, rb_source); } return rb_source; }
static VALUE cr_set_source (VALUE self, VALUE pattern) { cairo_set_source (_SELF, RVAL2CRPATTERN (pattern)); cr_check_status (_SELF); rb_ivar_set (self, cr_id_source, pattern); return self; }
/* TODO: make it more generic, with maybe some part in Ruby */ static VALUE rb_goo_canvas_style_set_fill_pattern(VALUE self, VALUE value) { GValue gval = {0,}; cairo_pattern_t *pattern; g_value_init(&gval, GOO_TYPE_CAIRO_PATTERN); pattern = RVAL2CRPATTERN(value); g_value_take_boxed(&gval, pattern); goo_canvas_style_set_property(RVAL2GCS(self), goo_canvas_style_fill_pattern_id, &gval); g_value_unset(&gval); G_CHILD_SET(self, rb_intern("fill_pattern"), value); return self; }