Enum StrokePosition
StrokePosition enumeration
Pengaturan posisi mengontrol perataan goresan Anda ke lapisan yang diterapkan diStrokeEffect
.
public enum StrokePosition : short
Nilai
Nama | Nilai | Keterangan |
---|---|---|
Inside | 0 | Goresan akan dibuat dari tepi bentuk dan tumbuh ke dalam, ke tengah objek. |
Center | 1 | Goresan akan dibuat dari tepi bentuk dan tumbuh ke dalam dan ke luar. |
Outside | 2 | Goresan akan dibuat dari tepi bentuk dan akan melebar keluar, menjauh dari objek. |
Contoh
Contoh ini mendemonstrasikan kemampuan untuk menambahkan efek goresan dengan berbagai jenis isian seperti Warna, Gradien, atau Pola.
[C#]
using (var psdImage = (PsdImage)Image.Load(srcFile, new PsdLoadOptions() { LoadEffectsResource = true }))
{
StrokeEffect strokeEffect;
IColorFillSettings colorFillSettings;
IGradientFillSettings gradientFillSettings;
IPatternFillSettings patternFillSettings;
// 1. Menambahkan isian Warna, pada posisi Di dalam
strokeEffect = psdImage.Layers[1].BlendingOptions.AddStroke(FillType.Color);
strokeEffect.Size = 7;
strokeEffect.Position = StrokePosition.Inside;
colorFillSettings = strokeEffect.FillSettings as IColorFillSettings;
colorFillSettings.Color = Color.Green;
// 2. Menambahkan isian Warna, pada posisi Luar
strokeEffect = psdImage.Layers[2].BlendingOptions.AddStroke(FillType.Color);
strokeEffect.Size = 7;
strokeEffect.Position = StrokePosition.Outside;
colorFillSettings = strokeEffect.FillSettings as IColorFillSettings;
colorFillSettings.Color = Color.Green;
// 3. Menambahkan isian Warna, di posisi Tengah
strokeEffect = psdImage.Layers[3].BlendingOptions.AddStroke(FillType.Color);
strokeEffect.Size = 7;
strokeEffect.Position = StrokePosition.Center;
colorFillSettings = strokeEffect.FillSettings as IColorFillSettings;
colorFillSettings.Color = Color.Green;
// 4. Menambahkan Gradient fill, pada posisi Inside
strokeEffect = psdImage.Layers[4].BlendingOptions.AddStroke(FillType.Gradient);
strokeEffect.Size = 5;
strokeEffect.Position = StrokePosition.Inside;
gradientFillSettings = strokeEffect.FillSettings as IGradientFillSettings;
gradientFillSettings.AlignWithLayer = false;
gradientFillSettings.Angle = 90;
// 5. Menambahkan pengisian Gradien, pada posisi Luar
strokeEffect = psdImage.Layers[5].BlendingOptions.AddStroke(FillType.Gradient);
strokeEffect.Size = 5;
strokeEffect.Position = StrokePosition.Outside;
gradientFillSettings = strokeEffect.FillSettings as IGradientFillSettings;
gradientFillSettings.AlignWithLayer = true;
gradientFillSettings.Angle = 90;
// 6. Menambahkan pengisian Gradien, di posisi Tengah
strokeEffect = psdImage.Layers[6].BlendingOptions.AddStroke(FillType.Gradient);
strokeEffect.Size = 5;
strokeEffect.Position = StrokePosition.Center;
gradientFillSettings = strokeEffect.FillSettings as IGradientFillSettings;
gradientFillSettings.AlignWithLayer = true;
gradientFillSettings.Angle = 0;
// 7. Menambahkan isian Pola, pada posisi Di dalam
strokeEffect = psdImage.Layers[7].BlendingOptions.AddStroke(FillType.Pattern);
strokeEffect.Size = 5;
strokeEffect.Position = StrokePosition.Inside;
patternFillSettings = strokeEffect.FillSettings as IPatternFillSettings;
patternFillSettings.Scale = 200;
// 8. Menambahkan isian Pola, pada posisi Luar
strokeEffect = psdImage.Layers[8].BlendingOptions.AddStroke(FillType.Pattern);
strokeEffect.Size = 10;
strokeEffect.Position = StrokePosition.Outside;
patternFillSettings = strokeEffect.FillSettings as IPatternFillSettings;
patternFillSettings.Scale = 100;
// 9. Menambahkan isian Pola, di posisi Tengah
strokeEffect = psdImage.Layers[9].BlendingOptions.AddStroke(FillType.Pattern);
strokeEffect.Size = 10;
strokeEffect.Position = StrokePosition.Center;
patternFillSettings = strokeEffect.FillSettings as IPatternFillSettings;
patternFillSettings.Scale = 75;
psdImage.Save(outputFilePng, new PngOptions());
}
Lihat juga
- ruang nama Aspose.PSD.FileFormats.Psd.Layers.LayerEffects
- perakitan Aspose.PSD