LayerGroup.AddLayer
LayerGroup.AddLayer method
将图层添加到图层组。
public void AddLayer(Layer layer)
范围 | 类型 | 描述 |
---|---|---|
layer | Layer | 图层。 |
例子
以下示例演示了如何将 Bmp、Jpeg、Jpeg2000、Png、Psd、Tiff、Gif 图像作为图层添加到 PsdImage
[C#]
string outputFilePath = "PsdResult.psd";
var filesList = new string[]
{
"PsdExample.psd",
"BmpExample.bmp",
"GifExample.gif",
"Jpeg2000Example.jpf",
"JpegExample.jpg",
"PngExample.png",
"TiffExample.tif",
};
using (var image = new PsdImage(200, 200))
{
foreach (var fileName in filesList)
{
string filePath = fileName;
using (var stream = new FileStream(filePath, FileMode.Open))
{
Layer layer = null;
try
{
layer = new Layer(stream);
image.AddLayer(layer);
}
catch (Exception e)
{
if (layer != null)
{
layer.Dispose();
}
throw e;
}
}
}
image.Save(outputFilePath);
}
也可以看看
- class Layer
- class LayerGroup
- 命名空间 Aspose.PSD.FileFormats.Psd.Layers
- 部件 Aspose.PSD