Image Editor
Imports
To integrate the Truvideo SDK, include the following platform-specific imports:
#if IOS
using Foundation;
using UIKit;
using TruvideoImageiOS;
#endif
#if ANDROID
using Application = Android.App.Application;
using TruVideoImageAndroidBinding;
using TruVideoImageLib = TruVideoImageAndroid.DotnetTruvideoImage;
#endifAsync Callback Wrapper
For handling asynchronous callbacks in Android, use the following method:
#if ANDROID
private Task<T> ExecuteImageCallbackAsync<T>(Action<ImageCallback> action) {
var tcs = new TaskCompletionSource<T>();
action.Invoke(new ImageCallback(
success => MainThread.BeginInvokeOnMainThread(() =>
tcs.TrySetResult((T)Convert.ChangeType(success, typeof(T)))),
failure => MainThread.BeginInvokeOnMainThread(() => tcs.TrySetException(new Exception(failure)))
));
return tcs.Task;
}
#endifThis function executes image-related actions asynchronously and ensures results are processed on the main thread.
Editing an Image
Android implementation:
iOS implementation:
Last updated
Was this helpful?