Class: OpenCV::CvFont
- Inherits:
-
Object
- Object
- OpenCV::CvFont
- Defined in:
- ext/opencv/cvfont.cpp,
ext/opencv/cvfont.cpp
Overview
Font structure that can be passed to text rendering functions. see CvMat#put_text, CvMat#put_text!
Constant Summary collapse
- FACE =
face
- FONT_OPTION =
default_option
Instance Method Summary collapse
-
#face ⇒ Fixnum
Returns font face.
-
#hscale ⇒ Number
Returns hscale.
-
#new(face, font_option = nil) ⇒ Object
constructor
Create font object.
-
#italic ⇒ Boolean
Returns italic or not.
-
#line_type ⇒ Fixnum
Returns line type.
-
#shear ⇒ Number
Returns shear.
-
#thickness ⇒ Fixnum
Returns thickness.
-
#vscale ⇒ Number
Returns vscale.
Constructor Details
#new(face, font_option = nil) ⇒ Object
Create font object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'ext/opencv/cvfont.cpp', line 76
VALUE
rb_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE face, font_option;
rb_scan_args(argc, argv, "11", &face, &font_option);
Check_Type(face, T_SYMBOL);
face = rb_hash_lookup(rb_const_get(cCvFont::rb_class(), rb_intern("FACE")), face);
if (NIL_P(face)) {
rb_raise(rb_eArgError, "undefined face.");
}
font_option = FONT_OPTION(font_option);
int font_face = NUM2INT(face);
if (FO_ITALIC(font_option)) {
font_face |= CV_FONT_ITALIC;
}
try {
cvInitFont(CVFONT(self),
font_face,
FO_HSCALE(font_option),
FO_VSCALE(font_option),
FO_SHEAR(font_option),
FO_THICKNESS(font_option),
FO_LINE_TYPE(font_option));
}
catch (cv::Exception& e) {
raise_cverror(e);
}
return self;
}
|
Instance Method Details
#face ⇒ Fixnum
Returns font face
113 114 115 116 117 |
# File 'ext/opencv/cvfont.cpp', line 113
VALUE
rb_face(VALUE self)
{
return INT2FIX(CVFONT(self)->font_face);
}
|
#hscale ⇒ Number
Returns hscale
124 125 126 127 128 |
# File 'ext/opencv/cvfont.cpp', line 124
VALUE
rb_hscale(VALUE self)
{
return rb_float_new(CVFONT(self)->hscale);
}
|
#italic ⇒ Boolean
Returns italic or not
179 180 181 182 183 |
# File 'ext/opencv/cvfont.cpp', line 179
VALUE
rb_italic(VALUE self)
{
return ((CVFONT(self)->font_face & CV_FONT_ITALIC) > 0) ? Qtrue : Qfalse;
}
|
#line_type ⇒ Fixnum
Returns line type
168 169 170 171 172 |
# File 'ext/opencv/cvfont.cpp', line 168
VALUE
rb_line_type(VALUE self)
{
return INT2FIX(CVFONT(self)->line_type);
}
|
#shear ⇒ Number
Returns shear
146 147 148 149 150 |
# File 'ext/opencv/cvfont.cpp', line 146
VALUE
rb_shear(VALUE self)
{
return rb_float_new(CVFONT(self)->shear);
}
|
#thickness ⇒ Fixnum
Returns thickness
157 158 159 160 161 |
# File 'ext/opencv/cvfont.cpp', line 157
VALUE
rb_thickness(VALUE self)
{
return INT2FIX(CVFONT(self)->thickness);
}
|
#vscale ⇒ Number
Returns vscale
135 136 137 138 139 |
# File 'ext/opencv/cvfont.cpp', line 135
VALUE
rb_vscale(VALUE self)
{
return rb_float_new(CVFONT(self)->vscale);
}
|