Sha256: 886d67a69a9ac644f3d5917921f7367474a0626f1e0e636aef789c2018498fe4
Contents?: true
Size: 1.4 KB
Versions: 30
Compression:
Stored size: 1.4 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_reflex_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
30 entries across 30 versions & 1 rubygems