1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

add some documents

This commit is contained in:
ser1zw 2016-04-03 06:45:17 +09:00
parent 9d2ce6618e
commit 1c2bedc152
5 changed files with 194 additions and 2 deletions

View file

@ -44,6 +44,16 @@ namespace rubyopencv {
return TypedData_Wrap_Struct(klass, &opencv_rect_type, ptr);
}
/*
* Create a rectangle
*
* @overload new(x = 0, y = 0, width = 0, height = 0)
* @param x [Integer] x coordinate
* @param y [Integer] y coordinate
* @param width [Integer] Width
* @param height [Integer] Height
* @return [Rect] new rectangle
*/
VALUE rb_initialize(int argc, VALUE *argv, VALUE self) {
const int SIZE = 4;
VALUE values[SIZE];
@ -100,19 +110,45 @@ namespace rubyopencv {
return self;
}
/*
* Return width
*
* @overload width
* @return [Integer] Width
*/
VALUE rb_width(VALUE self) {
return INT2NUM(obj2rect(self)->width);
}
/*
* Set width
*
* @overload width=(value)
* @param value [Integer] Width
* @return [Rect] +self+
*/
VALUE rb_set_width(VALUE self, VALUE width) {
obj2rect(self)->width = NUM2INT(width);
return self;
}
/*
* Return height
*
* @overload height
* @return [Integer] Height
*/
VALUE rb_height(VALUE self) {
return INT2NUM(obj2rect(self)->height);
}
/*
* Set height
*
* @overload height=(value)
* @param value [Integer] Height
* @return [Rect] +self+
*/
VALUE rb_set_height(VALUE self, VALUE height) {
obj2rect(self)->height = NUM2INT(height);
return self;