Sha256: fb2e72cf76e66e2d26f57bc4606bc4bd9c8bb9d41c089fbc8184eaba9d89ac44

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

#include <qrtools_ui_window.h>

static VALUE show(VALUE self)
{
  VALUE name = rb_iv_get(self, "@name");
  cvNamedWindow(StringValuePtr(name), 1);
  return self;
}

static VALUE hide(VALUE self)
{
  VALUE name = rb_iv_get(self, "@name");
  cvDestroyWindow(StringValuePtr(name));
  return self;
}

static VALUE display(VALUE self, VALUE image)
{
  VALUE name = rb_iv_get(self, "@name");

  IplImage * src;
  Data_Get_Struct(image, IplImage, src);
  cvShowImage(StringValuePtr(name), src);
  return self;
}

VALUE cQRToolsUIWindow;

void init_qrtools_ui_window()
{
  VALUE qrtools = rb_define_module("QRTools");
  VALUE ui      = rb_define_module_under(qrtools, "UI");
  VALUE klass   = rb_define_class_under(ui, "Window", rb_cObject);

  cQRToolsUIWindow = klass;

  rb_define_method(klass, "show", show, 0);
  rb_define_method(klass, "hide", hide, 0);
  rb_define_method(klass, "display", display, 1);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qrtools-1.0.0 ext/qrtools/qrtools_ui_window.c
qrtools-1.0.1 ext/qrtools/qrtools_ui_window.c