Chapter 3
162
createMask()
Syntax
imageObject
.createMask()
Description
This function creates and returns a mask object for use with the
copyPixels()
function.
Mask objects aren’t image objects; they’re useful only with the
copyPixels()
function for
duplicating the effect of mask sprite ink. To save time, if you plan to use the same image as a mask
more than once, it’s best to create the mask object and save it in a variable for reuse.
Example
This statement copies the entire image of member Happy into a rectangle within the image of
member brown square. Member gradient2 is used as a mask with the copied image. The mask is offset
by 10 pixels up and to the left of the rectangle into which the image of member Happy is pasted.
member("brown square").image.copyPixels(member("Happy").image, \
rect(20, 20, 150, 108), member("Happy").rect, \
[#maskImage:member("gradient2").image.createMask(), maskOffset:point(-10, -
10)])
See also
copyPixels()
,
createMatte()
,
ink
createMatte()
Syntax
imageObject
.createMatte({
alphaThreshold
})
Description
This function creates and returns a matte object that you can use with
copyPixels()
to duplicate
the effect of the matte sprite ink. The matte object is created from the specified image object’s
alpha layer. The optional parameter
alphaThreshold
excludes from the matte all pixels whose
alpha channel value is below that threshold. It is used only with 32-bit images that have an alpha
channel. The
alphaThreshold
must be a value between 0 and 255.
Matte objects aren’t image objects; they are useful only with the
copyPixels()
function. To save
time, if you plan to use the same image as a matte more than once, it’s best to create the matte and
save it in a variable for reuse.
Example
This statement creates a new matte object from the alpha layer of the image object testImage and
ignores pixels with alpha values below 50%:
newMatte = testImage.createMatte(128)
See also
copyPixels()
,
createMask()
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...