Patrik Svensson 8e4f33bba4 Added initial support for rendering composites
This is far from complete, but it's a start
and it will enable us to create things like tables
and other complex objects in the long run.
2020-07-30 22:55:42 +02:00

28 lines
913 B
C#

using System.Collections.Generic;
using System.Text;
namespace Spectre.Console.Composition
{
/// <summary>
/// Represents something that can be rendered to the console.
/// </summary>
public interface IRenderable
{
/// <summary>
/// Measures the renderable object.
/// </summary>
/// <param name="encoding">The encoding to use.</param>
/// <param name="maxWidth">The maximum allowed width.</param>
/// <returns>The width of the object.</returns>
int Measure(Encoding encoding, int maxWidth);
/// <summary>
/// Renders the object.
/// </summary>
/// <param name="encoding">The encoding to use.</param>
/// <param name="width">The width of the render area.</param>
/// <returns>A collection of segments.</returns>
IEnumerable<Segment> Render(Encoding encoding, int width);
}
}