class Cairo::GLSurface
GL surface
Public Class Methods
new(p1)
click to toggle source
GL surface functions
static VALUE
cr_gl_surface_initialize (int argc, VALUE *argv, VALUE self)
{
cairo_surface_t *surface;
cairo_device_t *device;
int width, height;
cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA;
VALUE rb_device, rb_width, rb_height, rb_content;
rb_scan_args (argc, argv, "31",
&rb_device, &rb_width, &rb_height, &rb_content);
device = RVAL2CRDEVICE (rb_device);
width = NUM2INT (rb_width);
height = NUM2INT (rb_height);
switch (TYPE (rb_content))
{
case T_NIL:
break;
case T_STRING:
case T_SYMBOL:
case T_FIXNUM:
content = RVAL2CRCONTENT (rb_content);
break;
default:
rb_raise (rb_eArgError,
"invalid argument (expect "
"(device, width, height) or "
"(device, width, height, content)): %s",
rb_cairo__inspect (rb_ary_new4 (argc, argv)));
break;
}
surface = cairo_gl_surface_create (device, content, width, height);
rb_cairo_surface_check_status (surface);
RTYPEDDATA_DATA (self) = surface;
if (rb_block_given_p ())
rb_cairo__surface_yield_and_finish (self);
return Qnil;
}
Public Instance Methods
height()
click to toggle source
static VALUE
cr_gl_surface_get_height (VALUE self)
{
return INT2NUM (cairo_gl_surface_get_height (_SELF));
}
set_size(p1, p2)
click to toggle source
static VALUE
cr_gl_surface_set_size (VALUE self, VALUE width, VALUE height)
{
cairo_surface_t *surface = NULL;
surface = _SELF;
cairo_gl_surface_set_size (surface, NUM2INT (width), NUM2INT (height));
rb_cairo_surface_check_status (surface);
return Qnil;
}
swap_buffers()
click to toggle source
static VALUE
cr_gl_surface_swap_buffers (VALUE self)
{
cairo_surface_t *surface = NULL;
surface = _SELF;
cairo_gl_surface_swapbuffers (surface);
rb_cairo_surface_check_status (surface);
return Qnil;
}
width()
click to toggle source
static VALUE
cr_gl_surface_get_width (VALUE self)
{
return INT2NUM (cairo_gl_surface_get_width (_SELF));
}