Enum WarpStyles
Contents
[
Hide
]WarpStyles enumeration
Types of support warp styles supported
public enum WarpStyles
Values
Name | Value | Description |
---|---|---|
None | 0 | It style is set when the layer without deformation |
Custom | 1 | Style with arbitrary movement of points |
Arc | 2 | Arc style of warp |
ArcUpper | 3 | Upper Arc style of warp |
ArcLower | 4 | Lower Arc style of warp |
Arch | 5 | Arch style of warp |
Bulge | 6 | Bulge style of warp |
Flag | 7 | Flag style of warp |
Fish | 8 | Fish style of warp |
Rise | 9 | Rise style of warp |
Wave | 10 | Wave style of warp |
Twist | 11 | Twist type of warp |
Squeeze | 12 | Squeeze type of warp |
Inflate | 13 | Inflate type of warp |
Examples
The following code demonstrates how to manipulate WarpSettings to do warp transformation on SmartObjectLayer and TexLayer.
[C#]
string sourceFile = "smart_without_warp.psd";
var opt = new PsdLoadOptions()
{
LoadEffectsResource = true,
AllowWarpRepaint = true
};
string[] outputImageFile = new string[4];
string[] outputPsdFile = new string[4];
for (int caseIndex = 0; caseIndex < outputImageFile.Length; caseIndex++)
{
outputImageFile[caseIndex] = "export_" + caseIndex + ".png";
outputPsdFile[caseIndex] = "export_" + caseIndex + ".psd";
using (PsdImage img = (PsdImage)Image.Load(sourceFile, opt))
{
foreach (Layer layer in img.Layers)
{
if (layer is SmartObjectLayer)
{
var smartLayer = (SmartObjectLayer)layer;
smartLayer.WarpSettings = GetWarpSettingsByIndex(smartLayer.WarpSettings, caseIndex);
}
if (layer is TextLayer)
{
var textLayer = (TextLayer)layer;
if (caseIndex != 3)
{
textLayer.WarpSettings = GetWarpSettingsByIndex(textLayer.WarpSettings, caseIndex);
}
}
}
img.Save(outputPsdFile[caseIndex], new PsdOptions());
}
using (PsdImage img = (PsdImage)Image.Load(outputPsdFile[caseIndex], opt))
{
img.Save(outputImageFile[caseIndex],
new PngOptions() { CompressionLevel = 9, ColorType = PngColorType.TruecolorWithAlpha });
}
}
WarpSettings GetWarpSettingsByIndex(WarpSettings warpParams, int caseIndex)
{
switch (caseIndex)
{
case 0:
warpParams.Style = WarpStyles.Rise;
warpParams.Rotate = WarpRotates.Horizontal;
warpParams.Value = 20;
break;
case 1:
warpParams.Style = WarpStyles.Rise;
warpParams.Rotate = WarpRotates.Vertical;
warpParams.Value = 10;
break;
case 2:
warpParams.Style = WarpStyles.Flag;
warpParams.Rotate = WarpRotates.Horizontal;
warpParams.Value = 30;
break;
case 3:
warpParams.Style = WarpStyles.Custom;
warpParams.MeshPoints[2].Y += 70;
break;
}
return warpParams;
}
See Also
- namespace Aspose.PSD.FileFormats.Psd.Layers.Warp
- assembly Aspose.PSD