public static BufferArea <T> GetArea <T>(this IBuffer2D <T> buffer, int x, int y, int width, int height) where T : struct { var rectangle = new Rectangle(x, y, width, height); return(new BufferArea <T>(buffer, rectangle)); }
// Create a new move component public MoveComponent( int x, int y, int maxX, int maxY, IBuffer2D <char> buffer) { this.maxX = maxX; this.maxY = maxY; this.x = x; this.y = y; this.buffer = buffer; }
public BufferArea(IBuffer2D <T> destinationBuffer, Rectangle rectangle) { DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.X, 0, nameof(rectangle)); DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.Y, 0, nameof(rectangle)); DebugGuard.MustBeLessThanOrEqualTo(rectangle.Width, destinationBuffer.Width, nameof(rectangle)); DebugGuard.MustBeLessThanOrEqualTo(rectangle.Height, destinationBuffer.Height, nameof(rectangle)); this.DestinationBuffer = destinationBuffer; this.Rectangle = rectangle; }
// Create a new background component public BackgroundComponent(IBuffer2D <char> buffer, int maxX, int maxY) { this.maxX = maxX; this.maxY = maxY; this.buffer = buffer; }
/// <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="IBuffer2D{T}"/></param> /// <returns>The <see cref="BufferArea{T}"/></returns> public static BufferArea <T> GetArea <T>(this IBuffer2D <T> buffer) where T : struct => new BufferArea <T>(buffer);
/// <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="IBuffer2D{T}"/></param> /// <param name="rectangle">The rectangle subarea</param> /// <returns>The <see cref="BufferArea{T}"/></returns> public static BufferArea <T> GetArea <T>(this IBuffer2D <T> buffer, Rectangle rectangle) where T : struct => new BufferArea <T>(buffer, rectangle);
/// <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="IBuffer2D{T}"/></param> /// <returns>The <see cref="Rectangle"/></returns> public static Rectangle FullRectangle <T>(this IBuffer2D <T> buffer) where T : struct { return(new Rectangle(0, 0, buffer.Width, buffer.Height)); }
/// <summary> /// Returns the size of the buffer. /// </summary> /// <typeparam name="T">The element type</typeparam> /// <param name="buffer">The <see cref="IBuffer2D{T}"/></param> /// <returns>The <see cref="Size{T}"/> of the buffer</returns> public static Size Size <T>(this IBuffer2D <T> buffer) where T : struct { return(new Size(buffer.Width, buffer.Height)); }
public static Span <T> GetRowSpan <T>(this IBuffer2D <T> buffer, int y) where T : struct { return(buffer.Span.Slice(y * buffer.Width, buffer.Width)); }
public BufferArea(IBuffer2D <T> destinationBuffer) : this(destinationBuffer, destinationBuffer.FullRectangle()) { }
public FloatTexture(IBuffer2D <float> buffer) : this(buffer, TextureBufferUtil.Bilinear) { }
public FloatTexture(IBuffer2D <float> buffer, InterpolateFunc f) : base(buffer) { this.f = f; }
public TextureBuffer(IBuffer2D <T> buffer) { this.buffer = buffer; }