Index

PowerDoc Objects

Slice

Overview

This object represents a slice. In Power Engine API, a slice is a piece of a circle or an ellipse. Slices are frequently used to draw pie charts in financial charts and presentations.

While constructing the Slice object, an optional shadow and/or outline may be specified.

Designated Rendering Function: pdDrawSlice (8)

Note: Although pdBodyPtr is a key link, it is not mandatory. This means it is possible to construct a slice that has no body, only an outline and/or a shadow.

pdBodyPtr (1013)

Also appears in: Typography (For Outline Fonts), Row Boundary, Typographic Frame, Library Shape, Rectangle, Circle/Ellipse, True Circle/Ellipse, Pattern, Grid, Custom Shape or Polygon, Gradient, Gradient (As Fast Rectangle)

Link to the Surface Definition object.

This link supplies style attributes for the body of an object. Style attributes include color, transparency, pattern fills, special effects (e.g. blur, emboss, pattern fill) etc.

pdOutlinePtr (1014)

Also appears in: Typography (For Outline Fonts), Row Boundary, Typographic Frame, Library Shape, Rectangle, Circle/Ellipse, True Circle/Ellipse, Grid, Custom Shape or Polygon

Link to the Outline Definition object.

This link supplies parameters necessary to render the outline of an object.

pdShadowPtr (1016)

Also appears in: Typography (For Outline Fonts), Baseline, Row Boundary, Typographic Frame, Library Polyline, Library Shape, Line, Rectangle, Circle/Ellipse, True Circle/Ellipse, Arc, Grid, Custom Shape or Polygon, Polyline (also Bezier and B-Spline curve)

Link to the Shadow Definition object.

Used to render the shadow of a line, shape or some other object.

Properties

pdRadiusHor (1035)   PD_LONG_SIGNED

Also appears in: True Circle/Ellipse, Arc

Horizontal radius in document units. Must be positive.

Sample values:

500 = Horizontal radius of 500 document units
800 = Horizontal radius of 800 document units

pdRadiusVer (1036)   PD_LONG_SIGNED

Also appears in: True Circle/Ellipse, Arc

Vertical radius in document units. Must be positive.

Sample values:

500 = Vertical radius of 500 document units
800 = Vertical radius of 800 document units

pdAngleAlpha (1032)   PD_WORD_UNSIGNED

Also appears in: Text Arc, Rich Text Arc, Arc

Initial (start) angle in degrees. Must be between 0 and 360.

Sample values:

0 = Angle of 0 degrees
90 = Angle of 90 degrees

pdAngleTheta (1037)   PD_WORD_SIGNED

Also appears in: Arc

Length of an arc in degrees. Must be between 0 and 360.

Sample values:

180 = Length of 180 degrees
240 = Length of 240 degrees

Example

C/C++

DT_ID_SLONG obj[6];

obj[0] = pdObjAdd(pd, 0, "Slice Outline Style");
obj[1] = pdObjAdd(pd, 0, "Slice Body Style");
obj[2] = pdObjAdd(pd, 0, "Slice Shadow Style");
obj[3] = pdObjAdd(pd, 0, "Slice Outline");
obj[4] = pdObjAdd(pd, 0, "Slice Shadow");
obj[5] = pdObjAdd(pd, 0, "Slice");

/* Properties for object 0 */
pdPropAdd(pd, obj[0], pdRGBT, "50641400", PD_HEX);

/* Properties for object 1 */
pdPropAdd(pd, obj[1], pdRGBT, "B4961400", PD_HEX);

/* Properties for object 2 */
pdPropAdd(pd, obj[2], pdRGBT, "80808078", PD_HEX);

/* Properties for object 3 */
pdLinkAdd(pd, obj[3], pdStylePtr, obj[0]);
pdPropAdd(pd, obj[3], pdLineThickness, "240", PD_WORD_SIGNED);

/* Properties for object 4 */
pdLinkAdd(pd, obj[4], pdStylePtr, obj[2]);
pdPropAdd(pd, obj[4], pdShadowDx, "5", PD_WORD_SIGNED);
pdPropAdd(pd, obj[4], pdShadowDy, "5", PD_WORD_SIGNED);

/* Properties for object 5 */
pdLinkAdd(pd, obj[5], pdBodyPtr, obj[1]);
pdLinkAdd(pd, obj[5], pdOutlinePtr, obj[3]);
pdLinkAdd(pd, obj[5], pdShadowPtr, obj[4]);
pdPropAdd(pd, obj[5], pdRadiusHor, "300", PD_LONG_SIGNED);
pdPropAdd(pd, obj[5], pdRadiusVer, "125", PD_LONG_SIGNED);
pdPropAdd(pd, obj[5], pdAngleAlpha, "210", PD_WORD_UNSIGNED);
pdPropAdd(pd, obj[5], pdAngleTheta, "120", PD_WORD_SIGNED);


/* Image placement */
pdImgAdd(pd, obj[5], 0, 350, 150, 0, 0, 0, pdDrawSlice, DV_NULL);

INTEGRAL DSL

/* Lambda shortcuts */

local o = @(label = "") CDTObj(::my.doc, label); /* to make object */
local p = @(id, str, len = PD_DEFAULT) CDTProp(id, str, len); /* to add property - general */
local s = @(id, str) CDTPropStr(id, str); /* to add property - string */
local i = @(id, num) CDTPropInt(id, num); /* to add property - integer */
local l = @(id, obj) CDTLink(id, obj); /* to add link */

/* Objects */

local obj_0 = o("Slice Outline Style");
local obj_1 = o("Slice Body Style");
local obj_2 = o("Slice Shadow Style");
local obj_3 = o("Slice Outline");
local obj_4 = o("Slice Shadow");
local obj_5 = o("Slice");

/* Object Properties */

obj_0 + s(pdRGBT, "50641400");

obj_1 + s(pdRGBT, "B4961400");

obj_2 + s(pdRGBT, "80808078");

obj_3 + l(pdStylePtr, obj_0);
obj_3 + i(pdLineThickness, 240);

obj_4 + l(pdStylePtr, obj_2);
obj_4 + i(pdShadowDx, 5);
obj_4 + i(pdShadowDy, 5);

obj_5 + l(pdBodyPtr, obj_1);
obj_5 + l(pdOutlinePtr, obj_3);
obj_5 + l(pdShadowPtr, obj_4);
obj_5 + i(pdRadiusHor, 300);
obj_5 + i(pdRadiusVer, 125);
obj_5 + i(pdAngleAlpha, 210);
obj_5 + i(pdAngleTheta, 120);

/* Image Pinning */

obj_5.Pin(0, 350, 150, pdDrawSlice);
 

Index