Sha256: 372493496f1de9b5a407fac68d6e2f52f7e4d600402939727fc59f5fba2db537

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

#include "reflex/ruby/image_view.h"


#include <rays/ruby/point.h>
#include "reflex/ruby/view.h"
#include "defs.h"


RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ImageView)

#define THIS      to<Reflex::ImageView*>(self)

#define CHECK     RUCY_CHECK_OBJECT(Reflex::ImageView, self)

#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::ImageView, THIS, fun)


static
VALUE alloc(VALUE klass)
{
	return value(new Reflex::RubyView<Reflex::ImageView>, klass);
}

static
VALUE get_image(VALUE self)
{
	CHECK;
	Rays::Image image = THIS->get_image();
	return image ? value(image) : nil();
}

static
VALUE set_image(VALUE self, VALUE image)
{
	CHECK;
	THIS->set_image(image ? to<Rays::Image&>(image) : Rays::Image());
	return image;
}


static Class cImageView;

void
Init_reflex_image_view ()
{
	Module mReflex = rb_define_module("Reflex");

	cImageView = mReflex.define_class("ImageView", Reflex::view_class());
	rb_define_alloc_func(cImageView, alloc);
	rb_define_private_method(cImageView, "set_image", RUBY_METHOD_FUNC(set_image), 1);
	rb_define_method(cImageView, "image", RUBY_METHOD_FUNC(get_image), 0);
}


namespace Reflex
{


	Class
	image_view_class ()
	{
		return cImageView;
	}


}// Reflex

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reflexion-0.3.3 .doc/ext/reflex/image_view.cpp
reflexion-0.3.2 .doc/ext/reflex/image_view.cpp
reflexion-0.3.1 .doc/ext/reflex/image_view.cpp
reflexion-0.3 .doc/ext/reflex/image_view.cpp