Class ColorFillSettings
isi
[
bersembunyi
]ColorFillSettings class
Pengaturan efek isian warna
public class ColorFillSettings : BaseFillSettings, IColorFillSettings
Properti
Nama | Keterangan |
---|---|
Color { get; set; } | Mendapat atau mengatur warna. |
override FillType { get; } | Jenis isian |
Contoh
Kode berikut menunjukkan dukungan dari layer efek stroke dengan tipe isian - Warna.
[C#]
void AssertAreEqual(object expected, object actual, string message = null)
{
if (!object.Equals(expected, actual))
{
throw new FormatException(message ?? "Objects are not equal.");
}
}
var sourceFileName = "Stroke.psd";
var exportPath = "StrokeColorChanged.psd";
var loadOptions = new PsdLoadOptions()
{
LoadEffectsResource = true
};
using (var im = (PsdImage)Image.Load(sourceFileName, loadOptions))
{
var colorStroke = (StrokeEffect)im.Layers[1].BlendingOptions.Effects[0];
AssertAreEqual(BlendMode.Normal, colorStroke.BlendMode);
AssertAreEqual((byte)255, colorStroke.Opacity);
AssertAreEqual(true, colorStroke.IsVisible);
var fillSettings = (ColorFillSettings)colorStroke.FillSettings;
AssertAreEqual(Color.Black, fillSettings.Color);
AssertAreEqual(FillType.Color, fillSettings.FillType);
fillSettings.Color = Color.Yellow;
colorStroke.Opacity = 127;
colorStroke.BlendMode = BlendMode.Color;
im.Save(exportPath);
}
// Uji file setelah diedit
using (var im = (PsdImage)Image.Load(exportPath, loadOptions))
{
var colorStroke = (StrokeEffect)im.Layers[1].BlendingOptions.Effects[0];
AssertAreEqual(BlendMode.Color, colorStroke.BlendMode);
AssertAreEqual((byte)127, colorStroke.Opacity);
AssertAreEqual(true, colorStroke.IsVisible);
var fillSettings = (ColorFillSettings)colorStroke.FillSettings;
AssertAreEqual(Color.Yellow, fillSettings.Color);
AssertAreEqual(FillType.Color, fillSettings.FillType);
}
Lihat juga
- class BaseFillSettings
- interface IColorFillSettings
- ruang nama Aspose.PSD.FileFormats.Psd.Layers.FillSettings
- perakitan Aspose.PSD