Fwd: Shrink Image quickly
Scott Raney
raney at metacard.com
Mon Jan 6 13:51:09 EST 2003
On Mon, 6 Jan 2003, Sannyasin Sivakatirswami wrote:
> Maybe someone on the MC list will know
We've had few problems with indiscriminate cross-posting between the
MC and RR mailing lists, and I'm hoping this is not going to start a
trend...
> >> on Shrinking
> >> put the width of img "shrinkTest" into x
> >> if x = 20 then
> >> restoreSize
> >> exit Shrinking
> >> end if
> >> put the height of image "shrinkTest" into y
> >> set the width of image "shrinkTest" to (x - 1)
> >> set the height of image "shrinkTest" to (y - 1)
Here's your first problem: setting the width and height separately
causes the image to be rescaled *twice* instantly halving your
performance. You should be setting the rect property instead.
The second problem is the -1 part: the actual amount to change depends
on the performance of the hardware but -1 is always going to be to
small unless you're only dealing with very small images on very fast
hardware. Things like the "move" command and visual effects
adaptively change the delta to meet the time requirements and you'll
have to do something similar using the milliseconds function,
i.e., compute the size based on the ratio:
currenttime - starttime / totaltime
You should be able to build a usable move/scale routine using the
above techniques, but for serious work in this area you should be
using Flash or one of the QT-based animation tools from which you
would export a QT movie that you'd play with a player control.
Regards,
Scott
********************************************************
Scott Raney raney at metacard.com http://www.metacard.com
MetaCard: You know, there's an easier way to do that...
More information about the metacard
mailing list