I've been trying to do this all sorts of ways and now my brain is locked.
I'm sure once the answer comes back at me I'll feel like a dope. Thanks in
advance for killing my self esteem.


I've got a bunch of images that I need to scale to fit a maxWidth and
maxHeight; trouble is these images are all sorts of possible dimensions.

Say we want to fit a 320x240 area, if I request a rescaling for a rect of
640x480, it will of course check for whether the requested rect is landscape
or portrait, and scale it to meet the 320x240. This works fine for this:

(taken from the handyman's digital portfolio at doug and changed slightly,
whereas tMax and tMin are passed in):

--  if tMem.width > tMem.height then
--    newHeight = (tMem.height * pMax)/tMem.width
--    offset = (pMax - newHeight)/2
--    imRect = rect(0,0,pMax, newHeight)
--    destRect = rect(0,0+offset, pMax, newHeight + offset)
--  else
--    newWidth = (tMem.width * pMin)/tMem.height
--    offset = (pMin-newWidth)/2
--    imRect = rect(0,0,newWidth, pMin)
--    destRect = rect(0+offset, 0, newWidth + offset, pMin)
--  end if


but this really doesn't work, as the image passed in might not fit perfectly
to a max/min -- it's really got to scale the image to fit whichever - the
maxwidth or maxheight, no matter what the image dimensions are, ie:

tPerc = (maxWidth/float(theRect.width)
return(rect * tPerc)

?

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to