I'm trying to dynamically add layers in a Photoshop script via JavaScript. The layers have a circular selection, not rectangular or triangular.
For example rectangular:
var RectangleSelection = Array(
Array(x, y), // start position
Array(x + width, y), // right top
Array(x + width, y + height), // right bottom
Array(x, y + height), // left bottom
Array(x, y) // left top
);
I want to do the same now with a circular selection, maybe with a function like this? I'm stuck how to define the function:
var circleSelection = makeCircleSelection(x,y,radius);
And return it in a selection which I can then place on a new layer:
var layer = document.artLayers.add();
document.selection.select(circleSelection);
document.selection.copy();
document.paste();
The docs don't have an answer and this answer I find difficult for my use case.