CMY

From Xojo Documentation
Jump to: navigation, search
Method


Returns a Color based on the CMY (cyan, magenta, yellow) color model and the specified level of transparency. Use the new form of the Picture constructor to create pictures that support the alpha channel or convert existing pictures to the new format using the code described in HasAlphaChannel.

Syntax

result=CMY(cyan, magenta, yellow [, alpha = 0])

Part Type Description
result Color An object that represents the color based on the cyan, magenta, and yellow values.
cyan Double The value of Cyan in the color (0-1).
magenta Double The value of Magenta in the color (0-1).
yellow Double The value of Yellow in the color (0-1).
alpha Integer The value of transparency in the color (0-255). Zero is completely opaque and 255 is transparent. If omitted, the default is 0 (no transparency).

Notes

The CMY function returns a Color based on the amounts of Cyan, Magenta, Yellow, and transparency passed. The color amounts are represented by doubles between 0 and 1 and are stored internally as three bytes. The level of transparency is an optional Integer from 0-255. If omitted, it defaults to completely opaque. You can also use either the RGB or HSV models to assign a color and you can also specify a color with the RGB model using the &c literal. All alternatives support the optional transparency parameter.

Examples

This example uses the CMY function to assign a Color. It is in the Paint event of a Canvas or a Window.

Rectangle1.FillColor = CMY(0.35, 0.9, 0.6)

Transparency

The following example draws a color patch in a Canvas with 75% transparency. With the CMY function, the range is from 0 to 255. Zero is completely opaque and 255 is completely transparent. The code is in the Paint event.

g.ForeColor = CMY(0.0, 1.0, 1.0, 255 * 0.75) // transparency = 75%

g.FillRect(0, 70, 200, 50)
g.ForeColor = CMY(0.0, 0.0, 0.0)
g.DrawString("Translucent = 30%", 210, 80)

See Also

Color data type; HSV, RGB, SelectColor functions; &c literal.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About