/
DropShadowExpression.cs
38 lines (34 loc) · 1.38 KB
/
DropShadowExpression.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
namespace ImageResizer.FluentExtensions
{
/// <summary>
/// As expression for configuring dropshadow plugin options.
/// For more information see http://imageresizing.net/plugins/dropshadow.
/// </summary>
public class DropShadowExpression : StyleExpression
{
internal DropShadowExpression(ImageUrlBuilder builder) : base(builder) { }
/// <summary>
/// Configure the depth and angle of the shadow by specifying how far offset it is from the image
/// </summary>
/// <example>
/// 10,10
/// </example>
public StyleExpression Offset(int offsetDepth, int offsetAngle)
{
if (offsetDepth < 0)
throw new ArgumentException("Offset depth must be greater than or equal to 0.");
if (offsetAngle < 0)
throw new ArgumentException("Offset angle must be greater than or equal to 0.");
builder.SetParameter(DropShadowCommands.ShadowOffset, string.Concat(offsetDepth, ",", offsetAngle));
return this;
}
/// <summary>
/// Drop Shadow Plugin Commands. See http://imageresizing.net/plugins/dropshadow.
/// </summary>
private static class DropShadowCommands
{
internal const string ShadowOffset = "shadowoffset";
}
}
}