Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Calculating the day of the date
SpellChecker
Camtasia
MPEGXtra
ResourceXObject
Turn puppeting off for a range of sprite channels
Tint bitmap behaviour
Director-3D.com
Resolution Xtra 2.0
Beatnik Xtra
MediaMacros Xtras Mall
 

 

 

Behavior rescale

Added on 6/2/2003

 

Compatibilities:
D8 D8_5 D9 Mac PC

This item has not yet been rated

Author: wvanderlucht (website)

The rescale handler of DaveMennenoh saved me a lot of time. I Only experienced a strange alpha channel problem. I just solved that.

--******************************************
-- mediamacros, by DaveMennenoh
-- modified, w.vdlucht@chello.nl
--******************************************
--rescale (member , max width, max height)

--Rescales a bitmap cast member to a given max width or max height
--while preserving the original aspect ratio of the image.
--This means that normally one of the dimensions of the new
--bitmap will match one of the max dimensions while the other
--dimension will be equal to or smaller than the other max dimension.
--The new image replaces the original.

--membRef - member reference of original bitmap to rescale.
--maxW - maximum width of the rescaled image.
--maxH - maximum height of the rescaled image.

--if you use the membername you have to reset that propertie!

on rescale membRef,maxW,maxH
  membRef.useAlpha=FALSE--in director MX/winXP bmp's standard useAlpha=TRUE
  wide=membRef.width
  high=membRef.height
  repeat while wide>maxW or high>maxH
    if wide>maxW then
      scaler=maxW/float(wide)
      wide=wide*scaler
      high=high*scaler
      nI=image(wide,high,16)
      nI.copyPixels(membRef.image,nI.rect,membRef.rect)
      membRef.erase()
      --k=new(#bitmap,membRef)
      --k.image=nI
    end if  
    wide=membRef.width
    high=membRef.height
    if high>maxH then
      scaler=maxH/float(high)
      wide=wide*scaler
      high=high*scaler
      nI=image(wide,high,16)
      nI.copyPixels(membRef.image,nI.rect,membRef.rect)
      membRef.erase()
      --k=new(#bitmap,membRef)
      --k.image=nI
    end if
    k=new(#bitmap,membRef)--just one time
    k.image=nI
    wide=membRef.width
    high=membRef.height
  end repeat
end

--***********************************************

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail