GradientFillSettings.GradientType
GradientFillSettings.GradientType property
Mendapat atau menyetel jenis gradien.
public GradientType GradientType { get; set; }
Nilai properti
Jenis gradien.
Contoh
Kode berikut menyimpan gambar dengan berbagai jenis gradien dan menunjukkan cara Aspose.PSD menggambar gradien.
[C#]
string fileName = "FillLayerGradient.psd";
string sourceFile = fileName;
GradientType[] gradientTypes = new[]
{
GradientType.Linear, GradientType.Radial, GradientType.Angle, GradientType.Reflected, GradientType.Diamond
};
using (var image = Image.Load(sourceFile))
{
PsdImage psdImage = (PsdImage)image;
FillLayer fillLayer = (FillLayer)psdImage.Layers[0];
GradientFillSettings fillSettings = (GradientFillSettings)fillLayer.FillSettings;
foreach (var gradientType in gradientTypes)
{
fillSettings.GradientType = gradientType;
fillLayer.Update();
string resultFile = fileName + "_" + gradientType.ToString() + ".png";
resultFile = resultFile;
psdImage.Save(resultFile, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
}
Lihat juga
- enum GradientType
- class GradientFillSettings
- ruang nama Aspose.PSD.FileFormats.Psd.Layers.FillSettings
- perakitan Aspose.PSD