@@ -26,14 +26,14 @@ IEnumerable<Display> displays = screenCaptureService.GetDisplays(graphicsCards.F
2626// Create a screen-capture for all screens you want to capture
2727IScreenCapture screenCapture = screenCaptureService .GetScreenCapture (displays .First ());
2828
29- // Register the regions you want to capture om the screen
29+ // Register the regions you want to capture on the screen
3030// Capture the whole screen
3131ICaptureZone fullscreen = screenCapture .RegisterCaptureZone (0 , 0 , screenCapture .Display .Width , screenCapture .Display .Height );
3232// Capture a 100x100 region at the top left and scale it down to 50x50
3333ICaptureZone topLeft = screenCapture .RegisterCaptureZone (0 , 0 , 100 , 100 , downscaleLevel : 1 );
3434
3535// Capture the screen
36- // This should be done in a loop on a seperate thread as CaptureScreen blocks if the screen is not updated (still image).
36+ // This should be done in a loop on a separate thread as CaptureScreen blocks if the screen is not updated (still image).
3737screenCapture .CaptureScreen ();
3838
3939// Do something with the captured image - e.g. access all pixels (same could be done with topLeft)
@@ -57,12 +57,12 @@ using (fullscreen.Lock())
5757 IColor imageColorExample = image [10 , 20 ];
5858
5959 // Get the first row
60- IImage . IImageRow row = image .Rows [0 ];
60+ IImageRow row = image .Rows [0 ];
6161 // Get the 10th pixel of the row
6262 IColor rowColorExample = row [10 ];
6363
6464 // Get the first column
65- IImage . IImageColumn column = image .Columns [0 ];
65+ IImageColumn column = image .Columns [0 ];
6666 // Get the 10th pixel of the column
6767 IColor columnColorExample = column [10 ];
6868
@@ -73,7 +73,7 @@ using (fullscreen.Lock())
7373 }
7474```
7575
76- IF you know which Capture-provider you're using it performs a bit better to not use the abstraction but a more low-level approach instead.
76+ If you know which Capture-provider you're using it performs a bit better to not use the abstraction but a more low-level approach instead.
7777This is the same example as above but without using the interfaces:
7878``` csharp
7979DX11ScreenCaptureService screenCaptureService = new DX11ScreenCaptureService ();
@@ -88,17 +88,20 @@ screenCapture.CaptureScreen();
8888
8989using (fullscreen .Lock ())
9090{
91- RefImage < ColorBGRA > image = fullscreen .Image ;
91+ IImage < ColorBGRA > image = fullscreen .Image ;
92+
93+ // You can also get a ref image which has a slight performance benefit in some cases
94+ // RefImage<ColorBGRA> refImage = image.AsRefImage();
9295
9396 foreach (ColorBGRA color in image )
9497 Console .WriteLine ($" A: {color .A }, R: {color .R }, G: {color .G }, B: {color .B }" );
9598
9699 ColorBGRA imageColorExample = image [10 , 20 ];
97100
98- ReadOnlyRefEnumerable < ColorBGRA > row = image .Rows [0 ];
101+ ImageRow < ColorBGRA > row = image .Rows [0 ];
99102 ColorBGRA rowColorExample = row [10 ];
100103
101- ReadOnlyRefEnumerable < ColorBGRA > column = image .Columns [0 ];
104+ ImageColumn < ColorBGRA > column = image .Columns [0 ];
102105 ColorBGRA columnColorExample = column [10 ];
103106
104107 RefImage < ColorBGRA > subImage = image [100 , 150 , 400 , 300 ];
0 commit comments