I have an image on a canvas and a ScaleTranform and a TranslateTransform attached to the image's RenderTranform. So with a bit of mouse event handling I can move and zoom the image within the 350 by 450 bounds of the canvas.
How would I calculate the clipping rectangle on the original BitmapImage, to that of the visible area on the screen, after some scaling and translation. I'd like to crop the original BitmapImage.
<Border BorderBrush="Black" BorderThickness="2">
<Canvas Name="canvas" ClipToBounds="True" Height="450" Width="350">
<Image Name="image" Opacity="1" RenderTransformOrigin="0.5,0.5" Height="450" Width="350">
<Image.Source>
<BitmapImage UriSource="test.jpg"/>
</Image.Source>
</Image>
</Canvas>
</Border>
Thanks