mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-13 05:48:39 +00:00
Removed Id from CaptureZone
This commit is contained in:
parent
946dafe649
commit
18e562508e
@ -10,7 +10,6 @@ public abstract class AbstractScreenCapture<TColor> : IScreenCapture
|
|||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
private int _indexCounter = 0;
|
|
||||||
|
|
||||||
protected HashSet<CaptureZone<TColor>> CaptureZones { get; } = new();
|
protected HashSet<CaptureZone<TColor>> CaptureZones { get; } = new();
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ public abstract class AbstractScreenCapture<TColor> : IScreenCapture
|
|||||||
int unscaledHeight = height;
|
int unscaledHeight = height;
|
||||||
(width, height, downscaleLevel) = CalculateScaledSize(unscaledWidth, unscaledHeight, downscaleLevel);
|
(width, height, downscaleLevel) = CalculateScaledSize(unscaledWidth, unscaledHeight, downscaleLevel);
|
||||||
|
|
||||||
CaptureZone<TColor> captureZone = new(_indexCounter++, Display, x, y, width, height, downscaleLevel, unscaledWidth, unscaledHeight);
|
CaptureZone<TColor> captureZone = new(Display, x, y, width, height, downscaleLevel, unscaledWidth, unscaledHeight);
|
||||||
CaptureZones.Add(captureZone);
|
CaptureZones.Add(captureZone);
|
||||||
|
|
||||||
return captureZone;
|
return captureZone;
|
||||||
|
|||||||
@ -17,13 +17,8 @@ public sealed class CaptureZone<TColor> : ICaptureZone
|
|||||||
|
|
||||||
private readonly object _lock = new();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the unique id of this <see cref="CaptureZone{T}"/>.
|
|
||||||
/// </summary>
|
|
||||||
public int Id { get; }
|
|
||||||
|
|
||||||
public Display Display { get; }
|
public Display Display { get; }
|
||||||
|
|
||||||
public ColorFormat ColorFormat
|
public ColorFormat ColorFormat
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@ -133,9 +128,8 @@ public sealed class CaptureZone<TColor> : ICaptureZone
|
|||||||
/// <param name="unscaledWidth">The original width of the region.</param>
|
/// <param name="unscaledWidth">The original width of the region.</param>
|
||||||
/// <param name="unscaledHeight">The original height of the region</param>
|
/// <param name="unscaledHeight">The original height of the region</param>
|
||||||
/// <param name="buffer">The buffer containing the image data.</param>
|
/// <param name="buffer">The buffer containing the image data.</param>
|
||||||
internal CaptureZone(int id, Display display, int x, int y, int width, int height, int downscaleLevel, int unscaledWidth, int unscaledHeight)
|
internal CaptureZone(Display display, int x, int y, int width, int height, int downscaleLevel, int unscaledWidth, int unscaledHeight)
|
||||||
{
|
{
|
||||||
this.Id = id;
|
|
||||||
this.Display = display;
|
this.Display = display;
|
||||||
this.X = x;
|
this.X = x;
|
||||||
this.Y = y;
|
this.Y = y;
|
||||||
@ -195,19 +189,6 @@ public sealed class CaptureZone<TColor> : ICaptureZone
|
|||||||
InternalBuffer = new byte[newBufferSize];
|
InternalBuffer = new byte[newBufferSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether this <see cref="CaptureZone{T}"/> equals the given one.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">The <see cref="CaptureZone{T}"/> to compare.</param>
|
|
||||||
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
|
|
||||||
public bool Equals(CaptureZone<TColor> other) => Id == other.Id;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override bool Equals(object? obj) => obj is CaptureZone<TColor> other && Equals(other);
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override int GetHashCode() => Id;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private class UnlockDisposable : IDisposable
|
private class UnlockDisposable : IDisposable
|
||||||
|
|||||||
@ -4,11 +4,6 @@ namespace ScreenCapture.NET;
|
|||||||
|
|
||||||
public interface ICaptureZone
|
public interface ICaptureZone
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets the unique id of this <see cref="ICaptureZone"/>.
|
|
||||||
/// </summary>
|
|
||||||
int Id { get; }
|
|
||||||
|
|
||||||
Display Display { get; }
|
Display Display { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the x-location of the region on the screen.
|
/// Gets the x-location of the region on the screen.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user