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

Version Path
reflexion-0.2.1 .doc/ext/reflex/filter.cpp
reflexion-0.2 .doc/ext/reflex/filter.cpp
reflexion-0.1.57 .doc/ext/reflex/filter.cpp
reflexion-0.1.56 .doc/ext/reflex/filter.cpp
reflexion-0.1.55 .doc/ext/reflex/filter.cpp
reflexion-0.1.54 .doc/ext/reflex/filter.cpp
reflexion-0.1.53 .doc/ext/reflex/filter.cpp
reflexion-0.1.52 .doc/ext/reflex/filter.cpp
reflexion-0.1.51 .doc/ext/reflex/filter.cpp
reflexion-0.1.50 .doc/ext/reflex/filter.cpp
reflexion-0.1.49 .doc/ext/reflex/filter.cpp
reflexion-0.1.48 .doc/ext/reflex/filter.cpp
reflexion-0.1.47 .doc/ext/reflex/filter.cpp
reflexion-0.1.46 .doc/ext/reflex/filter.cpp
reflexion-0.1.45 .doc/ext/reflex/filter.cpp
reflexion-0.1.44 .doc/ext/reflex/filter.cpp
reflexion-0.1.43 .doc/ext/reflex/filter.cpp
reflexion-0.1.42 .doc/ext/reflex/filter.cpp
reflexion-0.1.41 .doc/ext/reflex/filter.cpp
reflexion-0.1.40 .doc/ext/reflex/filter.cpp