mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Add new PixelAlphaRepresentation property and implement for TPixel typesjs/color-alpha-handling
committed by
GitHub
91 changed files with 2304 additions and 671 deletions
@ -0,0 +1,32 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <summary>
|
|||
/// Provides enumeration of the alpha value transparency behavior of a pixel format.
|
|||
/// </summary>
|
|||
public enum PixelAlphaRepresentation |
|||
{ |
|||
/// <summary>
|
|||
/// Indicates that the pixel format does not contain an alpha channel.
|
|||
/// </summary>
|
|||
None, |
|||
|
|||
/// <summary>
|
|||
/// Indicates that the transparency behavior is premultiplied.
|
|||
/// Each color is first scaled by the alpha value. The alpha value itself is the same
|
|||
/// in both straight and premultiplied alpha. Typically, no color channel value is
|
|||
/// greater than the alpha channel value.
|
|||
/// If a color channel value in a premultiplied format is greater than the alpha
|
|||
/// channel, the standard source-over blending math results in an additive blend.
|
|||
/// </summary>
|
|||
Associated, |
|||
|
|||
/// <summary>
|
|||
/// Indicates that the transparency behavior is not premultiplied.
|
|||
/// The alpha channel indicates the transparency of the color.
|
|||
/// </summary>
|
|||
Unassociated |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct A8 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<A8> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<A8>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Argb32 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Argb32> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Argb32>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgr24 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Bgr24> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Bgr24>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgr565 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Bgr565> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Bgr565>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgra32 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Bgra32> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Bgra32>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgra4444 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Bgra4444> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Bgra4444>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgra5551 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Bgra5551> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Bgra5551>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Byte4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Byte4> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Byte4>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -1,6 +1,5 @@ |
|||
<#@include file="_Common.ttinclude" #> |
|||
<#@include file="_Common.ttinclude" #> |
|||
<#@ output extension=".cs" #> |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content> |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct HalfSingle |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<HalfSingle> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<HalfSingle>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct HalfVector2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<HalfVector2> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<HalfVector2>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct HalfVector4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<HalfVector4> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<HalfVector4>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct L16 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<L16> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<L16>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct L8 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<L8> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<L8>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct La16 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<La16> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<La16>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct La32 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<La32> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<La32>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedByte2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedByte2> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<NormalizedByte2>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedByte4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedByte4> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<NormalizedByte4>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedShort2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedShort2> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<NormalizedShort2>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedShort4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedShort4> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<NormalizedShort4>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rg32 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Rg32> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Rg32>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rgb24 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Rgb24> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Rgb24>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rgb48 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Rgb48> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Rgb48>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rgba1010102 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Rgba1010102> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Rgba1010102>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rgba64 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal partial class PixelOperations : PixelOperations<Rgba64> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Rgba64>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Short2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Short2> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Short2>(PixelAlphaRepresentation.None), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Short4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Short4> |
|||
{ |
|||
private static readonly Lazy<PixelTypeInfo> LazyInfo = |
|||
new Lazy<PixelTypeInfo>(() => PixelTypeInfo.Create<Short4>(PixelAlphaRepresentation.Unassociated), true); |
|||
|
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,577 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
// <auto-generated />
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
|
|||
public partial class A8_OperationsTests : PixelOperationsTests<A8> |
|||
{ |
|||
public A8_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<A8> Operations => A8.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<A8.PixelOperations>(PixelOperations<A8>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Argb32_OperationsTests : PixelOperationsTests<Argb32> |
|||
{ |
|||
public Argb32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Argb32> Operations => Argb32.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Argb32.PixelOperations>(PixelOperations<Argb32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgr24_OperationsTests : PixelOperationsTests<Bgr24> |
|||
{ |
|||
public Bgr24_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Bgr24> Operations => Bgr24.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgr24.PixelOperations>(PixelOperations<Bgr24>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgr565_OperationsTests : PixelOperationsTests<Bgr565> |
|||
{ |
|||
public Bgr565_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Bgr565> Operations => Bgr565.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgr565.PixelOperations>(PixelOperations<Bgr565>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgra32_OperationsTests : PixelOperationsTests<Bgra32> |
|||
{ |
|||
public Bgra32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Bgra32> Operations => Bgra32.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra32.PixelOperations>(PixelOperations<Bgra32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgra4444_OperationsTests : PixelOperationsTests<Bgra4444> |
|||
{ |
|||
public Bgra4444_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Bgra4444> Operations => Bgra4444.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra4444.PixelOperations>(PixelOperations<Bgra4444>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgra5551_OperationsTests : PixelOperationsTests<Bgra5551> |
|||
{ |
|||
public Bgra5551_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Bgra5551> Operations => Bgra5551.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra5551.PixelOperations>(PixelOperations<Bgra5551>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Byte4_OperationsTests : PixelOperationsTests<Byte4> |
|||
{ |
|||
public Byte4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Byte4> Operations => Byte4.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Byte4.PixelOperations>(PixelOperations<Byte4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class HalfSingle_OperationsTests : PixelOperationsTests<HalfSingle> |
|||
{ |
|||
public HalfSingle_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<HalfSingle> Operations => HalfSingle.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<HalfSingle.PixelOperations>(PixelOperations<HalfSingle>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class HalfVector2_OperationsTests : PixelOperationsTests<HalfVector2> |
|||
{ |
|||
public HalfVector2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<HalfVector2> Operations => HalfVector2.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<HalfVector2.PixelOperations>(PixelOperations<HalfVector2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class HalfVector4_OperationsTests : PixelOperationsTests<HalfVector4> |
|||
{ |
|||
public HalfVector4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<HalfVector4> Operations => HalfVector4.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<HalfVector4.PixelOperations>(PixelOperations<HalfVector4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class L16_OperationsTests : PixelOperationsTests<L16> |
|||
{ |
|||
public L16_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<L16> Operations => L16.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L16.PixelOperations>(PixelOperations<L16>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class L8_OperationsTests : PixelOperationsTests<L8> |
|||
{ |
|||
public L8_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<L8> Operations => L8.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L8.PixelOperations>(PixelOperations<L8>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class La16_OperationsTests : PixelOperationsTests<La16> |
|||
{ |
|||
public La16_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<La16> Operations => La16.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La16.PixelOperations>(PixelOperations<La16>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class La32_OperationsTests : PixelOperationsTests<La32> |
|||
{ |
|||
public La32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<La32> Operations => La32.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La32.PixelOperations>(PixelOperations<La32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedByte2_OperationsTests : PixelOperationsTests<NormalizedByte2> |
|||
{ |
|||
public NormalizedByte2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<NormalizedByte2> Operations => NormalizedByte2.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedByte2.PixelOperations>(PixelOperations<NormalizedByte2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedByte4_OperationsTests : PixelOperationsTests<NormalizedByte4> |
|||
{ |
|||
public NormalizedByte4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<NormalizedByte4> Operations => NormalizedByte4.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedByte4.PixelOperations>(PixelOperations<NormalizedByte4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedShort2_OperationsTests : PixelOperationsTests<NormalizedShort2> |
|||
{ |
|||
public NormalizedShort2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<NormalizedShort2> Operations => NormalizedShort2.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedShort2.PixelOperations>(PixelOperations<NormalizedShort2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedShort4_OperationsTests : PixelOperationsTests<NormalizedShort4> |
|||
{ |
|||
public NormalizedShort4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<NormalizedShort4> Operations => NormalizedShort4.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedShort4.PixelOperations>(PixelOperations<NormalizedShort4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rg32_OperationsTests : PixelOperationsTests<Rg32> |
|||
{ |
|||
public Rg32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Rg32> Operations => Rg32.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rg32.PixelOperations>(PixelOperations<Rg32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgb24_OperationsTests : PixelOperationsTests<Rgb24> |
|||
{ |
|||
public Rgb24_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Rgb24> Operations => Rgb24.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb24.PixelOperations>(PixelOperations<Rgb24>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgb48_OperationsTests : PixelOperationsTests<Rgb48> |
|||
{ |
|||
public Rgb48_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Rgb48> Operations => Rgb48.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb48.PixelOperations>(PixelOperations<Rgb48>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgba1010102_OperationsTests : PixelOperationsTests<Rgba1010102> |
|||
{ |
|||
public Rgba1010102_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Rgba1010102> Operations => Rgba1010102.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba1010102.PixelOperations>(PixelOperations<Rgba1010102>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgba32_OperationsTests : PixelOperationsTests<Rgba32> |
|||
{ |
|||
public Rgba32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Rgba32> Operations => Rgba32.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba32.PixelOperations>(PixelOperations<Rgba32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgba64_OperationsTests : PixelOperationsTests<Rgba64> |
|||
{ |
|||
public Rgba64_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Rgba64> Operations => Rgba64.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba64.PixelOperations>(PixelOperations<Rgba64>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class RgbaVector_OperationsTests : PixelOperationsTests<RgbaVector> |
|||
{ |
|||
public RgbaVector_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<RgbaVector> Operations => RgbaVector.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<RgbaVector.PixelOperations>(PixelOperations<RgbaVector>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Short2_OperationsTests : PixelOperationsTests<Short2> |
|||
{ |
|||
public Short2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Short2> Operations => Short2.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Short2.PixelOperations>(PixelOperations<Short2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Short4_OperationsTests : PixelOperationsTests<Short4> |
|||
{ |
|||
public Short4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<Short4> Operations => Short4.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Short4.PixelOperations>(PixelOperations<Short4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,11 @@ |
|||
<#@include file="_Common.ttinclude" #> |
|||
<#@ output extension=".cs" #> |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
<# GenerateAllSpecializedClasses(); #> |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,111 @@ |
|||
<#@ template debug="false" hostspecific="false" language="C#" #> |
|||
<#@ assembly name="System.Core" #> |
|||
<#@ import namespace="System.Linq" #> |
|||
<#@ import namespace="System.Text" #> |
|||
<#@ import namespace="System.Collections.Generic" #> |
|||
// Copyright (c) Six Labors. |
|||
// Licensed under the Apache License, Version 2.0. |
|||
|
|||
// <auto-generated /> |
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
<#+ |
|||
private static readonly string[] UnassociatedAlphaPixelTypes = |
|||
{ |
|||
"A8", |
|||
"Argb32", |
|||
"Bgra32", |
|||
"Bgra4444", |
|||
"Bgra5551", |
|||
"Byte4", |
|||
"HalfVector4", |
|||
"La16", |
|||
"La32", |
|||
"NormalizedByte4", |
|||
"NormalizedShort4", |
|||
"Rgba1010102", |
|||
"Rgba32", |
|||
"Rgba64", |
|||
"RgbaVector", |
|||
"Short4" |
|||
}; |
|||
|
|||
private static readonly string[] AssociatedAlphaPixelTypes = Array.Empty<string>(); |
|||
|
|||
private static readonly string[] CommonPixelTypes = |
|||
{ |
|||
"A8", |
|||
"Argb32", |
|||
"Bgr24", |
|||
"Bgr565", |
|||
"Bgra32", |
|||
"Bgra4444", |
|||
"Bgra5551", |
|||
"Byte4", |
|||
"HalfSingle", |
|||
"HalfVector2", |
|||
"HalfVector4", |
|||
"L16", |
|||
"L8", |
|||
"La16", |
|||
"La32", |
|||
"NormalizedByte2", |
|||
"NormalizedByte4", |
|||
"NormalizedShort2", |
|||
"NormalizedShort4", |
|||
"Rg32", |
|||
"Rgb24", |
|||
"Rgb48", |
|||
"Rgba1010102", |
|||
"Rgba32", |
|||
"Rgba64", |
|||
"RgbaVector", |
|||
"Short2", |
|||
"Short4", |
|||
}; |
|||
|
|||
void GenerateSpecializedClass(string pixelType, string alpha) |
|||
{ |
|||
#> |
|||
public partial class <#=pixelType#>_OperationsTests : PixelOperationsTests<<#=pixelType#>> |
|||
{ |
|||
public <#=pixelType#>_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
protected override PixelOperations<<#=pixelType#>> Operations => <#=pixelType#>.PixelOperations.Instance; |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<<#=pixelType#>.PixelOperations>(PixelOperations<<#=pixelType#>>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = this.Operations.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(<#=alpha#>, alphaRepresentation); |
|||
} |
|||
} |
|||
<#+ |
|||
} |
|||
|
|||
void GenerateAllSpecializedClasses() |
|||
{ |
|||
foreach (string pixelType in CommonPixelTypes) |
|||
{ |
|||
string alpha = "PixelAlphaRepresentation.None"; |
|||
if (AssociatedAlphaPixelTypes.Contains(pixelType)) |
|||
{ |
|||
alpha = "PixelAlphaRepresentation.Associated"; |
|||
} |
|||
else if (UnassociatedAlphaPixelTypes.Contains(pixelType)) |
|||
{ |
|||
alpha = "PixelAlphaRepresentation.Unassociated"; |
|||
} |
|||
|
|||
GenerateSpecializedClass(pixelType, alpha); |
|||
} |
|||
} |
|||
#> |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Argb32OperationsTests : PixelOperationsTests<Argb32> |
|||
{ |
|||
public Argb32OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Argb32.PixelOperations>(PixelOperations<Argb32>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,25 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Bgr24OperationsTests : PixelOperationsTests<Bgr24> |
|||
{ |
|||
public Bgr24OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
this.HasAlpha = false; |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgr24.PixelOperations>(PixelOperations<Bgr24>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Bgra32OperationsTests : PixelOperationsTests<Bgra32> |
|||
{ |
|||
public Bgra32OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra32.PixelOperations>(PixelOperations<Bgra32>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,20 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Bgra5551OperationsTests : PixelOperationsTests<Bgra5551> |
|||
{ |
|||
public Bgra5551OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class L16OperationsTests : PixelOperationsTests<L16> |
|||
{ |
|||
public L16OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L16.PixelOperations>(PixelOperations<L16>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class L8OperationsTests : PixelOperationsTests<L8> |
|||
{ |
|||
public L8OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L8.PixelOperations>(PixelOperations<L8>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class La16OperationsTests : PixelOperationsTests<La16> |
|||
{ |
|||
public La16OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La16.PixelOperations>(PixelOperations<La16>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class La32OperationsTests : PixelOperationsTests<La32> |
|||
{ |
|||
public La32OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La32.PixelOperations>(PixelOperations<La32>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Rgb24OperationsTests : PixelOperationsTests<Rgb24> |
|||
{ |
|||
public Rgb24OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
this.HasAlpha = false; |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb24.PixelOperations>(PixelOperations<Rgb24>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Rgb48OperationsTests : PixelOperationsTests<Rgb48> |
|||
{ |
|||
public Rgb48OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb48.PixelOperations>(PixelOperations<Rgb48>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Rgba64OperationsTests : PixelOperationsTests<Rgba64> |
|||
{ |
|||
public Rgba64OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba64.PixelOperations>(PixelOperations<Rgba64>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class RgbaVectorOperationsTests : PixelOperationsTests<RgbaVector> |
|||
{ |
|||
public RgbaVectorOperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<RgbaVector.PixelOperations>(PixelOperations<RgbaVector>.Instance); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue