mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-12 13:28:35 +00:00
Compare commits
4 Commits
f5881432fe
...
ae6cf5c7c2
| Author | SHA1 | Date | |
|---|---|---|---|
| ae6cf5c7c2 | |||
|
|
a53623e136 | ||
|
|
183f02da94 | ||
|
|
47055de4f2 |
@ -26,14 +26,14 @@ IEnumerable<Display> displays = screenCaptureService.GetDisplays(graphicsCards.F
|
|||||||
// Create a screen-capture for all screens you want to capture
|
// Create a screen-capture for all screens you want to capture
|
||||||
IScreenCapture screenCapture = screenCaptureService.GetScreenCapture(displays.First());
|
IScreenCapture screenCapture = screenCaptureService.GetScreenCapture(displays.First());
|
||||||
|
|
||||||
// Register the regions you want to capture om the screen
|
// Register the regions you want to capture on the screen
|
||||||
// Capture the whole screen
|
// Capture the whole screen
|
||||||
ICaptureZone fullscreen = screenCapture.RegisterCaptureZone(0, 0, screenCapture.Display.Width, screenCapture.Display.Height);
|
ICaptureZone fullscreen = screenCapture.RegisterCaptureZone(0, 0, screenCapture.Display.Width, screenCapture.Display.Height);
|
||||||
// Capture a 100x100 region at the top left and scale it down to 50x50
|
// Capture a 100x100 region at the top left and scale it down to 50x50
|
||||||
ICaptureZone topLeft = screenCapture.RegisterCaptureZone(0, 0, 100, 100, downscaleLevel: 1);
|
ICaptureZone topLeft = screenCapture.RegisterCaptureZone(0, 0, 100, 100, downscaleLevel: 1);
|
||||||
|
|
||||||
// Capture the screen
|
// Capture the screen
|
||||||
// This should be done in a loop on a seperate thread as CaptureScreen blocks if the screen is not updated (still image).
|
// This should be done in a loop on a separate thread as CaptureScreen blocks if the screen is not updated (still image).
|
||||||
screenCapture.CaptureScreen();
|
screenCapture.CaptureScreen();
|
||||||
|
|
||||||
// Do something with the captured image - e.g. access all pixels (same could be done with topLeft)
|
// Do something with the captured image - e.g. access all pixels (same could be done with topLeft)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public abstract class AbstractScreenCapture<TColor> : IScreenCapture
|
|||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of <see cref="CaptureZone{TColol}"/> registered on this ScreenCature.
|
/// Gets a list of <see cref="CaptureZone{TColol}"/> registered on this ScreenCapture.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected HashSet<CaptureZone<TColor>> CaptureZones { get; } = new();
|
protected HashSet<CaptureZone<TColor>> CaptureZones { get; } = new();
|
||||||
|
|
||||||
@ -244,4 +244,4 @@ public abstract class AbstractScreenCapture<TColor> : IScreenCapture
|
|||||||
protected virtual void Dispose(bool disposing) { }
|
protected virtual void Dispose(bool disposing) { }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public interface IScreenCapture : IDisposable
|
|||||||
event EventHandler<ScreenCaptureUpdatedEventArgs>? Updated;
|
event EventHandler<ScreenCaptureUpdatedEventArgs>? Updated;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attemts to capture the current frame showed on the <see cref="Display"/>.
|
/// Attempts to capture the current frame showed on the <see cref="Display"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if the current frame was captures successfully; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the current frame was captures successfully; otherwise, <c>false</c>.</returns>
|
||||||
bool CaptureScreen();
|
bool CaptureScreen();
|
||||||
@ -59,4 +59,4 @@ public interface IScreenCapture : IDisposable
|
|||||||
/// Restarts the <see cref="IScreenCapture"/>.
|
/// Restarts the <see cref="IScreenCapture"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Restart();
|
void Restart();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user