2008-08-19 11:01:28 -04:00
|
|
|
/************************************************************
|
|
|
|
|
|
|
|
cvpoint.h -
|
|
|
|
|
|
|
|
$Author: lsxi $
|
|
|
|
|
|
|
|
Copyright (C) 2005-2006 Masakazu Yonekura
|
|
|
|
|
|
|
|
************************************************************/
|
|
|
|
#ifndef RUBY_OPENCV_CVPOINT_H
|
|
|
|
#define RUBY_OPENCV_CVPOINT_H
|
|
|
|
|
|
|
|
#include "opencv.h"
|
|
|
|
|
2011-08-11 14:04:22 -04:00
|
|
|
#define __NAMESPACE_BEGIN_CVPOINT namespace cCvPoint {
|
2008-08-19 11:01:28 -04:00
|
|
|
#define __NAMESPACE_END_CVPOINT }
|
|
|
|
|
|
|
|
__NAMESPACE_BEGIN_OPENCV
|
|
|
|
__NAMESPACE_BEGIN_CVPOINT
|
|
|
|
|
|
|
|
VALUE rb_class();
|
|
|
|
|
|
|
|
void define_ruby_class();
|
|
|
|
|
|
|
|
VALUE rb_compatible_q(VALUE klass, VALUE object);
|
|
|
|
|
|
|
|
VALUE rb_allocate(VALUE klass);
|
|
|
|
VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
|
|
|
|
VALUE rb_x(VALUE self);
|
|
|
|
VALUE rb_set_x(VALUE self, VALUE x);
|
|
|
|
VALUE rb_y(VALUE self);
|
|
|
|
VALUE rb_set_y(VALUE self, VALUE y);
|
|
|
|
|
|
|
|
VALUE rb_to_s(VALUE self);
|
|
|
|
VALUE rb_to_ary(VALUE self);
|
|
|
|
|
|
|
|
VALUE new_object();
|
|
|
|
VALUE new_object(CvPoint point);
|
|
|
|
|
|
|
|
__NAMESPACE_END_CVPOINT
|
|
|
|
|
2011-07-21 11:47:54 -04:00
|
|
|
inline CvPoint*
|
|
|
|
CVPOINT(VALUE object){
|
2008-08-19 11:01:28 -04:00
|
|
|
CvPoint *ptr;
|
|
|
|
Data_Get_Struct(object, CvPoint, ptr);
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2011-07-21 11:47:54 -04:00
|
|
|
inline CvPoint
|
2011-12-27 09:47:08 -05:00
|
|
|
VALUE_TO_CVPOINT(VALUE object)
|
|
|
|
{
|
2011-07-03 01:16:38 -04:00
|
|
|
if (cCvPoint::rb_compatible_q(cCvPoint::rb_class(), object)) {
|
2008-08-19 11:01:28 -04:00
|
|
|
return cvPoint(NUM2INT(rb_funcall(object, rb_intern("x"), 0)),
|
|
|
|
NUM2INT(rb_funcall(object, rb_intern("y"), 0)));
|
2011-07-03 01:16:38 -04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
raise_compatible_typeerror(object, cCvPoint::rb_class());
|
2008-08-19 11:01:28 -04:00
|
|
|
}
|
2011-12-27 09:47:08 -05:00
|
|
|
throw "Should never reach here";
|
2008-08-19 11:01:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
__NAMESPACE_END_OPENCV
|
|
|
|
|
|
|
|
#endif // RUBY_OPENCV_CVPOINT_H
|