Class: OpenCV::GUI::Trackbar
- Inherits:
-
Object
- Object
- OpenCV::GUI::Trackbar
- Defined in:
- ext/opencv/trackbar.cpp,
ext/opencv/trackbar.cpp
Overview
Simple Trackbar wedget. OpenCV::GUI::Window can treat trackbar. Trackbar can treat only positive-integer value.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Object
constructor
Create new Trackbar.
-
#max ⇒ Object
Return the maximum value that can be taken this trackbar.
-
#name ⇒ Object
Return trackbar name.
-
#value ⇒ Object
Return the value of this trackbar.
-
#value=(val) ⇒ Object
Set trackbar value.
Constructor Details
#new(name, maxval[,val], &block) ⇒ Object #new(name, maxval[,val]) {|value| ... } ⇒ Object
Create new Trackbar. name should be String. maxval and val should be Integer. When Trackbar adjuster changed, block will be called.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'ext/opencv/trackbar.cpp', line 53
VALUE rb_initialize(int argc, VALUE *argv, VALUE self) {
VALUE name, maxval, val, block;
rb_scan_args(argc, argv, "21&", &name, &maxval, &val, &block);
if (NIL_P(block))
rb_raise(rb_eArgError, "block not given.");
Check_Type(name, T_STRING);
Trackbar *trackbar = TRACKBAR(self);
trackbar->name = strcpy(ALLOC_N(char, RSTRING_LEN(name) + 1), StringValueCStr(name));
trackbar->maxval = NUM2INT(maxval);
trackbar->val = IF_INT(val, 0);
trackbar->block = block;
return self;
}
|
Instance Method Details
#max ⇒ Object
Return the maximum value that can be taken this trackbar.
77 78 79 |
# File 'ext/opencv/trackbar.cpp', line 77
VALUE rb_max(VALUE self) {
return INT2NUM(TRACKBAR(self)->maxval);
}
|
#name ⇒ Object
Return trackbar name.
70 71 72 |
# File 'ext/opencv/trackbar.cpp', line 70
VALUE rb_name(VALUE self) {
return rb_str_new2(TRACKBAR(self)->name);
}
|
#value ⇒ Object
Return the value of this trackbar.
84 85 86 |
# File 'ext/opencv/trackbar.cpp', line 84
VALUE rb_value(VALUE self) {
return INT2NUM(TRACKBAR(self)->val);
}
|
#value=(val) ⇒ Object
Set trackbar value.
94 95 96 97 |
# File 'ext/opencv/trackbar.cpp', line 94
VALUE rb_set_value(VALUE self, VALUE val) {
TRACKBAR(self)->val = NUM2INT(val);
return self;
}
|