AiLayerSection Class
The Ai format Layer Section
Inheritance Hierarchy
SystemObject
  Aspose.PSDDisposableObject
    Aspose.PSD.FileFormats.AiAiDataSection
      Aspose.PSD.FileFormats.AiAiLayerSection

Namespace: Aspose.PSD.FileFormats.Ai
Assembly: Aspose.PSD (in Aspose.PSD.dll) Version: 21.3
Syntax
public sealed class AiLayerSection : AiDataSection

The AiLayerSection type exposes the following members.

Properties
  NameDescription
Public propertyBlue
Gets or sets the blue color component.
Public propertyCode exampleColorNumber
Gets or sets the color number. -1 is the custom color value from Red, Green, Blue properties. Specifies the layer’s color setting.
Public propertyCode exampleDimValue
Gets or sets the dim value as percentage. Reduces the intensity of linked images and bitmap images contained in the layer to the specified percentage.
Public propertyDisposed
Gets a value indicating whether this instance is disposed.
(Inherited from DisposableObject.)
Public propertyGreen
Gets or sets the green color component.
Public propertyCode exampleIsImagesDimmed
Gets or sets a value indicating whether this layer is dimmed. Reduces the intensity of linked images and bitmap images contained in the layer.
Public propertyCode exampleIsLocked
Gets or sets a value indicating whether this layer is locked. Prevents changes to the item.
Public propertyCode exampleIsPreview
Gets or sets a value indicating whether this layer is preview. Displays the artwork contained in the layer in color instead of as outlines.
Public propertyCode exampleIsPrinted
Gets or sets a value indicating whether this layer is printed. Makes the artwork contained in the layer printable if true.
Public propertyCode exampleIsShown
Gets or sets a value indicating whether this layer is shown. Displays all artwork contained in the layer on the artboard if true.
Public propertyCode exampleIsTemplate
Gets or sets a value indicating whether this layer is a template layer.
Public propertyCode exampleName
Gets or sets the layer name. Specifies the name of the item as it appears in the Layers panel.
Public propertyCode exampleRasterImages
Gets the raster images.
Public propertyCode exampleRed
Gets or sets the red color component.
Methods
  NameDescription
Public methodAddRasterImage
Adds the raster image.
Public methodDispose
Disposes the current instance.
(Inherited from DisposableObject.)
Public methodEquals (Inherited from Object.)
Public methodGetData
Gets the string data.
(Inherited from AiDataSection.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
The following code demonstrates how to load settings of Raster Images in AI Format Files.
[C#]

const double DefaultTolerance = 1e-6;

void AssertIsTrue(bool condition, string message)
{
    if (!condition)
    {
        throw new FormatException(message);
    }
}

string sourceFile = "sample.ai";
using (AiImage image = (AiImage)Image.Load(sourceFile))
{
    AiLayerSection layer = image.Layers[0];

    AssertIsTrue(layer.RasterImages != null, "RasterImages property should be not null");
    AssertIsTrue(layer.RasterImages.Length == 1, "RasterImages property should contain exactly one item");

    AiRasterImageSection rasterImage = layer.RasterImages[0];
    AssertIsTrue(rasterImage.Pixels != null, "rasterImage.Pixels property should be not null");
    AssertIsTrue(rasterImage.Pixels.Length == 100, "rasterImage.Pixels property should contain exactly 100 items");
    AssertIsTrue((uint)rasterImage.Pixels[99] == 0xFFB21616, "rasterImage.Pixels[99] should be 0xFFB21616");
    AssertIsTrue((uint)rasterImage.Pixels[19] == 0xFF00FF00, "rasterImage.Pixels[19] should be 0xFF00FF00");
    AssertIsTrue((uint)rasterImage.Pixels[10] == 0xFF01FD00, "rasterImage.Pixels[10] should be 0xFF01FD00");
    AssertIsTrue((uint)rasterImage.Pixels[0] == 0xFF0000FF, "rasterImage.Pixels[0] should be 0xFF0000FF");
    AssertIsTrue(Math.Abs(0.999875 - rasterImage.Width) < DefaultTolerance, "rasterImage.Width should be 0.99987");
    AssertIsTrue(Math.Abs(0.999875 - rasterImage.Height) < DefaultTolerance, "rasterImage.Height should be 0.99987");
    AssertIsTrue(Math.Abs(387 - rasterImage.OffsetX) < DefaultTolerance, "rasterImage.OffsetX should be 387");
    AssertIsTrue(Math.Abs(379 - rasterImage.OffsetY) < DefaultTolerance, "rasterImage.OffsetY should be 379");
    AssertIsTrue(Math.Abs(0 - rasterImage.Angle) < DefaultTolerance, "rasterImage.Angle should be 0");
    AssertIsTrue(Math.Abs(0 - rasterImage.LeftBottomShift) < DefaultTolerance, "rasterImage.LeftBottomShift should be 0");
    AssertIsTrue(Math.Abs(0 - rasterImage.ImageRectangle.X) < DefaultTolerance, "rasterImage.ImageRectangle.X should be 0");
    AssertIsTrue(Math.Abs(0 - rasterImage.ImageRectangle.Y) < DefaultTolerance, "rasterImage.ImageRectangle.Y should be 0");
    AssertIsTrue(Math.Abs(10 - rasterImage.ImageRectangle.Width) < DefaultTolerance, "rasterImage.ImageRectangle.Width should be 10");
    AssertIsTrue(Math.Abs(10 - rasterImage.ImageRectangle.Height) < DefaultTolerance, "rasterImage.ImageRectangle.Height should be 10");
}
See Also