Class: Cairo::GLTextureSurface

Inherits:
GLSurface show all
Defined in:
ext/cairo/rb_cairo_surface.c

Instance Method Summary collapse

Methods inherited from GLSurface

#height, #set_size, #swap_buffers, #width

Methods inherited from Surface

#clone, #content, #copy_page, #create_similar, #destroy, #device, #device_offset, #dup, #fallback_resolution, #finish, #flush, #font_options, #get_mime_data, #mark_dirty, #set_device_offset, #set_fallback_resolution, #set_mime_data, #show_page, #sub_rectangle_surface, #write_to_png

Constructor Details

#initializeObject



1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
# File 'ext/cairo/rb_cairo_surface.c', line 1510

static VALUE
cr_gl_texture_surface_initialize (int argc, VALUE *argv, VALUE self)
{
  cairo_surface_t *surface;
  cairo_device_t *device;
  unsigned int texture;
  int width, height;
  cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA;
  VALUE rb_device, rb_texture, rb_width, rb_height, rb_content;

  rb_scan_args (argc, argv, "41",
                &rb_device, &rb_texture, &rb_width, &rb_height, &rb_content);

  device = RVAL2CRDEVICE (rb_device);
  texture = NUM2UINT (rb_texture);
  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, texture, width, height) or "
                "(device, texture, width, height, content)): %s",
                rb_cairo__inspect (rb_ary_new4 (argc, argv)));
      break;
    }

  surface = cairo_gl_surface_create_for_texture (device, content,
                                                 texture,
                                                 width,
                                                 height);

  cr_surface_check_status (surface);
  DATA_PTR (self) = surface;
  if (rb_block_given_p ())
    yield_and_finish (self);
  return Qnil;
}