views:

141

answers:

1

I have a full screen app that I want to be able to zoom in on certain areas.

I have the code working fine, but I notice that when I get closer in, the zoom in animation (which animates the ScaleTransform.ScaleX and ScaleTransform.ScaleY properties on a Parent canvas) starts to jerk down a little and the frame rate suffers.

Im not using any BitmapEffects or anything, and ideally I would like my scene to get more complicated than it currently already is.

The scene is quite large, 1980x1024, this is a requirement and cannot be changed.

The current layout is like this:

<Canvas x:name="LayoutRoot">
  <Canvas x:Name="ContainerCanvas">
    <local:MyControl x:Name="c1" />
    <!-- numerous or ther controls and elements that compose the scene  -->
  </Canvas>
</Canvas>

The code that zooms in just animates the RenderTransform of the ContainerCanvas, which in tern, scales its children which gives the desired effect.

However, Im wondering if I need to swap out the ContainerCanvas for a ViewBox or something like that? Ive never really worked with ViewBox/Viewport controls before in WPF can they even help me out here?

Smooth zooming is a huge requirement of the client and I must get this resolved.

All ideas are welcome

Thanks a lot

Mark

A: 

I have a similar problem with bitonal images which need to be zoomed and smooth panned, but being bitonal need to be anti-aliased to make onscreen viewing acceptable. Obviously this anti-aliasing can cause performance issues. Have you played around with the RenderOptions.SetBitmapScalingMode() for the image object your are displaying? If so you may have to trade off between the speed/performance of the zoom animation and the quality of the rendered image.

One possible solution I had thought of, but have not yet had time to implement, would be to switch into a low quality bitmap scaling mode during the animation, and switching back to high quality at the end of the animation.

Andrew Bienert
Actually we are not using images at all, all of our content on screen are user controls that contain standard vector based shapes like rectangles, ellipses, etc... (but there are quite a few gradient fills which I dont believe should be an issue)
Mark
Ok. The problem sounds similar though. At the end of the day it's a RenderTransform on a container with something in it. Do you find that if you zoom in, out and back in on the same region that the second zoom is smoother?
Andrew Bienert
Havent implemented re-zoom yet :) I will soon though and let you know, my suspicion is that it will be smoother though
Mark
Actually its still performing poorly even after zooming in and out again and again, no improvements made. So its not that its loading the resources for the first time (although that still might be true), but rather the entire scene is slow to scale....
Mark
What happens as you reduce the number of components in your scene?
Andrew Bienert
the scaling improves when you remove items from the scene, I think perhaps I just need to be smarter about what I scale and what I dont...
Mark