RobustChart.FrameBuffer
Namespace: SnowBank.Numerics · struct
Implements: IFormattable
Buffer use for rendering a frame
Constructors
FrameBuffer
FrameBuffer(int width, int height)
Constructs a new FrameBuffer
FrameBuffer(char[] buffer, int width, int height)
Constructs a new FrameBuffer
Methods
CombineHorizontal
static FrameBuffer CombineHorizontal(FrameBuffer left, FrameBuffer right, int pad = 0)
Stitch to frames horizontally
left— Frame that goes to the leftright— Frame that goes to the rightpad— Optional padding inserted between the frames
Returns: Frame with both frames stacked horizontally
CombineVertical
static FrameBuffer CombineVertical(FrameBuffer top, FrameBuffer bottom, int pad = 0)
Stitch to frames vertically
top— Frame that goes to the topbottom— Frame that goes to the bottompad— Optional padding inserted between the frames
Returns: Frame with both frames stacked vertically
DrawFrame
void DrawFrame(int x, int y, FrameBuffer image)
Copies another frame into this frame
x— X coordinate (left) where to draw the imagey— Y coordinate (bottom) where to draw the imageimage— Image to copy (truncated to fit)
DrawText
void DrawText(int x, int y, string text, int align = 0)
Writes a text label
DrawXAxis
void DrawXAxis(int w, int x0 = 0, int y0 = 0, char c = '-', char start = '+', char end = '>')
Draws the X axis (horizontal)
DrawXGridLine
void DrawXGridLine(int w, int x0 = 0, int y0 = 0, char c = '.', char start = '+', char end = '�')
Draws the vertical grid lines for the X axis
DrawYAxis
void DrawYAxis(int h, int x0 = 0, int y0 = 0, char c = '|', char start = '+', char end = '^')
Draws the Y axis (vertical)
DrawYGridLine
void DrawYGridLine(int h, int x0 = 0, int y0 = 0, char c = ':', char start = '+', char end = '�')
Draws the horizontal grid lines for the Y axis
HorizontalLine
void HorizontalLine(double x0, double y0, double x1, char c = '.')
Draws a horizontal line
x0— Left X coordinatey0— Y coordinatex1— Right X coordinatec— "Color" of this line
Output
void Output(StringBuilder output, string prefix = null, string suffix = " ")
Output the frame into a StringBuilder
output— Destination bufferprefix— Text added to the start of each linesuffix— Text added to the end of each line
Set
void Set(double x, double y, char c)
Sets the value of the texel at the given coordinates
x— X coordinate (0 = left)y— Y coordinate (0 = bottom)c— "Color" of this texel
void Set(int x, int y, char c)
Sets the value of the texel at the given coordinates
x— X coordinate (0 = left)y— Y coordinate (0 = bottom)c— "Color" of this texel
ToString
string ToString()
Renders the frame into a multi-line string
string ToString(string format, IFormatProvider formatProvider = null)
Renders the frame into a multi-line string
VerticalLine
void VerticalLine(double x0, double y0, double y1, char c = ':')
Draws a vertical line
x0— X coordinatey0— Bottom Y coordinatey1— Top Y coordinatec— "Color" of this line
Fields
Buffer
readonly char[] Buffer
Flatten texels array, grouped by row, with top-most row first, and the bottom-most row last)
The texel (X, Y) is located at offset (HEIGHT - Y - 1) * WIDTH + X
Height
readonly int Height
Height of the buffer (in texels)
Width
readonly int Width
Width of the buffer (in texels)