Figures

There are five figure types: Cx.Text, Cx.Shape, Cx.Raster, Cx.Group and Cx.ProxyGroup. They all share the same base: Cx.Figure. These are the common properties and functions.

Properties

Properties Type Def Definition
name String null Figure name
xType String 'CadX.Figure' Figure type
pen Pen empty Figure outline
brush Brush empty Figure fill
alpha 0…1 1 Global alpha
locked Boolean false If true, the figure can not be selected
hidden Boolean false If true, the figure is not visible
visible Boolean true Opposite of hidden
anchor Anchor Relative (0.5,0.5) Figure anchor generator
preMatrix22 Matrix22 Identity Transformation applied before processes
processes Process Array [] Figure effects
matrix22 Matrix22 Identity Figure transformation
pin Point (0, 0) Figure position
powerClipContents PowerClipContent Array [] Power clipped figures
metadata Metadata empty App metadata

Read only properties

Properties Type Def Definition
localId Integer unique Client based unique id, not serialized
canBeSelected Boolean true Is visible and is not locked
outputFigure Figure null Processed figure output
grouped Boolean false The figure is inside a group
isEmpty Boolean false Text with no lines, shape with not polyregions, group with no figures
layer Layer - Layer the figure is part of
topFigure Figure - Top input figure, i.e. main group

Functions

f.clone();
f.toXml();
f.toXmlString();
f.lock();
f.commit$();
f.revert$();
f.update$();
f.invalidate();
f.invalidated();
f.processed();
f.currentlyProcessing();

Transformations

f.translate(offset);
f.translate(dx,dy);
f.scaleFrom(point,sx,sy,deg);
f.rotateAround(point,angle);
f.shearAround(point,sx,sy,deg);
f.transform(matrix);
f.angle();
f.angle(angle,pivot);
f.rotate$(angle);
f.scale$(sx,sy);
f.mirrorX$();
f.mirrorY$();
f.align$(alignment,to,margin);
f.fit$(bounds,config);
f.setSize$({ width, height, locked, pin });
// Options 'nothing', 'bounds', 'center', 'width', 'frame', 'frameCenter', 'frameWidth':
f.modifyKeeping$(what,func);

Color interface

f.setTaggedColors(tag,color);
f.setLabeledColors(label,color);
f.getColors();
f.replaceColor(oldColor,newColor,config);
f.uniqueColorZones(options);
f.changeColorZone(zone,value);
f.getBrushes();
f.replaceBrush(oldBrush,newBrush);
f.uniqueBrushZones(options,zones);
f.changeBrushZone(zone,value);

Power Clip

f.extractPowerClipContents();

Xml CDL

Cx.Figure.fromXml(node);
Cx.Figure.fromXmlString(string);

Conditions

Cx.Figure.condition(name,function(figure){ return boolean });
Cx.Figure.arrayCondition(name,function(figures){ return boolean });
Cx.Figure.saveConditions();
Cx.Figure.restoreConditions();