+static VALUE doc_prepare(VALUE cls, VALUE device)
+{
+ Get_Doc(doc,cls);
+
+ gfxdevice_t dev;
+ device_internal_t i;
+ i.v = device;
+ i.doc = doc;
+
+ dev.internal = &i;
+ dev.setparameter = rb_setparameter;
+ dev.startpage = rb_startpage;
+ dev.startclip = rb_startclip;
+ dev.endclip = rb_endclip;
+ dev.stroke = rb_stroke;
+ dev.fill = rb_fill;
+ dev.fillbitmap = rb_fillbitmap;
+ dev.fillgradient = rb_fillgradient;
+ dev.addfont = rb_addfont;
+ dev.drawchar = rb_drawchar;
+ dev.drawlink = rb_drawlink;
+ dev.endpage = rb_endpage;
+ dev.finish = rb_finish;
+
+ doc->doc->prepare(doc->doc, &dev);
+ return cls;
+}
+
+