Skip to content

Commit 70dc8ad

Browse files
Rename method for accuracy
1 parent fdc2ff6 commit 70dc8ad

13 files changed

Lines changed: 20 additions & 20 deletions

src/ImageSharp.Web/Middleware/ImageSharpMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ private async Task ProcessRequestAsync(
345345
// The non-generic variant will decode to the correct pixel format based upon the encoded image metadata which can yield
346346
// massive memory savings.
347347
IReadOnlyList<(int Index, IImageWebProcessor Processor)> sortedProcessors = this.processors.OrderBySupportedCommands(commands);
348-
bool requiresAlpha = sortedProcessors.RequiresAlphaAwarePixelFormat(commands, this.commandParser, this.parserCulture);
348+
bool requiresAlpha = sortedProcessors.RequiresTrueColorPixelFormat(commands, this.commandParser, this.parserCulture);
349349

350350
if (requiresAlpha)
351351
{

src/ImageSharp.Web/Processors/BackgroundColorWebProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public FormattedImage Process(
4747
}
4848

4949
/// <inheritdoc/>
50-
public bool RequiresAlphaAwarePixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => true;
50+
public bool RequiresTrueColorPixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => true;
5151
}
5252
}

src/ImageSharp.Web/Processors/FormatWebProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ public FormattedImage Process(
6666
}
6767

6868
/// <inheritdoc/>
69-
public bool RequiresAlphaAwarePixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => false;
69+
public bool RequiresTrueColorPixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => false;
7070
}
7171
}

src/ImageSharp.Web/Processors/IImageWebProcessor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ FormattedImage Process(
3838

3939
/// <summary>
4040
/// <para>
41-
/// Returns a value indicating whether the image to be processed should be decoded using a pixel format that supports
42-
/// an alpha component for correct processing.
41+
/// Returns a value indicating whether the image to be processed should be decoded using a 32 bit True Color pixel format - 8 bits per color component
42+
/// plus an 8 bit alpha channel <see href="https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)"/>.
4343
/// </para>
4444
/// <para>This method is used to determine whether optimizations can be enabled to reduce memory consumption during processing.</para>
4545
/// </summary>
@@ -48,7 +48,7 @@ FormattedImage Process(
4848
/// <param name="culture">
4949
/// The <see cref="CultureInfo"/> to use as the current parsing culture.
5050
/// </param>
51-
/// <returns>The <see cref="bool"/> indicating whether a pixel format containing an alpha component is required.</returns>
52-
bool RequiresAlphaAwarePixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture);
51+
/// <returns>The <see cref="bool"/> indicating whether a 32 bit True Color pixel format is required.</returns>
52+
bool RequiresTrueColorPixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture);
5353
}
5454
}

src/ImageSharp.Web/Processors/QualityWebProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ public FormattedImage Process(
8484
}
8585

8686
/// <inheritdoc/>
87-
public bool RequiresAlphaAwarePixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => false;
87+
public bool RequiresTrueColorPixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => false;
8888
}
8989
}

src/ImageSharp.Web/Processors/ResizeWebProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ internal static ResizeOptions GetResizeOptions(
144144
}
145145

146146
/// <inheritdoc/>
147-
public bool RequiresAlphaAwarePixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture)
147+
public bool RequiresTrueColorPixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture)
148148
{
149149
ResizeMode mode = parser.ParseValue<ResizeMode>(commands.GetValueOrDefault(Mode), culture);
150150
return mode is ResizeMode.Pad or ResizeMode.BoxPad;

src/ImageSharp.Web/Processors/WebProcessingExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public static bool IsSupportedCommand(this IImageWebProcessor processor, string
9090

9191
/// <summary>
9292
/// <para>
93-
/// Returns a value indicating whether the image to be processed should be decoded using a pixel format that supports
94-
/// an alpha component for correct processing.
93+
/// Returns a value indicating whether the image to be processed should be decoded using a 32 bit True Color pixel format - 8 bits per color component
94+
/// plus an 8 bit alpha channel <see href="https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)"/>.
9595
/// </para>
9696
/// <para>This method is used to determine whether optimizations can be enabled to reduce memory consumption during processing.</para>
9797
/// </summary>
@@ -101,8 +101,8 @@ public static bool IsSupportedCommand(this IImageWebProcessor processor, string
101101
/// <param name="culture">
102102
/// The <see cref="CultureInfo"/> to use as the current parsing culture.
103103
/// </param>
104-
/// <returns>The <see cref="bool"/> indicating whether an alpha component is required.</returns>
105-
public static bool RequiresAlphaAwarePixelFormat(
104+
/// <returns>The <see cref="bool"/> indicating whether a 32 bit True Color pixel format is required.</returns>
105+
public static bool RequiresTrueColorPixelFormat(
106106
this IReadOnlyList<(int Index, IImageWebProcessor Processor)> processors,
107107
CommandCollection commands,
108108
CommandParser parser,
@@ -111,7 +111,7 @@ public static bool RequiresAlphaAwarePixelFormat(
111111
bool requiresAlpha = false;
112112
foreach ((int Index, IImageWebProcessor Processor) processor in processors)
113113
{
114-
requiresAlpha |= processor.Processor.RequiresAlphaAwarePixelFormat(commands, parser, culture);
114+
requiresAlpha |= processor.Processor.RequiresTrueColorPixelFormat(commands, parser, culture);
115115
}
116116

117117
return requiresAlpha;

tests/ImageSharp.Web.Tests/DependencyInjection/MockWebProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public FormattedImage Process(
2222
CultureInfo culture)
2323
=> image;
2424

25-
public bool RequiresAlphaAwarePixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => false;
25+
public bool RequiresTrueColorPixelFormat(CommandCollection commands, CommandParser parser, CultureInfo culture) => false;
2626
}
2727
}

tests/ImageSharp.Web.Tests/Processors/BackgroundColorWebProcessorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void BackgroundColorWebProcessor_CanReportAlphaRequirements(string color)
4848
{ new(BackgroundColorWebProcessor.Color, color) }
4949
};
5050

51-
Assert.True(new BackgroundColorWebProcessor().RequiresAlphaAwarePixelFormat(commands, parser, culture));
51+
Assert.True(new BackgroundColorWebProcessor().RequiresTrueColorPixelFormat(commands, parser, culture));
5252
}
5353
}
5454
}

tests/ImageSharp.Web.Tests/Processors/FormatWebProcessorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void FormatWebProcessor_CanReportAlphaRequirements(string format)
6565
};
6666

6767
FormatWebProcessor processor = new(Options.Create(new ImageSharpMiddlewareOptions()));
68-
Assert.False(processor.RequiresAlphaAwarePixelFormat(commands, parser, culture));
68+
Assert.False(processor.RequiresTrueColorPixelFormat(commands, parser, culture));
6969
}
7070
}
7171
}

0 commit comments

Comments
 (0)