Ich habe Probleme in einer sehr einfachen Aufgabe in Photoshop-Skript, aber ich fürchte, das ist nicht an anderer Stelle im Web dokumentiert.Wie man eine Ebene in Photoshop-Skript zuschneidet
Ich möchte nur eine vorhandene Auswahl invertieren, den Inhalt der aktuellen Ebene löschen und dann die Auswahl invertieren.
Natürlich ist dies Teil eines größeren Programms, und wenn Sie interessiert sind, kann ich alle Details zur Verfügung stellen. Up
zu wissen, ich mache:
// Get current document and current layer
var doc = app.activeDocument;
var activeLay = doc.activeLayer;
var a=0
// find the current layer and assign its code to the variable a
for(i=doc.layers.length-1; i >=0;)
{
if(doc.layers[i]==activeLay)
{
a=i;
alert("a"+a);
break;
}
else{ i--; }
alert ("i"+i);
}
// Now cycle remaining layer under the exsiting one, and jump the selection
// and delete the outer area of selection for each layer
for(i=a-1; i >=0;)
{
// make layer i active
doc.activeLayer=doc.layers[i];
alert ("active layer"+i);
// where is my selection in regards to the active layer?
var s = app.activeDocument.selection.bounds;
var xSo=s[0];
var ySo=s[1];
var xLo = activeLay.bounds[0].value;
var yLo = activeLay.bounds[1].value;
// I have to go from actual selection poisition to the NEXT layer... which i just made active...
DeltaX=xLo-s[0];
DeltaY=ySo-s[1];
doc.selection.translateBoundary(DeltaX,DeltaY);
//Now invert selection and delete
doc.selection.invert
doc.selection.fill (fillType, mode, 0, preserveTransparency) // ??? here what i cannot do?
doc.selection.invert
i--;
}
Hinweis: Sie machen globale Variablen in Ihren For-Schleifen. – gcampbell
Danke, aber ist kein großes Problem, denke ich ... –