Aspose.PSD for .NET 21.5 - 发行说明
Contents
[
Hide
]
本页面包含了 Aspose.PSD for .NET 21.5 的发行说明。
关键 | 摘要 | 类别 |
---|---|---|
PSDNET-758 | 支持调整带有矢量路径的形状图层的大小 | 特性 |
PSDNET-862 | 仅调整图层大小时支持调整带有矢量路径的形状图层 | 特性 |
PSDNET-578 | 截断的文本字符串 | 错误 |
公共 API 变更
新增 API:
- 无
移除 API:
- 无
使用示例:
PSDNET-578. 截断的文本字符串
string srcFile = "grinched-regular-font.psd";
string output = "output_grinched-regular-font.psd.png";
// 设置字体路径
System.Collections.Generic.List<string> fonts = new System.Collections.Generic.List<string>();
fonts.AddRange(FontSettings.GetDefaultFontsFolders());
fonts.Add(@"Fonts\");
FontSettings.SetFontsFolders(fonts.ToArray(), true);
using (PsdImage image = (PsdImage)Image.Load(srcFile))
{
image.Save(output, new PngOptions());
}
PSDNET-758. 支持调整带有矢量路径的形状图层的大小
string sourceFileName = "vectorShapes.psd";
string outputFileName = "out_vectorShapes.psd";
string dataDir = "PSDNET758_1";
string sourcePath = Path.Combine(dataDir, sourceFileName);
string outputPath = Path.Combine(dataDir, outputFileName);
using (var psdImage = (PsdImage)Image.Load(sourcePath))
{
foreach (var layer in psdImage.Layers)
{
layer.Resize(layer.Width * 5 / 4, layer.Height / 2);
}
psdImage.Save(outputPath);
psdImage.Save(Path.ChangeExtension(outputPath, ".png"), new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
PSDNET-862. 仅调整图层大小时支持调整带有矢量路径的形状图层
// 该示例展示了如何调整带有矢量路径资源的 Vogk 图层在 PSD 图像中的大小
float scaleX = 0.45f;
float scaleY = 1.60f;
string dataDir = "PSDNET862_1";
string sourceFileName = Path.Combine(dataDir, "vectorShapes.psd");
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
for (int layerIndex = 1; layerIndex < image.Layers.Length; layerIndex++, scaleX += 0.25f, scaleY -= 0.25f)
{
var layer = image.Layers[layerIndex];
var newWidth = (int)Math.Round(layer.Width * scaleX);
var newHeight = (int)Math.Round(layer.Height * scaleY);
layer.Resize(newWidth, newHeight);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB");
string outputName = string.Format("resized_{0}_{1}_{2}", layerIndex, scaleX, scaleY);
string outputPath = Path.Combine(dataDir, outputName + ".psd");
string outputPngPath = Path.Combine(dataDir, outputName + ".png");
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
}