mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-13 05:48:39 +00:00
Added ToArray to Image
This commit is contained in:
parent
1782c83415
commit
ba5233be6f
@ -38,7 +38,7 @@ public readonly ref struct Image<TColor>
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if ((x < 0) || (y < 0) || ((x + width) > Width) || ((y + height) > Height)) throw new IndexOutOfRangeException();
|
if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0) || ((x + width) > Width) || ((y + height) > Height)) throw new IndexOutOfRangeException();
|
||||||
|
|
||||||
return new Image<TColor>(_pixels, _x + x, _y + y, width, height, _stride);
|
return new Image<TColor>(_pixels, _x + x, _y + y, width, height, _stride);
|
||||||
}
|
}
|
||||||
@ -87,6 +87,13 @@ public readonly ref struct Image<TColor>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TColor[] ToArray()
|
||||||
|
{
|
||||||
|
TColor[] array = new TColor[Width * Height];
|
||||||
|
CopyTo(array);
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Indexer-Structs
|
#region Indexer-Structs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user