Class: OpenCV::Cv::Rect
- Inherits:
-
Object
- Object
- OpenCV::Cv::Rect
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/ruby/ropencv/ropencv_types.rb
Instance Attribute Summary collapse
- #__obj_ptr__ ⇒ Object readonly private
Class Method Summary collapse
-
.from_native(ptr, context) ⇒ Object
private
can be overwritten by the user.
- .new(*args) ⇒ Object
- .rbind_from_native(ptr, context) ⇒ Object private
- .rbind_to_native(obj, context) ⇒ Object private
-
.to_native(obj, context) ⇒ Object
private
can be overwritten by the user.
Instance Method Summary collapse
-
#__owner__? ⇒ Boolean
private
returns true if the underlying pointer is owner of the real object.
-
#area ⇒ Object
wrapper for int cv::Rect::area().
-
#br ⇒ Object
wrapper for cv::Point cv::Rect::br().
-
#contains(point) ⇒ Object
wrapper for bool cv::Rect::contains(const cv::Point point).
-
#height ⇒ Object
wrapper for int height.
-
#height=(value) ⇒ Object
wrapper for int height.
-
#initialize(ptr) ⇒ Rect
constructor
private
A new instance of Rect.
-
#size ⇒ Object
wrapper for cv::Size cv::Rect::size().
-
#tl ⇒ Object
wrapper for cv::Point cv::Rect::tl().
-
#width ⇒ Object
wrapper for int width.
-
#width=(value) ⇒ Object
wrapper for int width.
-
#x ⇒ Object
methods wrapper for int x.
-
#x=(value) ⇒ Object
wrapper for int x.
-
#y ⇒ Object
wrapper for int y.
-
#y=(value) ⇒ Object
wrapper for int y.
Constructor Details
#initialize(ptr) ⇒ Rect
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Rect.
3241 3242 3243 3244 3245 3246 3247 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3241 def initialize(ptr) @__obj_ptr__ = if ptr.is_a? RectStruct ptr else RectStruct.new(FFI::AutoPointer.new(ptr,RectStruct.method(:release))) end end |
Instance Attribute Details
#__obj_ptr__ ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3238 3239 3240 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3238 def __obj_ptr__ @__obj_ptr__ end |
Class Method Details
.from_native(ptr, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
can be overwritten by the user
3233 3234 3235 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3233 def self.from_native(ptr,context) rbind_from_native(ptr,context) end |
.new(*args) ⇒ Object
3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3164 def self.new(*args) if args.first.is_a?(FFI::Pointer) || args.first.is_a?(RectStruct) raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1 return super(args.first) end # wrapper for cv::Rect::Rect() @@cv_rect_rect_defaults0 ||= [] if(args.size >= 0 && args.size <= 0) args.size.upto(-1) do |i| args[i] = @@cv_rect_rect_defaults0[i] end begin return Rbind::cv_rect_rect(*args) rescue TypeError => e @error = e end end # wrapper for cv::Rect::Rect(const cv::Rect rect) @@cv_rect_rect2_defaults1 ||= [nil] if(args.size >= 1 && args.size <= 1) args.size.upto(0) do |i| args[i] = @@cv_rect_rect2_defaults1[i] end begin return Rbind::cv_rect_rect2(*args) rescue TypeError => e @error = e end end # wrapper for cv::Rect::Rect(int x, int y, int width, int height) @@cv_rect_rect3_defaults2 ||= [nil, nil, nil, nil] if(args.size >= 4 && args.size <= 4) args.size.upto(3) do |i| args[i] = @@cv_rect_rect3_defaults2[i] end begin return Rbind::cv_rect_rect3(*args) rescue TypeError => e @error = e end end raise ArgumentError, "no constructor for #{self}(#{args.inspect})" end |
.rbind_from_native(ptr, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3221 3222 3223 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3221 def self.rbind_from_native(ptr,context) Rect.new(ptr) end |
.rbind_to_native(obj, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
3212 3213 3214 3215 3216 3217 3218 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3212 def self.rbind_to_native(obj,context) if obj.is_a? Rect obj.__obj_ptr__ else raise TypeError, "expected kind of #{name}, was #{obj.class}" end end |
.to_native(obj, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
can be overwritten by the user
3227 3228 3229 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3227 def self.to_native(obj,context) rbind_to_native(obj,context) end |
Instance Method Details
#__owner__? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
returns true if the underlying pointer is owner of the real object
3252 3253 3254 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3252 def __owner__? @__obj_ptr__[:bowner] end |
#area ⇒ Object
wrapper for int cv::Rect::area()
3330 3331 3332 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3330 def area() Rbind::cv_rect_area( self) end |
#br ⇒ Object
wrapper for cv::Point cv::Rect::br()
3314 3315 3316 3317 3318 3319 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3314 def br() result = Rbind::cv_rect_br( self) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#contains(point) ⇒ Object
wrapper for bool cv::Rect::contains(const cv::Point point)
3335 3336 3337 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3335 def contains(point) Rbind::cv_rect_contains( self, point) end |
#height ⇒ Object
wrapper for int height
3296 3297 3298 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3296 def height() Rbind::cv_rect_get_height( self) end |
#height=(value) ⇒ Object
wrapper for int height
3301 3302 3303 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3301 def height=(value) Rbind::cv_rect_set_height( self, value) end |
#size ⇒ Object
wrapper for cv::Size cv::Rect::size()
3322 3323 3324 3325 3326 3327 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3322 def size() result = Rbind::cv_rect_size( self) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#tl ⇒ Object
wrapper for cv::Point cv::Rect::tl()
3306 3307 3308 3309 3310 3311 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3306 def tl() result = Rbind::cv_rect_tl( self) # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__? result end |
#width ⇒ Object
wrapper for int width
3286 3287 3288 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3286 def width() Rbind::cv_rect_get_width( self) end |
#width=(value) ⇒ Object
wrapper for int width
3291 3292 3293 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3291 def width=(value) Rbind::cv_rect_set_width( self, value) end |
#x ⇒ Object
methods wrapper for int x
3266 3267 3268 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3266 def x() Rbind::cv_rect_getx( self) end |
#x=(value) ⇒ Object
wrapper for int x
3271 3272 3273 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3271 def x=(value) Rbind::cv_rect_setx( self, value) end |
#y ⇒ Object
wrapper for int y
3276 3277 3278 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3276 def y() Rbind::cv_rect_gety( self) end |
#y=(value) ⇒ Object
wrapper for int y
3281 3282 3283 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 3281 def y=(value) Rbind::cv_rect_sety( self, value) end |