angle and rotate commands

Rodney Tamblyn rtamblyn at xtra.co.nz
Mon Oct 14 17:21:01 EDT 2002


Ken,

Thanks for your reply.  I looked at LocLock yesterday but didn't 
quite get it - now I do.

Here's the revised script:

on previewMedia theSel
   lock screen
   set the cursor to busy
   #if user has clicked on a line in the field theSel contains the 
number of the line
   if theSel <> empty then put theSel into currImg
   #retrieve properties of current image (file,name,description,rotation etc)
   put currFile(currImg) into fi
   put currNm(currImg) into fld "currNm"
   put currDesc(currImg) into fld "currDesc"
#retreive user-defined optional rotation value for this image
   put currRot(currImg) into rot
   rotInfo rot
   #first we need to set the filename with lockLoc false so we can 
determine width/height of img
   set the lockLoc of img "view" to false
   #restore angle in case previously set to some value other than 0
   set the angle of img "view" to 0
   set the filename of img "view" to fi
   put the height of img "view" into theH
   put the width of img "view" into theW
   #is image (as stored on disk) wide or tall?
   if (theW > theH) then
     #wide img
     #determine relative height, if width is adjusted to imgMaxDim 
(default 300) pixels
     put round( imgMaxDim * (theH / theW)) into y
     put imgMaxDim into x
   else
     # put false into isWideImg
     put round(imgMaxDim * (theW / theH)) into x
     put imgMaxDim into y
   end if
   if rot = 0 then
#no rotation, apply resize now.  If img is being rotated, must
#apply resize after rotating as must "rotate" resize instructions too
     set the width of img "view" to x
     set the height of img "view" to y
   end if
   # do we need to rotate this image in order for it to display correctly?
   if abs(rot) > 0 then
     set the lockLoc of img "view" to true
     set the angle of img "view" to rot
   end if
   #resize image
   if (abs(rot) <> 90) then
     set the width of img "view" to x
     set the height of img "view" to y
   else
     set the width of img "view" to y
     set the height of img "view" to x
   end if
#make sure location stays centered on desired point...
   set the loc of img "view" to theImgLc

end previewMedia





More information about the metacard mailing list