Zoom/Scale Content with animation


I am wondering how can I scale a control in xojo on mac os x?

For example, I have the HTMLViewer Control and now I’d like to resize it from 400x400px to a thumbnail of 128x128px.
It should scale the content and not just change the border size…

How is that possible?

Which Cocoa Api is needed to achieve such behaivour?

Thank you.

RubberViews does that for HTMLViewer, but upon resizing of the entire window. It would be possible for a single control by placing it inside a Container Control.

Ok… So I guess I will use some Declare stuff and working with the Cocoa API.

[code] declare sub setScale lib “Cocoa” selector “scaleUnitSquareToSize:” (id As integer, size As NSSize)

dim size As NSSize
size.w = 128 / 400
size.h = 128 / 400

setScale(HTMLViewer1.Handle, size)

//after setting the unit scale the old, fullsize image of the htmlviewer is still there, so…

Also note it scales towards the lower left corner

Wow, thank you Will.
I will try that out later today.

Animation Kit makes this a one-liner.

Ok Not sure if this is the most efficient way to create animations. I just played with it a little and I see CPU spikes up to 30%…
Does this AnimationKit use GPU for the rendering or not?

Nearly nothing in Xojo uses the GPU. The declares will be more efficient, but they’re also not cross platform. I’m pretty sure you don’t need that, so keep using the declares if you like. I was just making sure you’re aware of the options available to you.