예제 #1
0
        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;
 }
예제 #3
0
        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;
 }
예제 #5
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="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);
예제 #6
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="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);
예제 #7
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="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));
 }
예제 #8
0
 /// <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));
 }
예제 #9
0
 public static Span <T> GetRowSpan <T>(this IBuffer2D <T> buffer, int y)
     where T : struct
 {
     return(buffer.Span.Slice(y * buffer.Width, buffer.Width));
 }
예제 #10
0
 public BufferArea(IBuffer2D <T> destinationBuffer)
     : this(destinationBuffer, destinationBuffer.FullRectangle())
 {
 }
예제 #11
0
 public FloatTexture(IBuffer2D <float> buffer)
     : this(buffer, TextureBufferUtil.Bilinear)
 {
 }
예제 #12
0
 public FloatTexture(IBuffer2D <float> buffer, InterpolateFunc f)
     : base(buffer)
 {
     this.f = f;
 }
예제 #13
0
 public TextureBuffer(IBuffer2D <T> buffer)
 {
     this.buffer = buffer;
 }