Interface IPatternFillSettings

IPatternFillSettings interface

Interface for Pattern fill settings

public interface IPatternFillSettings : IFillSettings

Properties

NameDescription
Angle { get; set; }Gets or sets the angle.
HorizontalOffset { get; set; }Gets or sets the horizontal offset.
Linked { get; set; }Gets or sets a value indicating whether this IPatternFillSettings is linked.
PatternData { get; set; }Gets or sets the pattern data.
PatternHeight { get; set; }Gets or sets the height of the pattern.
PatternId { get; set; }Gets or sets the pattern identifier.
PatternName { get; set; }Gets or sets the name of the pattern.
PatternWidth { get; set; }Gets or sets the width of the pattern.
PointType { get; set; }Gets or sets the type of the point.
Scale { get; set; }Gets or sets the scale.
VerticalOffset { get; set; }Gets or sets the vertical offset.

Examples

The following code saves images with pattern Fill Layer and demonstrates how Aspose.PSD renders the pattern.

[C#]

string sourceFile = "sample.psd";
string outputFile = "sample_out.psd";
string outputPngFile = "sample_out.png";

// Load an existing image into an instance of PsdImage class
using (var image = (PsdImage)Image.Load(sourceFile))
{
    foreach (var layer in image.Layers)
    {
        if (layer is FillLayer)
        {
            var fillLayer = (FillLayer)layer;
            var settings = (IPatternFillSettings)fillLayer.FillSettings;
            settings.HorizontalOffset = -5;
            settings.VerticalOffset = 12;
            settings.Scale = 300;
            settings.Linked = true;
            settings.PatternData = new int[]
                                       {
                                           Color.Black.ToArgb(), Color.Red.ToArgb(),
                                           Color.Green.ToArgb(), Color.Blue.ToArgb(),
                                           Color.White.ToArgb(), Color.AliceBlue.ToArgb(),
                                           Color.Violet.ToArgb(), Color.Chocolate.ToArgb(),
                                           Color.IndianRed.ToArgb(), Color.DarkOliveGreen.ToArgb(),
                                           Color.CadetBlue.ToArgb(), Color.YellowGreen.ToArgb(),
                                           Color.Black.ToArgb(), Color.Azure.ToArgb(),
                                           Color.ForestGreen.ToArgb(), Color.Sienna.ToArgb(),
                                       };

            settings.PatternHeight = 4;
            settings.PatternWidth = 4;

            settings.PatternName = "$$$/Presets/Patterns/ColorfulSquare=Colorful Square New\0";
            settings.PatternId = Guid.NewGuid().ToString() + "\0";

            fillLayer.Update();
            break;
        }
    }

    image.Save(outputFile, new PsdOptions(image));
    image.Save(outputPngFile, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

See Also