Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw overlay on an image

I have an image that the user can zoom/scroll. I want to draw some rectangles/circles on a different layer (for example: drawing a circle for each person's face that was identified in the picture).

The rectangle position is relative to the image.

How do I create such an overlay?

like image 755
Yuval Peled Avatar asked Dec 18 '22 08:12

Yuval Peled


1 Answers

An easy way is to just use a Canvas and set the canvas' background property to your photo, and then place your circles or rectangles on top of that and position them with the Canvas.Left and .Top properties.

    <Canvas x:Name="myCanvas">
        <Canvas.Background>
            <ImageBrush ImageSource="c:\photo.bmp"/>
        </Canvas.Background>
        <Image Canvas.Top="20" Canvas.Left="20" Height="20" Width="20" Source="c:\circle.bmp"/>
    </Canvas>
like image 174
Rob Avatar answered Jan 02 '23 19:01

Rob