/// <summary> /// Creates the specified encoder parameter. /// </summary> /// <param name="encoder">The encoder.</param> /// <param name="nativeParameter">The native encoder parameter.</param> /// <returns></returns> /// <exception cref="HeifException">An error occurred when creating the encoder parameter.</exception> public static unsafe IHeifEncoderParameter Create(SafeHeifEncoder encoder, heif_encoder_parameter nativeParameter) { string name = LibHeifNative.heif_encoder_parameter_get_name(nativeParameter).GetStringValue(); var type = LibHeifNative.heif_encoder_parameter_get_type(nativeParameter); bool hasDefaultValue = LibHeifNative.heif_encoder_has_default(encoder, name); switch (type) { case heif_encoder_parameter_type.Integer: return(CreateIntegerParameter(encoder, nativeParameter, name, hasDefaultValue)); case heif_encoder_parameter_type.Boolean: return(CreateBooleanParameter(encoder, name, hasDefaultValue)); case heif_encoder_parameter_type.String: return(CreateStringParameter(encoder, nativeParameter, name, hasDefaultValue)); default: throw new HeifException($"Unknown { nameof(heif_encoder_parameter_type)}: { type }."); } }