PtFlResource.IsLinkedWithLayer
PtFlResource.IsLinkedWithLayer property
Mendapat atau menetapkan nilai yang menunjukkan apakah instance ini ditautkan dengan layer.
public bool IsLinkedWithLayer { get; set; }
Nilai properti
BENAR
jika instance ini ditautkan dengan layer; jika tidak,PALSU
.
Contoh
Contoh berikut menunjukkan dukungan pemuatan dan pengeditan sumber daya PtFlResource.
[C#]
string sourceFileName = "PatternFillLayer.psd";
string exportPath = "PtFlResource_Edited.psd";
double tolerance = 0.0001;
var im = (PsdImage)Image.Load(sourceFileName);
using (im)
{
foreach (var layer in im.Layers)
{
if (layer is FillLayer)
{
var fillLayer = (FillLayer)layer;
var resources = fillLayer.Resources;
foreach (var res in resources)
{
if (res is PtFlResource)
{
// Membaca
PtFlResource resource = (PtFlResource)res;
if (
resource.Offset.X != -46 ||
resource.Offset.Y != -45 ||
resource.PatternId != "a6818df2-7532-494e-9615-8fdd6b7f38e5\0" ||
resource.PatternName != "$$$/Presets/Patterns/OpticalSquares=Optical Squares\0" ||
resource.AlignWithLayer != true ||
resource.IsLinkedWithLayer != true ||
!(Math.Abs(resource.Scale - 50) < tolerance))
{
throw new Exception("PtFl Resource was read incorrect");
}
// Mengedit
resource.Offset = new Point(-11, 13);
resource.Scale = 200;
resource.AlignWithLayer = false;
resource.IsLinkedWithLayer = false;
fillLayer.Resources = fillLayer.Resources;
// Kami tidak memiliki data pola di PattResource, jadi kami dapat menambahkannya.
var fillSettings = (PatternFillSettings)fillLayer.FillSettings;
fillSettings.PatternData = new int[]
{
Color.Black.ToArgb(),
Color.White.ToArgb(),
Color.White.ToArgb(),
Color.White.ToArgb(),
};
fillSettings.PatternHeight = 1;
fillSettings.PatternWidth = 4;
fillSettings.PatternName = "$$$/Presets/Patterns/VerticalLine=Vertical Line New\0";
fillSettings.PatternId = Guid.NewGuid().ToString() + "\0";
fillLayer.Update();
}
break;
}
break;
}
}
im.Save(exportPath);
}
Lihat juga
- class PtFlResource
- ruang nama Aspose.PSD.FileFormats.Psd.Layers.LayerResources
- perakitan Aspose.PSD