Skip to content

Commit cd276a3

Browse files
Merge pull request #306 from stefannikolei/stefannikolei/addTargetRectangle
Add Parsing of TargetRectangle to ResizeWebProcessor
2 parents 43aa837 + e83c10c commit cd276a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ImageSharp.Web/Processors/ResizeWebProcessor.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
3+
34
#nullable disable
45

56
using System.Globalization;
@@ -126,15 +127,18 @@ internal static ResizeOptions GetResizeOptions(
126127
return null;
127128
}
128129

130+
ResizeMode mode = GetMode(commands, parser, culture);
131+
129132
return new()
130133
{
131134
Size = size,
132135
CenterCoordinates = GetCenter(orientation, commands, parser, culture),
133136
Position = GetAnchor(orientation, commands, parser, culture),
134-
Mode = GetMode(commands, parser, culture),
137+
Mode = mode,
135138
Compand = GetCompandMode(commands, parser, culture),
136139
Sampler = GetSampler(commands),
137-
PadColor = parser.ParseValue<Color>(commands.GetValueOrDefault(Color), culture)
140+
PadColor = parser.ParseValue<Color>(commands.GetValueOrDefault(Color), culture),
141+
TargetRectangle = mode is ResizeMode.Manual ? new Rectangle(0, 0, size.Width, size.Height) : null
138142
};
139143
}
140144

0 commit comments

Comments
 (0)