CwCreateEffect

Syntax:

hObject = CwCreateEffect(sRegionName, sToolName)

        hObject         (handle) A handle to the newly-created object.

        sRegionName     (string) The name of the region to use.

        sToolName       (string) The name of the tool to use.

Description:

This function creates a new effect. The tool is chosen by the argument "sToolName" and the region is chosen by "sRegionName". A handle to the new effect is returned. If either the tool name or region name is invalid, an exception is raised. Tool and region names are case-insensitive.

Example:

/* This function creates a random objects and returns a handle to it. */

randobj:procedure

mw= 8.5;
mh= 11;
mx = mw/2;
my = mh/2;

/* Need these to generate types. */
region.1.name = "Custom Region";
region.2.name = "User Draw";
region.3.name = "Ramp";
region.4.name = "Ellipse Fade";
region.5.name = "Headline Text";
region.6.name = "Block Text";
region.7.name = "Rectangle";
region.8.name = "Ellipse";
region.9.name = "Shape";
nregions = 9;

tool.1.name = "Custom Tool";
tool.2.name = "Bitmap";
tool.3.name = "Solid Color";
tool.4.name = "Wave";
tool.5.name = "Lens";
tool.6.name = "Emboss";
tool.7.name = "Contrast & Brightness";
tool.8.name = "Greyscale";
tool.9.name = "Color Fade";
tool.10.name = "Button";
tool.11.name = "Noise";
tool.12.name = "Pixelate";
tool.13.name = "Blur";
tool.14.name = "Sharpen";
ntools = 14;

t=random(1,ntools)
r=random(1,nregions)

x = rand(0, mx)
y = rand(0, my)
w = rand(.01, mw)
h = rand(0, mh)

o = CwCreateEffect(region.r.name, tool.t.name)
call CwSetPosition o, x, y, w, h, 0, 0

return o

Remarks:

The created object is always on top.

The initial size is determined by the current selection rectangle. If the selection rectangle is not set, an undefined default size is used. The default size is usually quite small.



Functions by NAME

Index

Functions by PURPOSE