The Omni Group Forums

The Omni Group Forums (
-   Omni Frameworks (
-   -   Use of Scaling Views for images... (

SpiraMira 2010-09-22 06:37 PM

Use of Scaling Views for images...

Just a general question about the Scaling View classes.

I am implementing a general image canvas and currently use the framework's scaling views and scrollviews. What is the benefit of using those classes for just one non-tiled image?

The [U]-adjustScaleTo:canvasSize:[/U] method reframes and retiles if needed but it affects the scrollview zoomScale. As a consequence and under 3.2SDK at least, my attached CAShapeLayers (they track my selection rectangles etc...) also need to be re-scaled manually. Normally, the Bezier paths in my image sublayers are automagically re-scaled by zoomScale so zooming via SDK pinch gestures works as expected with no programmatic intervention. Forcing a zoomScale to 1, as the method does by setting the transform to Identity also re-scales image sublayer content: a side effect that now requires some code to re-sync to a new "effective" scale. One simply has to add a rectangular shape layer to the image to demonstrate this.

The method does track memory usage and sets "safe" margins for min and max scales. And the framework does have built-in "snapZoom" functionality which is neat. Are there any other visual benefits like less pixelation ? I don't notice any with a 320x480 image on an iPad. The overhead of manually re-scaling sublayer content bothers me a little. Maybe I'm missing something.

Tim Wood 2010-09-27 07:53 AM

If you have a single bitmap image, the only benefit would be if that image is large (and you have some way to load subrects w/o loading the whole thing) or if you are going to zoom in for some reason. Most of the memory savings of tiling is going to be irrelevant if you've already loaded the complete image.

In the cases we use this for, the reseting of the scale factor to 1.0 (at the end of a zoom operation) means that we maintain a 1:1 user coordinate to pixel mapping when we regenerate our tiles. So, text, shapes and lines get bigger without aliasing. If you have a bitmap image, you might get some benefit from this if you want to see sharp lines between source pixels instead of some sort of blurred bilinear filtering, but that's about it.

All times are GMT -8. The time now is 01:49 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.