On 5/12/04 9:18 pm, "Zebin Ayinikat" <[EMAIL PROTECTED]> wrote:
> i have a few sprites on stage some
> cover almost all of the stage (these sprites maybe a flash , pdf or
> video sprite etc.). I have one sprite which is on top quite small
> (lets call this topsprite). Now my question is using Imaging Lingo can
> i copy the stage as it is but without the topsprite and including
> everything underneath it in the copy operation ...
On 5/12/04 9:31 pm, "roymeo" <[EMAIL PROTECTED]> wrote:
> more complex ways would be to get the .image of all the sprites on
> stage individually and paste them together in the correct positions
> in a new image.
Hi Zebin,
Here are two handlers which do something similar to what you are asking for:
they return the image of the area behind a given sprite. You could modify
them so that they return the image of the entire stage apart from the given
sprite.
The first requires that the movie is not running in Shockwave, since it uses
a MIAW. It was written for D8, so you may have to use...
imageMiaw = window().new("MIAW "&the milliseconds) -- unique name
... if you are working with Director 10.
----------------------------------------------------------------------------
-- USING A MIAW --
----------------------------------------------------------------------------
on getImageBehind(spriteNumber, whichFrame)
case the runMode of
"Author", "Projector": -- continue
otherwise
-- Can't create MIAW in a plug-in: return a dummy image
return image(1, 1, 1)
end case
case ilk(spriteNumber)of
#sprite: spriteNumber = spriteNumber.spriteNum
#integer:
if spriteNumber > the lastChannel then
return #notASprite
else if spriteNumber < 1 then
return #notASprite
end if
otherwise
return #notASprite
end case
case ilk(whichFrame) of
#string:
whichFrame = marker(whichFrame)
if not whichFrame then
whichFrame = the frame
end if
#integer:
if whichFrame < 1 then
whichFrame = the frame
else if whichFrame > the lastFrame then
whichFrame = the frame
end if
otherwise
whichFrame = the frame
end case
imageMiaw = window("MIAW "&the milliseconds) -- unique name
imageMiaw.fileName = the moviePath & the movieName
tell imageMiaw
repeat with i = the lastChannel down to spriteNumber
sprite(i).visible = FALSE
end repeat
go frame whichFrame
updateStage
imageBehind = (imageMiaw).image.duplicate()
end tell
forget imageMiaw
return imageBehind
end getImageBehind
----------------------------------------------------------------------------
The second can work in Shockwave, but only with sprites whose members have
an .image property. You may be able to extend this by grabbing the .picture
of other member types (such as fields), creating a temporary bitmap image
using the same .picture, then grabbing the image of that bitmap.
----------------------------------------------------------------------------
-- USING IMAGE --
----------------------------------------------------------------------------
on getImageBehind(thisSprite)
case ilk(thisSprite)of
#sprite: spriteNumber = thisSprite.spriteNum
#integer:
if thisSprite > the lastChannel then
return #notASprite
else if thisSprite < 1 then
return #notASprite
else
spriteNumber = thisSprite
thisSprite = sprite(thisSprite)
end if
otherwise
return #notASprite
end case
thisRect = thisSprite.rect
stageWidth = the stageRight - the stageLeft
stageHeight = the stageBottom - the stageTop
--Create a blank image the same size and color as the Stage
imageData = image(stageWidth, stageHeight, the colordepth)
imageData.fill(imageData.rect, (the stage).bgColor)
-- hAdjust = -thisRect.left
-- vAdjust = -thisRect.top
previousSprite = spriteNumber - 1
repeat with i = 1 to previousSprite
-- Copy the appropriate part of the sprite into the blank image
thatSprite = sprite(i)
if thisRect.intersect(thatSprite.rect) <> rect(0, 0, 0, 0) then
thatMember = thatSprite.member
memberType = thatMember.type
case memberType of
#bitmap, #flash, #text, #vectorShape: -- continue
otherwise
-- * Other member types don't have an #image property
next repeat
end case
-- Find which part of thatSprite overlaps our blank image
thatQuad = thatSprite.quad
-- Determine which options to use for the copyPixels command
spriteInk = thatSprite.ink
optionsList = [ \
#ink: spriteInk, \
#blendLevel: thatSprite.blendLevel, \
#color: thatSprite.color, \
#bgColor: thatSprite.bgColor \
]
-- Prepare the image of thatSprite
if memberType = #text then
thatImage = getTextSpriteImage(thatSprite)
else if spriteInk = 9 then -- #mask
thatImage = getMaskedImage(thatSprite.member)
-- optionsList[#ink] = #backgroundTransparent
optionsList.deleteProp(#ink)
else
thatImage = thatSprite.member.image
end if
thatRect = thatImage.rect
-- Copy the sprite's image onto imageData
imageData.copyPixels(thatImage, thatQuad, thatRect, optionsList)
end if
end repeat
return imageData.crop(thisSprite.rect)
end getImageBehind
----------------------------------------------------------------------------
Cheers,
James
[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!]