Class: OpenCV::Cv::Size

Inherits:
Object
  • Object
show all
Extended by:
FFI::DataConverter
Defined in:
lib/ruby/ropencv/ropencv_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ Size

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 Size.



4139
4140
4141
4142
4143
4144
4145
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4139

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? SizeStruct
                       ptr
                   else
                       SizeStruct.new(FFI::AutoPointer.new(ptr,SizeStruct.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.



4136
4137
4138
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4136

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



4131
4132
4133
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4131

def self.from_native(ptr,context)
    rbind_from_native(ptr,context)
end

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4049

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(SizeStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for cv::Size::Size()
    @@cv_size_size_defaults0 ||= []
    if(args.size >= 0 && args.size <= 0)
        args.size.upto(-1) do |i|
            args[i] = @@cv_size_size_defaults0[i]
        end
        begin
            return Rbind::cv_size_size(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::Size::Size(const cv::Size sz)
    @@cv_size_size2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_size_size2_defaults1[i]
        end
        begin
            return Rbind::cv_size_size2(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::Size::Size(const cv::Point pt)
    @@cv_size_size3_defaults2 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@cv_size_size3_defaults2[i]
        end
        begin
            return Rbind::cv_size_size3(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for cv::Size::Size(int width, int height)
    @@cv_size_size4_defaults3 ||= [nil, nil]
    if(args.size >= 2 && args.size <= 2)
        args.size.upto(1) do |i|
            args[i] = @@cv_size_size4_defaults3[i]
        end
        begin
            return Rbind::cv_size_size4(*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.



4119
4120
4121
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4119

def self.rbind_from_native(ptr,context)
    Size.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.



4110
4111
4112
4113
4114
4115
4116
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4110

def self.rbind_to_native(obj,context)
    if obj.is_a? Size
        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



4125
4126
4127
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4125

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

Returns:

  • (Boolean)


4150
4151
4152
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4150

def __owner__?
    @__obj_ptr__[:bowner]
end

#areaObject

wrapper for int cv::Size::area()



4184
4185
4186
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4184

def area()
    Rbind::cv_size_area( self)
end

#heightObject

wrapper for int height



4174
4175
4176
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4174

def height()
    Rbind::cv_size_get_height( self)
end

#height=(value) ⇒ Object

wrapper for int height



4179
4180
4181
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4179

def height=(value)
    Rbind::cv_size_set_height( self, value)
end

#widthObject

methods wrapper for int width



4164
4165
4166
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4164

def width()
    Rbind::cv_size_get_width( self)
end

#width=(value) ⇒ Object

wrapper for int width



4169
4170
4171
# File 'lib/ruby/ropencv/ropencv_types.rb', line 4169

def width=(value)
    Rbind::cv_size_set_width( self, value)
end