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 re开发者_C百科quirement of the client and I must get this resolved.
All ideas are welcome
Thanks a lot
Mark
I see 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.
精彩评论