Class: Vips::Object
- Inherits:
-
GObject::GObject
- Object
- GObject::GObject
- Vips::Object
- Defined in:
- lib/vips/object.rb
Direct Known Subclasses
Defined Under Namespace
Modules: ObjectLayout Classes: ManagedStruct, Struct
Class Method Summary collapse
-
.print_all ⇒ Object
print all active VipsObjects, with their reference counts.
Instance Method Summary collapse
- #get(name) ⇒ Object
-
#get_pspec(name) ⇒ Object
return a pspec, or nil ...
-
#get_typeof(name) ⇒ Object
return a gtype, 0 on not found.
-
#get_typeof_error(name) ⇒ Object
return a gtype, raise an error on not found.
- #set(name, value) ⇒ Object
Methods inherited from GObject::GObject
ffi_managed_struct, #ffi_managed_struct, #ffi_struct, ffi_struct, #initialize
Constructor Details
This class inherits a constructor from GObject::GObject
Class Method Details
Instance Method Details
#get(name) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/vips/object.rb', line 148 def get name gtype = get_typeof_error name gvalue = GObject::GValue.alloc gvalue.init gtype GObject::g_object_get_property self, name, gvalue result = gvalue.get GLib::logger.debug("Vips::Object.get") { "#{name} == #{result}" } return result end |
#get_pspec(name) ⇒ Object
return a pspec, or nil ... nil wil leave a message in the error log which you must clear
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/vips/object.rb', line 117 def get_pspec name pspec = GObject::GParamSpecPtr.new argument_class = Vips::ArgumentClassPtr.new argument_instance = Vips::ArgumentInstancePtr.new result = Vips::vips_object_get_argument self, name, pspec, argument_class, argument_instance return nil if result != 0 pspec end |
#get_typeof(name) ⇒ Object
return a gtype, 0 on not found
138 139 140 141 142 143 144 145 146 |
# File 'lib/vips/object.rb', line 138 def get_typeof name pspec = get_pspec name unless pspec Vips::vips_error_clear return 0 end pspec[:value][:value_type] end |
#get_typeof_error(name) ⇒ Object
return a gtype, raise an error on not found
130 131 132 133 134 135 |
# File 'lib/vips/object.rb', line 130 def get_typeof_error name pspec = get_pspec name raise Vips::Error unless pspec pspec[:value][:value_type] end |
#set(name, value) ⇒ Object
160 161 162 163 164 165 166 167 168 |
# File 'lib/vips/object.rb', line 160 def set name, value GLib::logger.debug("Vips::Object.set") { "#{name} = #{value}" } gtype = get_typeof_error name gvalue = GObject::GValue.alloc gvalue.init gtype gvalue.set value GObject::g_object_set_property self, name, gvalue end |