• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

fill enclosed path with customized color use java script

New Here ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

I found a method in pathitem class named fillPath. I tried it but nothing happened. Please help!

 

var myPathItem = doc.pathItems.add("myPath", lineSubPathArray);
var scolor = new SolidColor();
scolor.rgb.red = 173;
scolor.rgb.green = 41;
scolor.rgb.blue = 30;
myPathItem.fillPath(scolor, ColorBlendMode.NORMAL);
alert("111");
myPathItem.strokePath(ToolType.BRUSH);

 

I think my 'mypathitem' is right, cause without fillpath function, the strokepath function gives the right answer.

TOPICS
Actions and scripting

Views

333

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 13, 2021 Jan 13, 2021

myPathItem.fillPath(scolor,ColorBlendMode.NORMAL,100,false,0,true,true);

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

That seems to be a Photoshop question - is it, or not?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Yes. Sorry I should give more details.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

This is the Using the Community forum (which is the forum for issues using the forums).
Please tell us what Adobe application you are using so that this can be moved to the proper forum for help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Sorry, I'm using photoshop js scripting. The photoshop version is 20.0.4.

Below is my all of my code.

//app.displayDialogs = DialogModes.NO

function DrawShape(points) {
    while (app.documents.length) {
        app.activeDocument.close(SaveOptions.DONOTSAVECHANGES) //do not save anything we did 
    }
    var doc = app.documents.add(256, 256, 72, "triangle", NewDocumentMode.RGB, DocumentFill.TRANSPARENT);
    var lineSubPathArray = new Array();
    for (var j = 0; j < points.length; j++) {
        var lineArray = new Array();
        for (var i = 0; i < points[j].length; i++) {
            lineArray[i] = new PathPointInfo;
            lineArray[i].kind = PointKind.CORNERPOINT;
            lineArray[i].anchor = points[j][i];
            lineArray[i].leftDirection = lineArray[i].anchor;
            lineArray[i].rightDirection = lineArray[i].anchor;
        }
        lineSubPathArray[j] = new SubPathInfo()
        lineSubPathArray[j].closed = true;
        lineSubPathArray[j].operation = ShapeOperation.SHAPEXOR;
        lineSubPathArray[j].entireSubPath = lineArray;
        var myPathItem = doc.pathItems.add("myPath", lineSubPathArray);
        var scolor = new SolidColor();
        scolor.rgb.red = 173;
        scolor.rgb.green = 41;
        scolor.rgb.blue = 30;
        myPathItem.fillPath([scolor]);
        // myPathItem.fillPath(scolor)
        // myPathItem.strokePath(ToolType.BRUSH);
    }
}

// app.displayDialogs = DialogModes.NO
DrawShape([
    [
        [0, 0],
        [0, 256],
        [256, 0]
    ]
])
app.displayDialogs = DialogModes.ALL

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

Since the Scripting sub forums no longer exists ...

[ moved to Photoshop forum ]

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

Since the Scripting sub forums no longer exists ...

 

The Photoshop Scripting sub-forum was brought back as the "Actions and Scripting" topic:

 

https://community.adobe.com/t5/photoshop/bd-p/photoshop?page=1&sort=latest_replies&filter=all&topics...

 

We even got the old messages from that topic out of the archive.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

LATEST

myPathItem.fillPath(scolor,ColorBlendMode.NORMAL,100,false,0,true,true);

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines