Copy link to clipboard
Copied
I want to draw a custom shape using scripting. I can create a path, but how do I make it into a "shape" with a fill?
function make_path_object(points) {
var lineArr =[];
for(x=0; x<points.length; x++) {
lineArr
lineArr
lineArr
lineArr
lineArr
}
var lineSubPathArray = new Array();
lineSubPathArray[0] = new SubPathInfo();
lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR;
lineSubPathArray[0].closed = true;
lineSubPathArray[0].entireSubPath = lineArr;
var myPathItem = docRef.pathItems.add('a line', lineSubPathArray);
return myPathItem;
}
make_path_object([[0,0],[10,0],[10,10],[0,10]]);
There is a scripting forum you should ask in. When you do ask the question and provide more information on what you trying to do. Do you want to create a shape layer you would need to add a solid color fill layer and add the path you created to the as a vector mask. If you want to fill the pat area on the current layer convert the path to a selection and fill the selection.
You can also define the path as a custom shape then add a the custom shape layer.
I did that in this sc
...Copy link to clipboard
Copied
Moving this thread to :Photoshop Scripting
Copy link to clipboard
Copied
There is a scripting forum you should ask in. When you do ask the question and provide more information on what you trying to do. Do you want to create a shape layer you would need to add a solid color fill layer and add the path you created to the as a vector mask. If you want to fill the pat area on the current layer convert the path to a selection and fill the selection.
You can also define the path as a custom shape then add a the custom shape layer.
I did that in this script http://www.mouseprints.net/old/dpr/potrace.jsx
Copy link to clipboard
Copied
Thanks JJMack, that worked!
Copy link to clipboard
Copied
You can use Action Manager code (as recorded with ScriptingListener.plugin) for the creation of the Solid Color Layer.