PSD文档处理工具Aspose.PSD3月功能更新,示例解析教你如何改善图层组的体验

Aspose.PSD for .Net更新至新版本v21.3,添加SectionDividerLayer以改善图层组的体验,欢迎下载体验。

Aspose.PSD for .Net更新至新版本v21.3,添加SectionDividerLayer以改善图层组的体验,修复笔画效果属性未保存到PSD文件等问题。

>>你可以点击这里下载Aspose.PSD for .NET v21.3试体验。

整合所有格式API处理控件Aspose.Total永久授权火热促销中,联系客服立马1分钟了解全部!

具体更新内容

key 概述 类别
PSDNET-823 添加SectionDividerLayer以改善图层组的体验 增强功能
PSDNET-694 读取PattResource时,宽度和高度已交换 Bug修复
PSDNET-789 不正确的混合超过一层效果 Bug修复
PSDNET-805 层效应不止一个时的混合顺序和逻辑不正确 Bug修复
PSDNET-842 笔画效果属性未保存到PSD文件 Bug修复

新功能解析

PSDNET-823——添加SectionDividerLayer以改善图层组的体验

// The following code demonstrates SectionDividerLayer layers and how to get the related to it LayerGroup.            // Layers hierarchy            //    [0]: '' SectionDividerLayer for Group 1            //    [1]: 'Layer 1' Regular Layer            //    [2]: '' SectionDividerLayer for Group 2            //    [3]: '' SectionDividerLayer for Group 3            //    [4]: 'Group 3' GroupLayer            //    [5]: 'Group 2' GroupLayer            //    [6]: 'Group 1' GroupLayer            void AssertAreEqual(object expected, object actual, string message = null)            {                if (!object.Equals(expected, actual))                {                    throw new FormatException(message  "Objects are not equal.");                }            }            using (var image = new PsdImage(100, 100))            {                // Creating layers hierarchy                // Add the LayerGroup 'Group 1'                LayerGroup group1 = image.AddLayerGroup("Group 1", 0, true);                // Add regular layer                Layer layer1 = new Layer();                layer1.DisplayName = "Layer 1";                group1.AddLayer(layer1);                // Add the LayerGroup 'Group 2'                LayerGroup group2 = group1.AddLayerGroup("Group 2", 1);                // Add the LayerGroup 'Group 3'                LayerGroup group3 = group2.AddLayerGroup("Group 3", 0);                // Gets the SectionDividerLayer's                SectionDividerLayer divider1 = (SectionDividerLayer)image.Layers[0];                SectionDividerLayer divider2 = (SectionDividerLayer)image.Layers[2];                SectionDividerLayer divider3 = (SectionDividerLayer)image.Layers[3];                // using the SectionDividerLayer.GetRelatedLayerGroup() method, obtains the related LayerGroup instance.                AssertAreEqual(group1.DisplayName, divider1.GetRelatedLayerGroup().DisplayName); // the same LayerGroup                AssertAreEqual(group2.DisplayName, divider2.GetRelatedLayerGroup().DisplayName); // the same LayerGroup                AssertAreEqual(group3.DisplayName, divider3.GetRelatedLayerGroup().DisplayName); // the same LayerGroup                LayerGroup folder1 = divider1.GetRelatedLayerGroup();                AssertAreEqual(5, folder1.Layers.Length); // 'Group 1' contains 5 layers            }

PSDNET-694——读取PattResource时,宽度和高度已交换

  string sourceFile = "Untitled-1.psd";            string outputFile = "output.png";            using (var image = (PsdImage)Image.Load(sourceFile))            {                var fillLayer = (FillLayer)image.Layers[1];                fillLayer.Update(); // invoke pattern rendering                image.Save(outputFile, new PngOptions());            }

PSDNET-842——修复笔画效果属性未保存到PSD文件

  void AssertAreEqual(object expected, object actual, string message = null)            {                if (!object.Equals(expected, actual))                {                    throw new FormatException(message  "Objects are not equal.");                }            }            string srcFile = "badStrokeEffect.psd";            string output = "output.psd";            using (var image = (PsdImage)Image.Load(srcFile, new PsdLoadOptions() { LoadEffectsResource = true }))            {                var layer1 = new Layer();                image.AddLayer(layer1);                layer1.BlendingOptions.AddStroke(FillType.Color); // Will not throw ArgumentNullException                StrokeEffect strokeEffect = image.Layers[1].BlendingOptions.AddStroke(FillType.Color);                strokeEffect.Size = 10;                strokeEffect.Position = StrokePosition.Outside;                strokeEffect.Overprint = true;                image.Save(output);            }            // Checks saved values            using (var image = (PsdImage)Image.Load(output, new PsdLoadOptions() { LoadEffectsResource = true }))            {                StrokeEffect strokeEffect = (StrokeEffect)image.Layers[1].BlendingOptions.Effects[0];                AssertAreEqual(10, strokeEffect.Size);                AssertAreEqual(StrokePosition.Outside, strokeEffect.Position);                AssertAreEqual(true, strokeEffect.Overprint);            }

如果你想试用Aspose的全部完整功能,可联系在线客服获取30天临时授权体验。


还想要更多吗可以点击阅读【2020 · Aspose最新资源整合】查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年1月27日
下一篇 2021年1月27日

相关推荐

发表回复

登录后才能评论