Previous Document Next Document

Understanding the CorelDRAW object model : Working with shapes : Applying effects to shapes


Applying effects to shapes

The object model provides a number of methods for applying effects to shapes. For information on these methods, see the following subtopics:

 
 
 
 
 
 
 
 
 

 
Applying an effect returns an Effect object, which lets you access various properties and methods for the created effect. For example, you can use the Effect.Separate method to separate the shapes that are generated by an effect from the shape to which that effect is applied. In addition, you can use the Effect.Clear method to remove an effect from a shape.
Applying blends

The Shape.CreateBlend method creates a blend between the current shape and the shape that is specified as a parameter. This method provides optional parameters for various blend settings, such as the acceleration of the blend and the path along which the blend is created.

The following VBA code creates a basic ten-step blend:

Dim sh As Shapes, eff As Effect
Set sh = ActiveSelection.Shapes
Set eff = sh(1).CreateBlend(sh(2), 10)

 
In the preceding example, the number of shapes in the blend is twelve: the start and end shapes, plus the ten blend steps that are created.

 
The Shape.CreateBlend method returns an Effect object, the Effect.Blend property for which you can use to modify the created blend.
Applying contours

The Shape.CreateContour method applies a contour to a shape. This method provides optional parameters for various contour settings, such as the colors and acceleration of the contour.

The following VBA code creates a three-step contour at a five-millimeter spacing:

Dim eff As Effect
ActiveDocument.Unit = cdrMillimeter
Set eff = ActiveShape.CreateContour(cdrContourOutside, 5, 3)

 
The Shape.CreateContour method returns an Effect object, the Effect.Contour property for which you can use to modify the created contour.
Applying customized effects

The Shape.CreateCustomEffect method applies a customized effect to a shape. This method provides parameters for various effect settings.

 
The Shape.CreateCustomEffect method returns an Effect object, the Effect.Custom property for which you can use to modify the created effect.
Applying distortions

The following methods apply a distortion to a shape:

 
Shape.CreatePushPullDistortion — applies a Push-and-pull distortion
 
Shape.CreateTwisterDistortion — applies a Twister distortion
 
Shape.CreateZipperDistortion — applies a Zipper distortion
 
Shape.CreateCustomDistortion — applies a customized distortion

These methods provide parameters for various distortion settings.

 
The distortion-creation methods return an Effect object, the Effect.Distortion property for which you can use to modify the created distortion.

If you want, you can use event handlers to respond to events that are triggered by distorting a shape:

 
Document.ShapeDistort
Applying drop shadows

The Shape.CreateDropShadow method applies a drop shadow to a shape. This method provides optional parameters for various drop-shadow settings, such as the feathering and offset of the drop shadow.

 
The Shape.CreateDropShadow method returns an Effect object, the Effect.DropShadow property for which you can use to modify the created drop shadow.
Applying envelopes

The following methods apply an envelope to a shape:

 
Shape.CreateEnvelope — applies a basic envelope
 
Shape.CreateEnvelopeFromCurve — applies an envelope by using the specified curve as a template
 
Shape.CreateEnvelopeFromShape — applies an envelope by using the specified shape as a template

These methods provide parameters for various envelope settings.

 
The envelope-creation methods return an Effect object, the Effect.Envelope property for which you can use to modify the created envelope.
Applying extrusions

The Shape.CreateExtrude method applies an extrusion to a shape. This method provides optional parameters for various extrusion settings, such as the angle and color of the extrusion.

 
The Shape.CreateExtrude method returns an Effect object, the Effect.Extrude property for which you can use to modify the created extrusion.
Applying lenses

The Shape.CreateLens method applies a lens to a shape. This method provides optional parameters for various lens settings, such as the color and magnitude of the lens.

 
The Shape.CreateLens method returns an Effect object, the Effect.Lens property for which you can use to modify the created lens.
Applying perspective

The Shape.CreatePerspective method applies perspective to a shape. This method provides optional parameters for specifying horizontal and vertical vanishing points.

 
The Shape.CreatePerspective method returns an Effect object, the Effect.Perspective property for which you can use to modify the created perspective effect.

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.