
MediaScript Objects and Methods 117
•
•
•
•
Parameters
Smooth - provides for smooth edges when warping the image using non-right angles.
TopLeftX and TopLeftY - represent the upper left corner of the area to be warped. The
default is the original image’s upper-left corner.
TopRightX and TopRightY - represent the upper right corner of the area to be warped.
The default is the original image’s upper-right corner.
BotLeftX and BotLeftY - represent the lower left corner of the area to be warped. The
default is the original image’s lower-left corner.
BotRightX and BotRightY - represent the lower right corner of the area to be warped.
The default is the original image’s lower-right corner.
layers - for PSD files, specifies the layers to be affected. The layer numbers begin at 0
(background) and go up. For more information see “load()” on page 101.
Example
var image = new Media();
image.load(name @ "peppers.tga");
image.quadWarp(TopLeftX @ -10, TopLeftY @ -20, TopRightX @ 440,
TopRightY @ 480, BotLeftX @ -40, BotLeftY @ 780, BotRightX @ 640,
BotRightY @ 0, smooth @ true);
image.save(type @ "jpeg");
rectangle()
Draws and positions a rectangle on the image based on the specified parameters. This
method accepts all composite() parameters except HandleX and HandleY.
The foreground color may vary with this function, depending on the original Media object.
If the object has a set foreground color, or it is set with the setColor() function, MediaRich
uses the set color.
However, if the object has no set foreground color, MediaRich does the following:
•
For objects with 256 colors or less, MediaRich uses the last color index
•
For objects with 15-bit or greater resolution, MediaRich uses white
NOTE: Using rectangle() to mask frames within a JavaScript for loop can result in initially
poor anti-aliasing. To maintain optimal anti-aliasing, place the masking rectangle outside the loop.