DynamicSprite.CopyTransparencyMask(int fromSpriteSlot)
Copies the transparency mask from the specified sprite slot onto the dynamic sprite.
The dynamic sprite's transparency and/or alpha channel will be replaced with the
one from the other sprite.
This command is designed for special effects. It is fairly slow since it involves
inspecting each pixel of the image, so it's not recommended that you use it often.
The source sprite must be the same size and colour depth as the dynamic sprite.
NOTE: This command makes all pixels that are transparent in the source sprite
also transparent in the dynamic sprite. It does not make opaque pixels from the
source sprite into opaque pixels on the dynamic sprite (because it wouldn't know
what colour to make them).
If the source image has an alpha channel, then the dynamic sprite will have an
alpha channel created as a copy of the one from the source sprite.
Example:
DynamicSprite* sprite = DynamicSprite.CreateFromExistingSprite(10);
sprite.CopyTransparencyMask(11);
object[0].Graphic = sprite.Graphic;
Wait(80);
sprite.Delete();
creates a dynamic sprite as a copy of sprite 10, changes its transparency mask
to use that of sprite 11, and displays it on object 0.
See Also: DynamicSprite.CreateFromExistingSprite
|