ShapeGroup
subclass of Shape
A shape group object. Although a shape group is a subclass of Shape, it is actually a container of multiple shape objects.
Shapes
Creating Shapes
Type
addPathShape:
returns PathShape; input Path
Creates and returns a new path shape, adding it to the group.
Example: create a triangle path shape
var doc = [app activeDocument]
var path = [doc addPath]
[path addMoveTo:CGPointMake(25, 150)]
[path addLineTo:CGPointMake(75, 50)]
[path addLineTo:CGPointMake(125, 150)]
[path addClose]
[[doc activeLayer] addPathShape:path]
addTextShape:
returns TextShape; input NSAttributedString
Creates and returns a new text shape, adding it to the group.
Example: create a text shape styled with a 24pt system bold font
var layer = [[app activeDocument] activeLayer]
var font = [NSFont boldSystemFontOfSize:24]
var dict = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]
var str = [[NSAttributedString alloc] initWithString:"Hello World!" attributes:dict]
var textShape = [layer addTextShape:str]
textShape.position = CGPointMake(120, 100)
[str release]
groupShapes:
returns Shape Group; input Array
Creates and returns a new Shape Group object containing all of the shapes in the passed-in array. The shapes are moved within the group. The input shapes must already be direct descendants of the target group when this function is called.
Example: create a group containing all of the shapes in the active layer
var layer = [[app activeDocument] activeLayer]
var shapes = [layer shapes]
[layer groupShapes:shapes]
shapes
returns Array
Gets the array of shapes in the group.
Example: rotate each shape in the active layer by 90 degrees
var doc = [app activeDocument]
var shapes = [[doc activeLayer] shapes]
for(var i = 0; i < [shapes count]; i++)
[(shapes[i]) rotate:90]
type
returns String
Gets the type of this shape - "group"
Next: PathShape
