/// <summary> /// Set the type and value of an item of metadata. /// </summary> /// <remarks> /// Sets the type and value of an item of metadata. Any old item of the /// same name is removed. See <see cref="GValue"/> for types. /// </remarks> /// <param name="gtype">The GType of the metadata item to create.</param> /// <param name="name">The name of the piece of metadata to create.</param> /// <param name="value">The value to set as a C# value. It is /// converted to the GType, if possible.</param> public new void Set(IntPtr gtype, string name, object value) { using var gv = new GValue(); gv.SetType(gtype); gv.Set(value); VipsImage.Set(this, name, in gv.Struct); }
/// <summary> /// Set a GObject property. The value is converted to the property type, if possible. /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> public virtual void Set(string name, object value) { // logger.Debug($"Set: name = {name}, value = {value}"); var gtype = GetTypeOf(name); var gv = new GValue(); gv.SetType(gtype); gv.Set(value); Internal.GObject.GObjectSetProperty(this, name, ref gv.Struct); }
/// <summary> /// Set a GObject property. The value is converted to the property type, if possible. /// </summary> /// <param name="name">The name of the property to set.</param> /// <param name="value">The value.</param> /// <param name="gtype">The GType of the property.</param> public virtual void Set(IntPtr gtype, string name, object value) { // logger.Debug($"Set: gtype = {gtype}, name = {name}, value = {value}"); using (var gv = new GValue()) { gv.SetType(gtype); gv.Set(value); Internal.GObject.SetProperty(this, name, in gv.Struct); } }