Sha256: 25253b57e7193c5503f042c5398549f8d1170825193d901092785987b33e7acf
Contents?: true
Size: 1.39 KB
Versions: 16
Compression:
Stored size: 1.39 KB
Contents
#include "reflex/ruby/filter.h" #include <rays/ruby/painter.h> #include <rays/ruby/image.h> #include "defs.h" RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Filter) #define THIS to<Reflex::Filter*>(self) #define CHECK RUCY_CHECK_OBJ(Reflex::Filter, self) #define CALL(fun) RUCY_CALL_SUPER(THIS, fun) static VALUE alloc(VALUE klass) { return value(new Reflex::RubyFilter<Reflex::Filter>, klass); } static VALUE initialize(VALUE self, VALUE arg) { CHECK; THIS->set_shader(to<Rays::Shader>(arg)); } static VALUE apply(VALUE self, VALUE painter, VALUE image) { CHECK; CALL(apply(to<Rays::Painter*>(painter), to<const Rays::Image&>(image))); } static VALUE set_shader(VALUE self, VALUE shader) { CHECK; THIS->set_shader(to<Rays::Shader>(shader)); } static VALUE get_shader(VALUE self) { CHECK; return value(THIS->shader()); } static Class cFilter; void Init_filter () { Module mReflex = rb_define_module("Reflex"); cFilter = rb_define_class_under(mReflex, "Filter", rb_cObject); rb_define_alloc_func(cFilter, alloc); rb_define_private_method(cFilter, "initialize", RUBY_METHOD_FUNC(initialize), 1); rb_define_method(cFilter, "apply", RUBY_METHOD_FUNC(apply), 2); rb_define_method(cFilter, "shader=", RUBY_METHOD_FUNC(set_shader), 1); rb_define_method(cFilter, "shader", RUBY_METHOD_FUNC(get_shader), 0); } namespace Reflex { Class filter_class () { return cFilter; } }// Reflex
Version data entries
16 entries across 16 versions & 1 rubygems