Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Try to treat as filename first.
- if (rb_respond_to(val, rb_intern("to_str")))
- {
- const char* filename = STR2CSTR(rb_funcall(val, rb_intern("to_str"), 0));
- return quickLoadBitmap(Gosu::utf8ToWstring(filename));
- }
- // Otherwise, try to call .to_blob on it.
- // (Works with RMagick).
- VALUE conversion = rb_str_new2("to_blob { self.format = 'RGBA'; self.depth = 8 }");
- VALUE blob = rb_obj_instance_eval(1, &conversion, val);
- Check_SafeStr(blob);
- unsigned width = NUM2UINT(rb_funcall(val, rb_intern("columns"), 0));
- unsigned height = NUM2UINT(rb_funcall(val, rb_intern("rows"), 0));
Add Comment
Please, Sign In to add comment