class Cairo::Device - cairo-1.12.9 Documentation

# class Cairo::Device

### Public Class Methods

new(*args) click to toggle source

    static VALUE
    cr_device_initialize (int argc, VALUE *argv, VALUE self)
    {
      rb_raise(rb_eNotImpError,
               "%s class creation isn't supported on this cairo installation",
               rb_obj_classname(self));

      return Qnil;
    }

script_supported?() click to toggle source

    static VALUE
    cr_device_script_supported_p (VALUE klass)
    {
    #ifdef CAIRO_HAS_SCRIPT_SURFACE
      return Qtrue;
    #else
      return Qfalse;
    #endif
    }

xml_supported?() click to toggle source

    static VALUE
    cr_device_xml_supported_p (VALUE klass)
    {
    #ifdef CAIRO_HAS_XML_SURFACE
      return Qtrue;
    #else
      return Qfalse;
    #endif
    }

### Public Instance Methods

acquire() click to toggle source

    static VALUE
    cr_device_acquire (VALUE self)
    {
      cairo_device_acquire (_SELF);
      cr_device_check_status (_SELF);
      if (rb_block_given_p ())
        return rb_ensure (rb_yield, self, cr_device_release, self);
      else
        return self;
    }

destroy() click to toggle source

Backend device manipulation

    static VALUE
    cr_device_destroy (VALUE self)
    {
      cairo_device_t *device;

      device = _SELF;
      cairo_device_destroy (device);
      DATA_PTR (self) = NULL;

      return self;
    }

finish() click to toggle source

    static VALUE
    cr_device_finish (VALUE self)
    {
      cairo_device_t *device;
      rb_cairo__io_callback_closure_t *closure;

      device = _SELF;
      closure = cairo_device_get_user_data (device, &cr_closure_key);

      cairo_device_finish (device);
      cairo_device_set_user_data (device, &cr_finished_key, (void *)CR_TRUE, NULL);
      cairo_device_set_user_data (device, &cr_object_holder_key, NULL, NULL);

      if (closure && !NIL_P (closure->error))
        rb_exc_raise (closure->error);
      cr_device_check_status (device);

      return self;
    }

flush() click to toggle source

    static VALUE
    cr_device_flush (VALUE self)
    {
      cairo_device_flush (_SELF);
      cr_device_check_status (_SELF);
      return self;
    }

release() click to toggle source

    static VALUE
    cr_device_release (VALUE self)
    {
      cairo_device_release (_SELF);
      cr_device_check_status (_SELF);
      return self;
    }

supported?(type) click to toggle source

    # File lib/cairo/device.rb, line 5
    def supported?(type)
      supported_predicate = "#{type.to_s.downcase}_supported?"
      return false unless respond_to?(supported_predicate)
      send(supported_predicate)
    end