Справочник Пользователя для Shayton Equilibrium Kitchen Utensil 2003

Скачать
Страница из 194
MediaScript Objects and Methods 105 
• 
• 
• 
m a k e C a n v a s ( )
This function creates a “blank” Media object of the specified dimensions and fully supports 
the CMYK color-space.
Syntax
makeCanvas(
[Xs @ <width in pixels>]
[Ys @ <height in pixels>]
[Rtype @ <bit-depth>]
[FillColor @ <color in hexadecimal or rgb>]
[Transparency @ <true, false>]
Parameters
Xs
 and 
Ys
 - specify the width and height of the canvas in pixels. If Xs or Ys is not specified, 
a 1x1 canvas is created. If only one of Xs and Ys is specified, the unspecified parameter is 
assumed to be the same as the specified one (a square canvas is created).
Rtype
 - specifies the bit-depth. Supported bit-depths are: “RGB-24”, “RGBA-32”, “CMYK-
32”, “CMYKA-40”, “Gray-8”, “RGB-15”, “RGB-16”, “RGBA-16”, “RGB-18”, “Alpha-8”, 
“HLS-24”, and “HSV-24”. The default bit-depth is “RGBA-32” (RGB, 32-bit).
NOTE: 
The 16-bit type, is 5-6-5, while the 16a-bit is 1-5-5-5 with the top bit as an alpha channel.
FillColor
 - determines the color value given to each pixel in the generated canvas. If 
FillColor is not specified, each pixel is set to black.
Transparency
 
- set to “true”, the canvas’ pixels are all set as transparent and FillColor is 
used as both the foreground and background color. If Transparency is set to false, the 
canvas’ pixels are set as solid. FillColor is used for the foreground color, and the 
background color is black. Transparency is set to false by default.
Example
var image = new Media(); 
var text = new Media();
image.makeCanvas(Xs @ 200, Ys @ 150, FillColor @ 0x0000ff);
text.makeText(text @ "hello world", font @ "Arial", style @ "Bold", 
size @ 24, smooth @ true, color @ 0xffffff);
image.composite(source @ text);
image.save(type @ "jpeg");