mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-12 13:28:35 +00:00
commit
fb4876e2f6
@ -1,6 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
|
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
@ -28,9 +29,9 @@
|
|||||||
<PackageReleaseNotes>
|
<PackageReleaseNotes>
|
||||||
</PackageReleaseNotes>
|
</PackageReleaseNotes>
|
||||||
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.2</Version>
|
||||||
<AssemblyVersion>2.0.0</AssemblyVersion>
|
<AssemblyVersion>2.0.2</AssemblyVersion>
|
||||||
<FileVersion>2.0.0</FileVersion>
|
<FileVersion>2.0.2</FileVersion>
|
||||||
|
|
||||||
<OutputPath>..\bin\</OutputPath>
|
<OutputPath>..\bin\</OutputPath>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
|
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
@ -28,9 +29,9 @@
|
|||||||
<PackageReleaseNotes>
|
<PackageReleaseNotes>
|
||||||
</PackageReleaseNotes>
|
</PackageReleaseNotes>
|
||||||
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.2</Version>
|
||||||
<AssemblyVersion>2.0.0</AssemblyVersion>
|
<AssemblyVersion>2.0.2</AssemblyVersion>
|
||||||
<FileVersion>2.0.0</FileVersion>
|
<FileVersion>2.0.2</FileVersion>
|
||||||
|
|
||||||
<OutputPath>..\bin\</OutputPath>
|
<OutputPath>..\bin\</OutputPath>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|||||||
@ -29,9 +29,9 @@
|
|||||||
<PackageReleaseNotes>
|
<PackageReleaseNotes>
|
||||||
</PackageReleaseNotes>
|
</PackageReleaseNotes>
|
||||||
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.2</Version>
|
||||||
<AssemblyVersion>2.0.0</AssemblyVersion>
|
<AssemblyVersion>2.0.2</AssemblyVersion>
|
||||||
<FileVersion>2.0.0</FileVersion>
|
<FileVersion>2.0.2</FileVersion>
|
||||||
|
|
||||||
<OutputPath>..\bin\</OutputPath>
|
<OutputPath>..\bin\</OutputPath>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|||||||
@ -20,12 +20,21 @@ public sealed class CaptureZone<TColor> : ICaptureZone
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Display Display { get; }
|
public Display Display { get; }
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ColorFormat ColorFormat
|
public ColorFormat ColorFormat
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get => TColor.ColorFormat;
|
get => TColor.ColorFormat;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat ColorFormat
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
get => default(TColor).Net6ColorFormat;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int X { get; internal set; }
|
public int X { get; internal set; }
|
||||||
@ -95,7 +104,7 @@ public sealed class CaptureZone<TColor> : ICaptureZone
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsUpdateRequested { get; private set; }
|
public bool IsUpdateRequested { get; private set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,11 @@ public readonly struct ColorABGR : IColor
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static ColorFormat ColorFormat => ColorFormat.ABGR;
|
public static ColorFormat ColorFormat => ColorFormat.ABGR;
|
||||||
|
|
||||||
|
#if !NET7_0_OR_GREATER
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat Net6ColorFormat => ColorFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
private readonly byte _a;
|
private readonly byte _a;
|
||||||
private readonly byte _b;
|
private readonly byte _b;
|
||||||
private readonly byte _g;
|
private readonly byte _g;
|
||||||
@ -39,7 +44,7 @@ public readonly struct ColorABGR : IColor
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ColorABGR"/> class.
|
/// Initializes a new instance of the <see cref="ColorABGR"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
|
|||||||
public readonly struct ColorARGB : IColor
|
public readonly struct ColorARGB : IColor
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static ColorFormat ColorFormat => ColorFormat.ARGB;
|
public static ColorFormat ColorFormat => ColorFormat.ARGB;
|
||||||
|
|
||||||
|
#if !NET7_0_OR_GREATER
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat Net6ColorFormat => ColorFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
private readonly byte _a;
|
private readonly byte _a;
|
||||||
private readonly byte _r;
|
private readonly byte _r;
|
||||||
private readonly byte _g;
|
private readonly byte _g;
|
||||||
|
|||||||
@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
|
|||||||
public readonly struct ColorBGR : IColor
|
public readonly struct ColorBGR : IColor
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static ColorFormat ColorFormat => ColorFormat.BGR;
|
public static ColorFormat ColorFormat => ColorFormat.BGR;
|
||||||
|
|
||||||
|
#if !NET7_0_OR_GREATER
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat Net6ColorFormat => ColorFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
private readonly byte _b;
|
private readonly byte _b;
|
||||||
private readonly byte _g;
|
private readonly byte _g;
|
||||||
private readonly byte _r;
|
private readonly byte _r;
|
||||||
|
|||||||
@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
|
|||||||
public readonly struct ColorBGRA : IColor
|
public readonly struct ColorBGRA : IColor
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static ColorFormat ColorFormat => ColorFormat.BGRA;
|
public static ColorFormat ColorFormat => ColorFormat.BGRA;
|
||||||
|
|
||||||
|
#if !NET7_0_OR_GREATER
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat Net6ColorFormat => ColorFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
private readonly byte _b;
|
private readonly byte _b;
|
||||||
private readonly byte _g;
|
private readonly byte _g;
|
||||||
private readonly byte _r;
|
private readonly byte _r;
|
||||||
@ -36,7 +41,7 @@ public readonly struct ColorBGRA : IColor
|
|||||||
public byte A => _a;
|
public byte A => _a;
|
||||||
// ReSharper restore ConvertToAutoPropertyWhenPossible
|
// ReSharper restore ConvertToAutoPropertyWhenPossible
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
|
|||||||
@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
|
|||||||
public readonly struct ColorRGB : IColor
|
public readonly struct ColorRGB : IColor
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static ColorFormat ColorFormat => ColorFormat.RGB;
|
public static ColorFormat ColorFormat => ColorFormat.RGB;
|
||||||
|
|
||||||
|
#if !NET7_0_OR_GREATER
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat Net6ColorFormat => ColorFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
private readonly byte _r;
|
private readonly byte _r;
|
||||||
private readonly byte _g;
|
private readonly byte _g;
|
||||||
private readonly byte _b;
|
private readonly byte _b;
|
||||||
|
|||||||
@ -17,6 +17,11 @@ public readonly struct ColorRGBA : IColor
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static ColorFormat ColorFormat => ColorFormat.RGBA;
|
public static ColorFormat ColorFormat => ColorFormat.RGBA;
|
||||||
|
|
||||||
|
#if !NET7_0_OR_GREATER
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat Net6ColorFormat => ColorFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
private readonly byte _r;
|
private readonly byte _r;
|
||||||
private readonly byte _g;
|
private readonly byte _g;
|
||||||
private readonly byte _b;
|
private readonly byte _b;
|
||||||
|
|||||||
@ -27,8 +27,12 @@ public interface IColor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
byte A { get; }
|
byte A { get; }
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the color-format of this color.
|
/// Gets the color-format of this color.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static virtual ColorFormat ColorFormat => throw new NotSupportedException();
|
public static virtual ColorFormat ColorFormat => throw new NotSupportedException();
|
||||||
|
#else
|
||||||
|
public ColorFormat Net6ColorFormat { get; }
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
@ -18,8 +18,21 @@ public sealed class Image<TColor> : IImage
|
|||||||
private readonly int _y;
|
private readonly int _y;
|
||||||
private readonly int _stride;
|
private readonly int _stride;
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ColorFormat ColorFormat => TColor.ColorFormat;
|
public ColorFormat ColorFormat
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
get => TColor.ColorFormat;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ColorFormat ColorFormat
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
get => default(TColor).Net6ColorFormat;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Width { get; }
|
public int Width { get; }
|
||||||
@ -28,7 +41,7 @@ public sealed class Image<TColor> : IImage
|
|||||||
public int Height { get; }
|
public int Height { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int SizeInBytes => Width * Height * TColor.ColorFormat.BytesPerPixel;
|
public int SizeInBytes => Width * Height * ColorFormat.BytesPerPixel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -96,7 +109,7 @@ public sealed class Image<TColor> : IImage
|
|||||||
if (destination == null) throw new ArgumentNullException(nameof(destination));
|
if (destination == null) throw new ArgumentNullException(nameof(destination));
|
||||||
if (destination.Length < SizeInBytes) throw new ArgumentException("The destination is too small to fit this image.", nameof(destination));
|
if (destination.Length < SizeInBytes) throw new ArgumentException("The destination is too small to fit this image.", nameof(destination));
|
||||||
|
|
||||||
int targetStride = Width * TColor.ColorFormat.BytesPerPixel;
|
int targetStride = Width * ColorFormat.BytesPerPixel;
|
||||||
IImage.IImageRows rows = Rows;
|
IImage.IImageRows rows = Rows;
|
||||||
Span<byte> target = destination;
|
Span<byte> target = destination;
|
||||||
foreach (IImage.IImageRow row in rows)
|
foreach (IImage.IImageRow row in rows)
|
||||||
@ -211,8 +224,13 @@ public sealed class Image<TColor> : IImage
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Length => _length;
|
public int Length => _length;
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int SizeInBytes => Length * TColor.ColorFormat.BytesPerPixel;
|
public int SizeInBytes => Length * TColor.ColorFormat.BytesPerPixel;
|
||||||
|
#else
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int SizeInBytes => Length * default(TColor).Net6ColorFormat.BytesPerPixel;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -349,8 +367,13 @@ public sealed class Image<TColor> : IImage
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Length => _length;
|
public int Length => _length;
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int SizeInBytes => Length * TColor.ColorFormat.BytesPerPixel;
|
public int SizeInBytes => Length * TColor.ColorFormat.BytesPerPixel;
|
||||||
|
#else
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int SizeInBytes => Length * default(TColor).Net6ColorFormat.BytesPerPixel;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -26,12 +26,12 @@
|
|||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
|
||||||
<PackageReleaseNotes>
|
<PackageReleaseNotes>
|
||||||
Reworked most of the data handling and splitted capture-logic into separate packages.
|
Fixed issues with .NET 6
|
||||||
</PackageReleaseNotes>
|
</PackageReleaseNotes>
|
||||||
|
|
||||||
<Version>2.0.1</Version>
|
<Version>2.0.2</Version>
|
||||||
<AssemblyVersion>2.0.1</AssemblyVersion>
|
<AssemblyVersion>2.0.2</AssemblyVersion>
|
||||||
<FileVersion>2.0.1</FileVersion>
|
<FileVersion>2.0.2</FileVersion>
|
||||||
|
|
||||||
<OutputPath>..\bin\</OutputPath>
|
<OutputPath>..\bin\</OutputPath>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user