Rotate and scale images

Wilhelm Sanke sanke at hrz.uni-kassel.de
Thu Mar 6 15:44:44 EST 2008


Henk van der Velden henk at iglow-media.nl wrote:


> I'm having a hard time rotating and scaling images.
> When scaling an image and then rotating it (set the angle), the scale  
> is 'lost'. Whenever the angle is changed, the image size is reset to  
> the formattedheight / width.
>
> How can I handle this?
> Do I have to recalculate the minimal circumscribing rectangle every  
> time?
>
> And what in case the image is rotated already and then I want to  
> scale it? When using the normal horizontal / vertical scaling, the  
> image gets skewed. Do I need to script the whole mathematics of this?
>
> Kind regards,
>
> Henk



This is indeed a complex bunch of issues:

- When you have resized an image and set the angle of that image, it 
will snap back to its original size.

- When you resize an image and set the lockloc to true, then when 
setting new angles the image will retain its new size when the angle 
value mod 90 is 0 (at angles 0, 90, 180, 270), otherwise it will snap 
back to its previous size.

- To really rotate (i.e. set the angle) the image while keeping its new 
size, you will have to set the imagedata of that image to its imagedata 
("set the imagedata of img x to the imagedata of img x").

- And the other way round: If you have set an image to a new angle, it 
is impossible to resize such an image, whether by dragging the handles 
of the image or by script (or by setting new values for width and height 
in the properties dialog).

- But and only then, you can resize an image after you have set a new 
angle when you set the imagedata of that image to its own imagedata, 
i.e. when you have created a *new* image by setting its imagedata.

The above statements hold for all Rev version from 2.6.1 to 2.9.0-dp-5.

Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>




More information about the Use-livecode mailing list