Class: QRTools::UI::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/qrtools/ui/window.rb,
ext/qrtools/qrtools_ui_window.c

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Window

Create a new window with name



6
7
8
9
10
11
12
13
# File 'lib/qrtools/ui/window.rb', line 6

def initialize name
  @name = name
  if block_given?
    show
    yield self
    hide
  end
end

Instance Method Details

#display(image) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'ext/qrtools/qrtools_ui_window.c', line 17

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;
}

#hideObject



10
11
12
13
14
15
# File 'ext/qrtools/qrtools_ui_window.c', line 10

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

#showObject



3
4
5
6
7
8
# File 'ext/qrtools/qrtools_ui_window.c', line 3

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