|
|
@ -1,83 +1,20 @@ |
|
|
<# |
|
|
<#@include file="_Common.ttinclude" #> |
|
|
// Copyright (c) Six Labors and contributors. |
|
|
|
|
|
// Licensed under the Apache License, Version 2.0. |
|
|
|
|
|
#> |
|
|
|
|
|
<#@ template debug="false" hostspecific="false" language="C#" #> |
|
|
|
|
|
<#@ assembly name="System.Core" #> |
|
|
|
|
|
<#@ import namespace="System.Linq" #> |
|
|
|
|
|
<#@ import namespace="System.Text" #> |
|
|
|
|
|
<#@ import namespace="System.Collections.Generic" #> |
|
|
|
|
|
<#@ output extension=".cs" #> |
|
|
<#@ output extension=".cs" #> |
|
|
<# |
|
|
|
|
|
void GenerateConvertToMethod(string pixelType) |
|
|
|
|
|
{ |
|
|
|
|
|
#> |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc /> |
|
|
|
|
|
internal override void To<#=pixelType#>(ReadOnlySpan<Bgra32> sourcePixels, Span<<#=pixelType#>> destPixels, int count) |
|
|
|
|
|
{ |
|
|
|
|
|
GuardSpans(sourcePixels, nameof(sourcePixels), destPixels, nameof(destPixels), count); |
|
|
|
|
|
|
|
|
|
|
|
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
|
|
ref <#=pixelType#> destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
|
|
ref <#=pixelType#> dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
|
|
|
|
|
|
|
|
dp.FromBgra32(sp); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
<# |
|
|
|
|
|
} |
|
|
|
|
|
#> |
|
|
|
|
|
// Copyright (c) Six Labors and contributors. |
|
|
|
|
|
// Licensed under the Apache License, Version 2.0. |
|
|
|
|
|
|
|
|
|
|
|
// <auto-generated /> |
|
|
|
|
|
namespace SixLabors.ImageSharp.PixelFormats |
|
|
namespace SixLabors.ImageSharp.PixelFormats |
|
|
{ |
|
|
{ |
|
|
using System; |
|
|
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
|
|
|
|
|
|
|
/// <content> |
|
|
/// <content> |
|
|
/// Provides optimized overrides for bulk operations. |
|
|
/// Provides optimized overrides for bulk operations. |
|
|
/// </content> |
|
|
/// </content> |
|
|
public partial struct Bgra32 |
|
|
public partial struct Bgra32 |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// Provides optimized overrides for bulk operations. |
|
|
/// Provides optimized overrides for bulk operations. |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
internal class PixelOperations : PixelOperations<Bgra32> |
|
|
internal class PixelOperations : PixelOperations<Bgra32> |
|
|
{ |
|
|
{ |
|
|
/// <inheritdoc /> |
|
|
|
|
|
internal override void FromBgra32(ReadOnlySpan<Bgra32> source, Span<Bgra32> destPixels, int count) |
|
|
|
|
|
{ |
|
|
|
|
|
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count); |
|
|
|
|
|
|
|
|
|
|
|
source.Slice(0, count).CopyTo(destPixels); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc /> |
|
|
|
|
|
internal override void ToBgra32(ReadOnlySpan<Bgra32> sourcePixels, Span<Bgra32> destPixels, int count) |
|
|
|
|
|
{ |
|
|
|
|
|
GuardSpans(sourcePixels, nameof(sourcePixels), destPixels, nameof(destPixels), count); |
|
|
|
|
|
|
|
|
|
|
|
sourcePixels.Slice(0, count).CopyTo(destPixels); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
<# |
|
|
<# |
|
|
GenerateConvertToMethod("Argb32"); |
|
|
GenerateAllDefaultConversionMethods("Bgra32"); |
|
|
GenerateConvertToMethod("Bgr24"); |
|
|
|
|
|
GenerateConvertToMethod("Gray8"); |
|
|
|
|
|
GenerateConvertToMethod("Gray16"); |
|
|
|
|
|
GenerateConvertToMethod("Rgb24"); |
|
|
|
|
|
GenerateConvertToMethod("Rgba32"); |
|
|
|
|
|
GenerateConvertToMethod("Rgb48"); |
|
|
|
|
|
GenerateConvertToMethod("Rgba64"); |
|
|
|
|
|
#> |
|
|
#> |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|