Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -28,9 +29,9 @@
<PackageReleaseNotes>
</PackageReleaseNotes>

<Version>2.0.0</Version>
<AssemblyVersion>2.0.0</AssemblyVersion>
<FileVersion>2.0.0</FileVersion>
<Version>2.0.2</Version>
<AssemblyVersion>2.0.2</AssemblyVersion>
<FileVersion>2.0.2</FileVersion>

<OutputPath>..\bin\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
9 changes: 5 additions & 4 deletions ScreenCapture.NET.DX9/ScreenCapture.NET.DX9.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -28,9 +29,9 @@
<PackageReleaseNotes>
</PackageReleaseNotes>

<Version>2.0.0</Version>
<AssemblyVersion>2.0.0</AssemblyVersion>
<FileVersion>2.0.0</FileVersion>
<Version>2.0.2</Version>
<AssemblyVersion>2.0.2</AssemblyVersion>
<FileVersion>2.0.2</FileVersion>

<OutputPath>..\bin\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
6 changes: 3 additions & 3 deletions ScreenCapture.NET.X11/ScreenCapture.NET.X11.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<PackageReleaseNotes>
</PackageReleaseNotes>

<Version>2.0.0</Version>
<AssemblyVersion>2.0.0</AssemblyVersion>
<FileVersion>2.0.0</FileVersion>
<Version>2.0.2</Version>
<AssemblyVersion>2.0.2</AssemblyVersion>
<FileVersion>2.0.2</FileVersion>

<OutputPath>..\bin\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
11 changes: 10 additions & 1 deletion ScreenCapture.NET/Model/CaptureZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,21 @@ public sealed class CaptureZone<TColor> : ICaptureZone
/// <inheritdoc />
public Display Display { get; }

#if NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat ColorFormat
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => TColor.ColorFormat;
}
#else
/// <inheritdoc />
public ColorFormat ColorFormat
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => default(TColor).Net6ColorFormat;
}
#endif

/// <inheritdoc />
public int X { get; internal set; }
Expand Down Expand Up @@ -95,7 +104,7 @@ IImage ICaptureZone.Image
/// <inheritdoc />
public bool IsUpdateRequested { get; private set; }

#endregion
#endregion

#region Events

Expand Down
7 changes: 6 additions & 1 deletion ScreenCapture.NET/Model/Colors/ColorABGR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ namespace ScreenCapture.NET;
/// <inheritdoc />
public static ColorFormat ColorFormat => ColorFormat.ABGR;

#if !NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat Net6ColorFormat => ColorFormat;
#endif

private readonly byte _a;
private readonly byte _b;
private readonly byte _g;
Expand All @@ -39,7 +44,7 @@ namespace ScreenCapture.NET;
#endregion

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="ColorABGR"/> class.
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion ScreenCapture.NET/Model/Colors/ColorARGB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
public readonly struct ColorARGB : IColor
{
#region Properties & Fields

/// <inheritdoc />
public static ColorFormat ColorFormat => ColorFormat.ARGB;

#if !NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat Net6ColorFormat => ColorFormat;
#endif

private readonly byte _a;
private readonly byte _r;
private readonly byte _g;
Expand Down
7 changes: 6 additions & 1 deletion ScreenCapture.NET/Model/Colors/ColorBGR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
public readonly struct ColorBGR : IColor
{
#region Properties & Fields

/// <inheritdoc />
public static ColorFormat ColorFormat => ColorFormat.BGR;

#if !NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat Net6ColorFormat => ColorFormat;
#endif

private readonly byte _b;
private readonly byte _g;
private readonly byte _r;
Expand Down
9 changes: 7 additions & 2 deletions ScreenCapture.NET/Model/Colors/ColorBGRA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
public readonly struct ColorBGRA : IColor
{
#region Properties & Fields

/// <inheritdoc />
public static ColorFormat ColorFormat => ColorFormat.BGRA;

#if !NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat Net6ColorFormat => ColorFormat;
#endif

private readonly byte _b;
private readonly byte _g;
private readonly byte _r;
Expand All @@ -36,7 +41,7 @@ namespace ScreenCapture.NET;
public byte A => _a;
// ReSharper restore ConvertToAutoPropertyWhenPossible

#endregion
#endregion

#region Constructors

Expand Down
7 changes: 6 additions & 1 deletion ScreenCapture.NET/Model/Colors/ColorRGB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ namespace ScreenCapture.NET;
public readonly struct ColorRGB : IColor
{
#region Properties & Fields

/// <inheritdoc />
public static ColorFormat ColorFormat => ColorFormat.RGB;

#if !NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat Net6ColorFormat => ColorFormat;
#endif

private readonly byte _r;
private readonly byte _g;
private readonly byte _b;
Expand Down
5 changes: 5 additions & 0 deletions ScreenCapture.NET/Model/Colors/ColorRGBA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ namespace ScreenCapture.NET;
/// <inheritdoc />
public static ColorFormat ColorFormat => ColorFormat.RGBA;

#if !NET7_0_OR_GREATER
/// <inheritdoc />
public ColorFormat Net6ColorFormat => ColorFormat;
#endif

private readonly byte _r;
private readonly byte _g;
private readonly byte _b;
Expand Down
4 changes: 4 additions & 0 deletions ScreenCapture.NET/Model/Colors/IColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ public interface IColor
/// </summary>
byte A { get; }

#if NET7_0_OR_GREATER
/// <summary>
/// Gets the color-format of this color.
/// </summary>
public static virtual ColorFormat ColorFormat => throw new NotSupportedException();
#else
public ColorFormat Net6ColorFormat { get; }
#endif
}
29 changes: 26 additions & 3 deletions ScreenCapture.NET/Model/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,21 @@ public sealed class Image<TColor> : IImage
private readonly int _y;
private readonly int _stride;

#if NET7_0_OR_GREATER
/// <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 />
public int Width { get; }
Expand All @@ -28,7 +41,7 @@ public sealed class Image<TColor> : IImage
public int Height { get; }

/// <inheritdoc />
public int SizeInBytes => Width * Height * TColor.ColorFormat.BytesPerPixel;
public int SizeInBytes => Width * Height * ColorFormat.BytesPerPixel;

#endregion

Expand Down Expand Up @@ -96,7 +109,7 @@ public void CopyTo(in Span<byte> 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));

int targetStride = Width * TColor.ColorFormat.BytesPerPixel;
int targetStride = Width * ColorFormat.BytesPerPixel;
IImage.IImageRows rows = Rows;
Span<byte> target = destination;
foreach (IImage.IImageRow row in rows)
Expand Down Expand Up @@ -211,8 +224,13 @@ private sealed class ImageRow : IImage.IImageRow
/// <inheritdoc />
public int Length => _length;

#if NET7_0_OR_GREATER
/// <inheritdoc />
public int SizeInBytes => Length * TColor.ColorFormat.BytesPerPixel;
#else
/// <inheritdoc />
public int SizeInBytes => Length * default(TColor).Net6ColorFormat.BytesPerPixel;
#endif

#endregion

Expand Down Expand Up @@ -349,8 +367,13 @@ private sealed class ImageColumn : IImage.IImageColumn
/// <inheritdoc />
public int Length => _length;

#if NET7_0_OR_GREATER
/// <inheritdoc />
public int SizeInBytes => Length * TColor.ColorFormat.BytesPerPixel;
#else
/// <inheritdoc />
public int SizeInBytes => Length * default(TColor).Net6ColorFormat.BytesPerPixel;
#endif

#endregion

Expand Down
8 changes: 4 additions & 4 deletions ScreenCapture.NET/ScreenCapture.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>

<PackageReleaseNotes>
Reworked most of the data handling and splitted capture-logic into separate packages.
Fixed issues with .NET 6
</PackageReleaseNotes>

<Version>2.0.1</Version>
<AssemblyVersion>2.0.1</AssemblyVersion>
<FileVersion>2.0.1</FileVersion>
<Version>2.0.2</Version>
<AssemblyVersion>2.0.2</AssemblyVersion>
<FileVersion>2.0.2</FileVersion>

<OutputPath>..\bin\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
Expand Down