How to load shapes with custom bounds in the .NET MAUI Image Editor?
The Syncfusion® .NET MAUI Image Editor allows you to customize the bounds for the shape loaded into the editor. The following demonstration helps you to understand how to load shapes with custom Bounds.
XAML:
Initialize the SfImageEditor control and provide a source image for editing.
<imageEditor:SfImageEditor x:Name="imageEditor" Source="custombounds.png"/>
C#:
Attach an event handler to the ImageLoaded event to apply custom bounds to shapes once the image has loaded.
imageEditor.ImageLoaded += OnImageLoaded;
C#:
Shapes can be added using Custom Bounds. The value ranges from 0 to 1.
private void OnImageLoaded(object sender, EventArgs e)
{
imageEditor.AddShape(AnnotationShape.Circle, new ImageEditorShapeSettings()
{
Bounds = new Rect(0.1, 0.1, 0.2, 0.2)
});
}
Output:
Conclusion
I hope you enjoyed learning how to load shapes with custom bounds in the .NET MAUI Image Editor (SfImageEditor).
Refer to our .NET MAUI Image Editor feature tour page for other groundbreaking feature representations. You can also explore our .NET MAUI Image Editor documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Image Editor and other .NET MAUI components.
Please let us know in the following comment section if you have any queries or require clarification. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!