2008-08-19 11:01:28 -04:00
|
|
|
/************************************************************
|
|
|
|
|
|
|
|
cvfont.h -
|
|
|
|
|
|
|
|
$Author: lsxi $
|
|
|
|
|
|
|
|
Copyright (C) 2005-2006 Masakazu Yonekura
|
|
|
|
|
|
|
|
************************************************************/
|
|
|
|
#ifndef RUBY_OPENCV_CVFONT_H
|
|
|
|
#define RUBY_OPENCV_CVFONT_H
|
|
|
|
|
|
|
|
#include "opencv.h"
|
|
|
|
|
|
|
|
#define __NAMESPACE_BEGIN_CVFONT namespace cCvFont{
|
|
|
|
#define __NAMESPACE_END_CVFONT }
|
|
|
|
|
|
|
|
__NAMESPACE_BEGIN_OPENCV
|
|
|
|
__NAMESPACE_BEGIN_CVFONT
|
|
|
|
|
|
|
|
#define FONT_OPTION(op) NIL_P(op) ? rb_const_get(rb_class(), rb_intern("FONT_OPTION")) : rb_funcall(rb_const_get(rb_class(), rb_intern("FONT_OPTION")), rb_intern("merge"), 1, font_option)
|
2011-01-10 13:17:38 -05:00
|
|
|
#define FO_ITALIC(op) ({VALUE _italic = rb_hash_aref(op, ID2SYM(rb_intern("italic"))); NIL_P(_italic) ? 0 : _italic == Qfalse ? 0 : CV_FONT_ITALIC;})
|
2008-08-19 11:01:28 -04:00
|
|
|
#define FO_HSCALE(op) NUM2DBL(rb_hash_aref(op, ID2SYM(rb_intern("hscale"))))
|
|
|
|
#define FO_VSCALE(op) NUM2DBL(rb_hash_aref(op, ID2SYM(rb_intern("vscale"))))
|
|
|
|
#define FO_SHEAR(op) NUM2DBL(rb_hash_aref(op, ID2SYM(rb_intern("shear"))))
|
|
|
|
#define FO_THICKNESS(op) FIX2INT(rb_hash_aref(op, ID2SYM(rb_intern("thickness"))))
|
2011-04-17 12:08:47 -04:00
|
|
|
#define FO_LINE_TYPE(op) FIX2INT(rb_hash_aref(op, ID2SYM(rb_intern("line_type"))))
|
2008-08-19 11:01:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
VALUE rb_class();
|
|
|
|
|
|
|
|
void define_ruby_class();
|
|
|
|
|
|
|
|
VALUE rb_allocate(VALUE klass);
|
|
|
|
VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
|
|
|
|
|
|
|
|
VALUE rb_face(VALUE self);
|
|
|
|
VALUE rb_hscale(VALUE self);
|
|
|
|
VALUE rb_vscale(VALUE self);
|
|
|
|
VALUE rb_shear(VALUE self);
|
|
|
|
VALUE rb_thickness(VALUE self);
|
|
|
|
VALUE rb_line_type(VALUE self);
|
2011-01-10 13:17:38 -05:00
|
|
|
VALUE rb_italic(VALUE self);
|
2008-08-19 11:01:28 -04:00
|
|
|
|
|
|
|
__NAMESPACE_END_CVFONT
|
|
|
|
|
|
|
|
inline CvFont*
|
|
|
|
CVFONT(VALUE object)
|
|
|
|
{
|
|
|
|
CvFont *ptr;
|
|
|
|
Data_Get_Struct(object, CvFont, ptr);
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2011-07-03 04:19:39 -04:00
|
|
|
inline CvFont*
|
|
|
|
CVFONT_WITH_CHECK(VALUE object)
|
|
|
|
{
|
|
|
|
if (!rb_obj_is_kind_of(object, cCvFont::rb_class()))
|
|
|
|
raise_typeerror(object, cCvFont::rb_class());
|
|
|
|
return CVFONT(object);
|
|
|
|
}
|
|
|
|
|
2008-08-19 11:01:28 -04:00
|
|
|
__NAMESPACE_END_OPENCV
|
|
|
|
|
|
|
|
#endif // RUBY_OPENCV_CVFONT_H
|