Class: Cairo::TeeSurface

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

Instance Method Summary collapse

Methods inherited from Surface

#clone, #content, #copy_page, #create_similar, #create_similar_image, #destroy, #device, #device_offset, #device_scale, #dup, #fallback_resolution, #finish, #flush, #font_options, #get_mime_data, gl_supported?, gl_texture_supported?, image_supported?, #map_to_image, #mark_dirty, pdf_supported?, ps_supported?, quartz_image_supported?, quartz_supported?, recording_supported?, script_supported?, #set_device_offset, #set_device_scale, #set_fallback_resolution, #set_mime_data, #show_page, #sub_rectangle_surface, supported?, #supported_mime_type?, svg_supported?, tee_supported?, #unmap_image, win32_printing_supported?, win32_supported?, #write_to_png, xml_supported?

Constructor Details

#initializeObject

tee surface functions



1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
# File 'ext/cairo/rb_cairo_surface.c', line 1629

static VALUE
cr_tee_surface_initialize (VALUE self, VALUE master)
{
  cairo_surface_t *surface = NULL;

  surface = cairo_tee_surface_create (RVAL2CRSURFACE (master));
  rb_cairo_surface_check_status (surface);
  DATA_PTR (self) = surface;
  rb_iv_set (self, "surfaces", rb_ary_new3 (1, master));
  if (rb_block_given_p ())
    rb_cairo__surface_yield_and_finish (self);
  return Qnil;
}

Instance Method Details

#<<Object



1655
1656
1657
1658
1659
1660
# File 'ext/cairo/rb_cairo_surface.c', line 1655

static VALUE
cr_tee_surface_shift_operator (VALUE self, VALUE target)
{
  cr_tee_surface_add (self, target);
  return self;
}

#[]Object



1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
# File 'ext/cairo/rb_cairo_surface.c', line 1706

static VALUE
cr_tee_surface_array_reference (VALUE self, VALUE index)
{
  cairo_surface_t *surface = NULL, *target;

  surface = _SELF;
  index = rb_Integer (index);
  target = cairo_tee_surface_index (surface, NUM2UINT (index));
  rb_cairo_surface_check_status (surface);
  rb_cairo_surface_check_status (target);
  return CRSURFACE2RVAL (target);
}

#addObject



1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
# File 'ext/cairo/rb_cairo_surface.c', line 1643

static VALUE
cr_tee_surface_add (VALUE self, VALUE target)
{
  cairo_surface_t *surface = NULL;

  surface = _SELF;
  cairo_tee_surface_add (surface, RVAL2CRSURFACE (target));
  rb_cairo_surface_check_status (surface);
  rb_ary_push (rb_iv_get (self, "surfaces"), target);
  return Qnil;
}

#removeObject



1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
# File 'ext/cairo/rb_cairo_surface.c', line 1662

static VALUE
cr_tee_surface_remove (VALUE self, VALUE target_or_index)
{
  cairo_surface_t *surface = NULL, *target;
  VALUE rb_surfaces;
  int i;

  surface = _SELF;
  if (rb_cairo__is_kind_of (target_or_index, rb_cCairo_Surface))
    {
      target = RVAL2CRSURFACE (target_or_index);
    }
  else
    {
      VALUE index;

      index = rb_check_to_integer (target_or_index, "to_int");
      if (NIL_P (index))
        rb_raise (rb_eArgError,
                  "invalid argument (expect (surface) or (index)): %s",
                  rb_cairo__inspect (target_or_index));
      target = cairo_tee_surface_index (surface, NUM2INT (index));
    }
  cairo_tee_surface_remove (surface, target);
  rb_cairo_surface_check_status (surface);

  rb_surfaces = rb_iv_get (self, "surfaces");
  for (i = 0; i < RARRAY_LEN (rb_surfaces); i++)
    {
      VALUE rb_marked_surface;
      cairo_surface_t *marked_surface;

      rb_marked_surface = RARRAY_PTR (rb_surfaces)[i];
      marked_surface = RVAL2CRSURFACE (rb_marked_surface);
      if (marked_surface == target)
        {
          rb_ary_delete (rb_surfaces, rb_marked_surface);
          break;
        }
    }

  return Qnil;
}