Пример #1
0
 /// <summary>
 /// Return a <see cref="Buffer2DRegion{T}"/> to the subregion represented by 'rectangle'
 /// </summary>
 /// <typeparam name="T">The element type</typeparam>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
 /// <param name="rectangle">The rectangle subregion</param>
 /// <returns>The <see cref="Buffer2DRegion{T}"/></returns>
 internal static Buffer2DRegion <T> GetRegion <T>(this Buffer2D <T> buffer, Rectangle rectangle)
     where T : unmanaged =>
 new Buffer2DRegion <T>(buffer, rectangle);
Пример #2
0
 internal static Buffer2DRegion <T> GetRegion <T>(this Buffer2D <T> buffer, int x, int y, int width, int height)
     where T : unmanaged =>
 new Buffer2DRegion <T>(buffer, new Rectangle(x, y, width, height));
Пример #3
0
 /// <summary>
 /// Gets the backing <see cref="IMemoryGroup{T}"/>.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 /// <typeparam name="T">The element type.</typeparam>
 /// <returns>The MemoryGroup.</returns>
 public static IMemoryGroup <T> GetMemoryGroup <T>(this Buffer2D <T> buffer)
     where T : struct
 {
     Guard.NotNull(buffer, nameof(buffer));
     return(buffer.FastMemoryGroup.View);
 }
Пример #4
0
 /// <summary>
 /// Returns a <see cref="Rectangle"/> representing the full area of the buffer.
 /// </summary>
 /// <typeparam name="T">The element type</typeparam>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
 /// <returns>The <see cref="Rectangle"/></returns>
 internal static Rectangle FullRectangle <T>(this Buffer2D <T> buffer)
     where T : struct
 {
     return(new Rectangle(0, 0, buffer.Width, buffer.Height));
 }
Пример #5
0
 /// <summary>
 /// Return a <see cref="Buffer2DRegion{T}"/> to the whole area of 'buffer'
 /// </summary>
 /// <typeparam name="T">The element type</typeparam>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
 /// <returns>The <see cref="Buffer2DRegion{T}"/></returns>
 internal static Buffer2DRegion <T> GetRegion <T>(this Buffer2D <T> buffer)
     where T : unmanaged =>
 new Buffer2DRegion <T>(buffer);
Пример #6
0
 /// <summary>
 /// Returns the size of the buffer.
 /// </summary>
 /// <typeparam name="T">The element type</typeparam>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
 /// <returns>The <see cref="Size{T}"/> of the buffer</returns>
 internal static Size Size <T>(this Buffer2D <T> buffer)
     where T : struct
 {
     return(new Size(buffer.Width, buffer.Height));
 }
Пример #7
0
 public static Memory <T> GetRowMemory <T>(this Buffer2D <T> buffer, int y)
     where T : struct
 {
     Guard.NotNull(buffer, nameof(buffer));
     return(buffer.MemorySource.Memory.Slice(y * buffer.Width, buffer.Width));
 }
Пример #8
0
 public BufferArea(Buffer2D <T> destinationBuffer)
     : this(destinationBuffer, destinationBuffer.FullRectangle())
 {
 }
Пример #9
0
 /// <summary>
 /// Gets the <see cref="Memory{T}"/> holding the backing buffer of <paramref name="buffer"/>.
 /// </summary>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/>.</param>
 /// <typeparam name="T">The value type.</typeparam>
 /// <returns>The <see cref="Memory{T}"/>.</returns>
 public static Memory <T> GetMemory <T>(this Buffer2D <T> buffer)
     where T : struct
 {
     Guard.NotNull(buffer, nameof(buffer));
     return(buffer.MemorySource.Memory);
 }
Пример #10
0
 public static Span <T> GetRowSpan <T>(this Buffer2D <T> buffer, int y)
     where T : struct
 {
     Guard.NotNull(buffer, nameof(buffer));
     return(buffer.GetSpan().Slice(y * buffer.Width, buffer.Width));
 }
Пример #11
0
 /// <summary>
 /// Gets a span for all the pixels in <paramref name="buffer"/> defined by <paramref name="rows"/>
 /// </summary>
 internal static Span <T> GetMultiRowSpan <T>(this Buffer2D <T> buffer, in RowInterval rows)
Пример #12
0
 /// <summary>
 /// Return a <see cref="BufferArea{T}"/> to the whole area of 'buffer'
 /// </summary>
 /// <typeparam name="T">The element type</typeparam>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
 /// <returns>The <see cref="BufferArea{T}"/></returns>
 internal static BufferArea <T> GetArea <T>(this Buffer2D <T> buffer)
     where T : struct =>
 new BufferArea <T>(buffer);
Пример #13
0
 internal static BufferArea <T> GetArea <T>(this Buffer2D <T> buffer, int x, int y, int width, int height)
     where T : struct =>
 new BufferArea <T>(buffer, new Rectangle(x, y, width, height));
Пример #14
0
 /// <summary>
 /// Return a <see cref="BufferArea{T}"/> to the subarea represented by 'rectangle'
 /// </summary>
 /// <typeparam name="T">The element type</typeparam>
 /// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
 /// <param name="rectangle">The rectangle subarea</param>
 /// <returns>The <see cref="BufferArea{T}"/></returns>
 internal static BufferArea <T> GetArea <T>(this Buffer2D <T> buffer, in Rectangle rectangle)
Пример #15
0
 public Buffer2DRegion(Buffer2D <T> buffer)
     : this(buffer, buffer.FullRectangle())
 {
 }