Currently I have an image on canvas that can be freely moved in my application, on which I have 6 layers of DrawingVisuals, but it looks pretty slow. I am using RenderTargetBitmap for rendering. Is there a faster way to display images on an image or on any other frame element that I can freely move around the canvas?
XAML:
<Canvas> <Image Height="505" HorizontalAlignment="Left" Margin="0,0,0,0" Name="_MapImage" Stretch="Fill" VerticalAlignment="Top" Width="700" MouseLeftButtonDown="_MapImage_MouseDown" MouseWheel="_MapImage_MouseWheel" MouseLeftButtonUp="_MapImage_MouseUp" MouseMove="_MapImage_MouseMove" /> </Canvas>
the code:
_renderRoutesBitmap = new RenderTargetBitmap((int)(_MapImage.Width), (int)(_MapImage.Height), 96, 96, PixelFormats.Default); for (int i = 6; i < 8; ++i) { if((layerCode / (int)Math.Pow(10,i) % 2) == 1) _renderRoutesBitmap.Render(_layers[i]);
source share