Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Save Image with Marker

Image Marker

As per the Image Yellow Marker marks the part of the Vehicle.
As I am successfully marking this Image using Xamarin.Forms. Now the problem is that my Image is using the marker easily but the issue lies in that I cannot save the whole Image with the Marker.

I am using SkiaSharp & TouchTracking.Forms to get the coordinate of clicks on an Image. Then I am placing the marker on that position.

Here is the code behind this -

In XAML file

<AbsoluteLayout x:Name="myabs1" HeightRequest="400" >
                                <Image Source="logo.png" Aspect="AspectFill" AbsoluteLayout.LayoutBounds="0,0,1,1"
                                AbsoluteLayout.LayoutFlags="SizeProportional"/>
                                <forms:SKCanvasView
                                AbsoluteLayout.LayoutBounds="0,0,1,1"
                                AbsoluteLayout.LayoutFlags="SizeProportional">
                                    <forms:SKCanvasView.Effects>
                                        <tt:TouchEffect Capture="True"  TouchAction="TouchEffect_TouchAction1" />
                                    </forms:SKCanvasView.Effects>
                                </forms:SKCanvasView>
                            </AbsoluteLayout>

In Xaml.cs

xPos = args.Location.X;
                var y = args.Location.Y;
                var v = new PinOption();
                AbsoluteLayout.SetLayoutBounds(v, new Rectangle(xPos, y, 0.25, 0.25));
                AbsoluteLayout.SetLayoutFlags(v, AbsoluteLayoutFlags.SizeProportional);
                myabs1.Children.Add(v);

PinOption is the view in which the Image & it's further Functionality is written.

Please suggest saving the whole image with the Marker.

Best Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    Accepted Answer

    You can make a screenshot with code after adding Yellow Marker, Here is code.

    async Task CaptureScreenshot()
    {
        var screenshot = await Screenshot.CaptureAsync();
        var stream = await screenshot.OpenReadAsync();
    
        Image.Source = ImageSource.FromStream(() => stream);
    }
    
    

    You can make your application fullscreen (all screen), then make a screenshot.

    https://stackoverflow.com/questions/61313976/how-to-make-a-xamarin-app-fullscreen-all-screen

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    Accepted Answer

    Are there any update for this issue, please reply is helpful, please click the Yes tab under the helpful answer.

Answers

Sign In or Register to comment.