Class ColorFillSettings
Contenuti
[
Nascondere
]ColorFillSettings class
Impostazioni effetto riempimento colore
public class ColorFillSettings : BaseFillSettings, IColorFillSettings
Proprietà
Nome | Descrizione |
---|---|
Color { get; set; } | Ottiene o imposta il colore. |
override FillType { get; } | Il tipo di riempimento |
Esempi
Il codice seguente dimostra il supporto del livello dell’effetto tratto con il tipo di riempimento Colore.
[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);
}
// Prova il file dopo la modifica
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);
}
Guarda anche
- class BaseFillSettings
- interface IColorFillSettings
- spazio dei nomi Aspose.PSD.FileFormats.Psd.Layers.FillSettings
- assemblea Aspose.PSD