Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Interface Colors in all palettes
Digital Video
Hide mouse on idle
Lingo Library
Vigenere cipher (Encryption)
macromedia.director.basics
Custom Projector Icon
Cells Xtra
Advance counter v20040306
Light Up
 

 

 

Behavior New bitmap from existing member

Added on 6/12/2000

 

Compatibilities:
D8 Mac PC Script Shockwave

This item has not yet been rated

Author: DaveMennenoh

Creates a new bitmap cast member from a pre-existing bitmap.

--newBmpFromMem (original member, new width, new height, new depth, new member cast position, new member cast name)
--Creates a new bitmap cast member from a pre-existing bitmap.
--origMem - member reference of original bitmap to copy from
--wide - width of new bitmap, if 0 then the width of the original is used
--high - height of new bitmap, if 0 then the heoght of the original is used
--deep - colordepth of the new bitmap, if 0 then 32 is used, if #grayscale is used a new 8 bit grayscale version of the original is created
--newMem - number of the new castmember to create. If 0 then 1st available empty cast slot is used
--cName - name of castLib to place new bitmap into. If "" then internal is used
--returns 1 if successfull, 0 otherwise.
--Director 8 image manipulation routines.
--(c) 2000, Dave Mennenoh
--dmennenoh@hotmail.com

--newBmpFromMem (original member, new width, new height, new depth, new member cast position, new member cast name)

--Creates a new bitmap cast member from a pre-existing bitmap.
--origMem - member reference of original bitmap to copy from
--wide - width of new bitmap, if 0 then the width of the original is used
--high - height of new bitmap, if 0 then the heoght of the original is used
--deep - colordepth of the new bitmap, if 0 then 32 is used, if #grayscale is used a new 8 bit grayscale version of the original is created
--newMem - number of the new castmember to create. If 0 then 1st available empty cast slot is used
--cName - name of castLib to place new bitmap into. If "" then internal is used

--returns 1 if successfull, 0 otherwise.
on newBmpFromMem origMem,wide,high,deep,newMem,cName
  typ=origMem.type
  okTyp=[#bitmap,#text,#vectorShape]
  if getPos(okTyp,typ) then
    
    if not wide then wide=origMem.width
    if not high then high=origMem.height
    gFlag=0
    if deep=#grayScale then
      deep=8
      gFlag=1
    end if
    if not deep then deep=32
    if cName="" then cName="internal"
    
    if gFlag then
      newIm=image(wide,high,deep,#grayScale)
    else
      newIm=image(wide,high,deep)
    end if
    
    newIm.copyPixels(origMem.image,rect(0,0,wide,high),origMem.rect)
    
    if newMem then
      nM=member(new(#bitmap,member newMem,castLib cName))
    else
      nM=member(new(#bitmap,castLib cName))
    end if
    
    nM.image=newIm
    return 1
  else
    return 0 --wrong type of member specified in origMem
  end if
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail