Class: OpenCV::Cv::Rect
- Inherits:
-
Object
- Object
- OpenCV::Cv::Rect
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/ropencv/ropencv_types.rb
Class Method Summary collapse
- .new(*args) ⇒ Object
-
.null ⇒ Object
returns a null pointer to the object.
Instance Method Summary collapse
- #area ⇒ Fixnum
- #br ⇒ Cv::Point
- #contains(point) ⇒ Bool
- #height ⇒ Fixnum (also: #get_height)
- #height=(value) ⇒ Void (also: #set_height)
- #size ⇒ Cv::Size
- #tl ⇒ Cv::Point
-
#to_s ⇒ Object
converts Rect into a string by crawling through all its attributes.
- #width ⇒ Fixnum (also: #get_width)
- #width=(value) ⇒ Void (also: #set_width)
-
#x ⇒ Fixnum
(also: #get_x)
methods.
- #x=(value) ⇒ Void (also: #set_x)
- #y ⇒ Fixnum (also: #get_y)
- #y=(value) ⇒ Void (also: #set_y)
Class Method Details
.rect ⇒ Object .rect(rect) ⇒ Object .rect(x, y, width, height) ⇒ Object
8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 |
# File 'lib/ropencv/ropencv_types.rb', line 8842 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 # overloaded method wrapper for cv::Rect::Rect() @@cv_rect_rect_defaults0 ||= [] if(args.size >= 0 && args.size <= 0) targs = args.clone targs.size.upto(-1) do |i| targs[i] = @@cv_rect_rect_defaults0[i] end begin return Rbind::cv_rect_rect(*targs) rescue TypeError => e @error = e end end # overloaded method wrapper for cv::Rect::Rect(const cv::Rect rect) @@cv_rect_rect2_defaults1 ||= [nil] if(args.size >= 1 && args.size <= 1) targs = args.clone targs.size.upto(0) do |i| targs[i] = @@cv_rect_rect2_defaults1[i] end begin return Rbind::cv_rect_rect2(*targs) rescue TypeError => e @error = e end end # overloaded method 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) targs = args.clone targs.size.upto(3) do |i| targs[i] = @@cv_rect_rect3_defaults2[i] end begin return Rbind::cv_rect_rect3(*targs) rescue TypeError => e @error = e end end raise ArgumentError, "no constructor for #{self}(#{args.inspect})" end |
.null ⇒ Object
returns a null pointer to the object
8828 8829 8830 |
# File 'lib/ropencv/ropencv_types.rb', line 8828 def self.null new(RectStruct.new) end |
Instance Method Details
#area ⇒ Fixnum
Note:
method wrapper for int cv::Rect::area()
9071 9072 9073 9074 |
# File 'lib/ropencv/ropencv_types.rb', line 9071 def area() __validate_pointer__ Rbind::cv_rect_area( self) end |
#br ⇒ Cv::Point
Note:
method wrapper for cv::Point cv::Rect::br()
9047 9048 9049 9050 9051 9052 9053 9054 9055 |
# File 'lib/ropencv/ropencv_types.rb', line 9047 def br() __validate_pointer__ result = Rbind::cv_rect_br( self) if result.respond_to?(:__owner__?) && !result.__owner__? # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) end result end |
#contains(point) ⇒ Bool
Note:
method wrapper for bool cv::Rect::contains(const cv::Point point)
9079 9080 9081 9082 |
# File 'lib/ropencv/ropencv_types.rb', line 9079 def contains(point) __validate_pointer__ Rbind::cv_rect_contains( self, point) end |
#height ⇒ Fixnum Also known as: get_height
Note:
method wrapper for int height
9018 9019 9020 9021 |
# File 'lib/ropencv/ropencv_types.rb', line 9018 def height() __validate_pointer__ Rbind::cv_rect_get_height( self) end |
#height=(value) ⇒ Void Also known as: set_height
Note:
method wrapper for int height
9027 9028 9029 9030 |
# File 'lib/ropencv/ropencv_types.rb', line 9027 def height=(value) __validate_pointer__ Rbind::cv_rect_set_height( self, value) end |
#size ⇒ Cv::Size
Note:
method wrapper for cv::Size cv::Rect::size()
9059 9060 9061 9062 9063 9064 9065 9066 9067 |
# File 'lib/ropencv/ropencv_types.rb', line 9059 def size() __validate_pointer__ result = Rbind::cv_rect_size( self) if result.respond_to?(:__owner__?) && !result.__owner__? # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) end result end |
#tl ⇒ Cv::Point
Note:
method wrapper for cv::Point cv::Rect::tl()
9035 9036 9037 9038 9039 9040 9041 9042 9043 |
# File 'lib/ropencv/ropencv_types.rb', line 9035 def tl() __validate_pointer__ result = Rbind::cv_rect_tl( self) if result.respond_to?(:__owner__?) && !result.__owner__? # store owner insight the pointer to not get garbage collected result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) end result end |
#to_s ⇒ Object
converts Rect into a string by crawling through all its attributes
8956 8957 8958 |
# File 'lib/ropencv/ropencv_types.rb', line 8956 def to_s "#<cv::Rect x=#{self.x} y=#{self.y} width=#{self.width} height=#{self.height}>" end |
#width ⇒ Fixnum Also known as: get_width
Note:
method wrapper for int width
9001 9002 9003 9004 |
# File 'lib/ropencv/ropencv_types.rb', line 9001 def width() __validate_pointer__ Rbind::cv_rect_get_width( self) end |
#width=(value) ⇒ Void Also known as: set_width
Note:
method wrapper for int width
9010 9011 9012 9013 |
# File 'lib/ropencv/ropencv_types.rb', line 9010 def width=(value) __validate_pointer__ Rbind::cv_rect_set_width( self, value) end |
#x ⇒ Fixnum Also known as: get_x
Note:
method wrapper for int x
methods
8967 8968 8969 8970 |
# File 'lib/ropencv/ropencv_types.rb', line 8967 def x() __validate_pointer__ Rbind::cv_rect_getx( self) end |
#x=(value) ⇒ Void Also known as: set_x
Note:
method wrapper for int x
8976 8977 8978 8979 |
# File 'lib/ropencv/ropencv_types.rb', line 8976 def x=(value) __validate_pointer__ Rbind::cv_rect_setx( self, value) end |
#y ⇒ Fixnum Also known as: get_y
Note:
method wrapper for int y
8984 8985 8986 8987 |
# File 'lib/ropencv/ropencv_types.rb', line 8984 def y() __validate_pointer__ Rbind::cv_rect_gety( self) end |
#y=(value) ⇒ Void Also known as: set_y
Note:
method wrapper for int y
8993 8994 8995 8996 |
# File 'lib/ropencv/ropencv_types.rb', line 8993 def y=(value) __validate_pointer__ Rbind::cv_rect_sety( self, value) end |