Class Canvas
A general-purpose drawing surface that can be latter draw onto any object that implements IDrawSurface. Supports multiple types of drawing operations most commonly used in terminal apps.
Inherited Members
Namespace: Sharpie
Assembly: sharpie.dll
Syntax
[PublicAPI]
public sealed class Canvas : IDrawable, IDrawSurface
Constructors
Canvas(Size)
Creates a new instances of this class with a given surface size
.
Declaration
public Canvas(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size of the drawing. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Properties
Size
The size of the drawable.
Declaration
public Size Size { get; }
Property Value
Type | Description |
---|---|
Size |
Methods
Box(Rectangle, LineStyle, Style)
Draws a rectangle starting in a given perimeter
.
Declaration
public void Box(Rectangle perimeter, Canvas.LineStyle lineStyle, Style style)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | perimeter | The box perimeter. |
Canvas.LineStyle | lineStyle | The line style. |
Style | style | The text style. |
DrawOnto(IDrawSurface, Rectangle, Point)
Draws the drawable onto a given surface.
Declaration
public void DrawOnto(IDrawSurface destination, Rectangle srcArea, Point destLocation)
Parameters
Type | Name | Description |
---|---|---|
IDrawSurface | destination | The surface to draw on. |
Rectangle | srcArea | The source area to draw. |
Point | destLocation | The destination location. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Fill(Rectangle, ShadeGlyphStyle, Style)
Fills a given area
with a given shadeGlyph
and
style
.
Declaration
public void Fill(Rectangle area, Canvas.ShadeGlyphStyle shadeGlyph, Style style)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | area | The area to fill. |
Canvas.ShadeGlyphStyle | shadeGlyph | The share to draw. |
Style | style | The cell style. |
Fill(Rectangle, Rune, Style)
Fills a given area
with a given rune
and style
.
Declaration
public void Fill(Rectangle area, Rune rune, Style style)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | area | The area to fill. |
Rune | rune | The rune to draw. |
Style | style | The cell style. |
Glyph(Point, CheckGlyphStyle, FillStyle, Style)
Draws a glyph at a given location
using the provide styles.
Declaration
public void Glyph(Point location, Canvas.CheckGlyphStyle checkGlyphStyle, Canvas.FillStyle fillStyle, Style style)
Parameters
Type | Name | Description |
---|---|---|
Point | location | The cell location. |
Canvas.CheckGlyphStyle | checkGlyphStyle | The check style of the glyph. |
Canvas.FillStyle | fillStyle | The fill style of the glyph. |
Style | style | The cell style. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
Glyph(Point, GradientGlyphStyle, int, Style)
Draws a glyph at a given location
using the provide gradient style and fill count.
Declaration
public void Glyph(Point location, Canvas.GradientGlyphStyle gradientGlyphStyle, int fill, Style style)
Parameters
Type | Name | Description |
---|---|---|
Point | location | The cell location. |
Canvas.GradientGlyphStyle | gradientGlyphStyle | The gradient style. |
int | fill | The glyph fill count. |
Style | style | The cell style. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Glyph(Point, TriangleGlyphStyle, GlyphSize, FillStyle, Style)
Draws a glyph at a given location
using the provide styles.
Declaration
public void Glyph(Point location, Canvas.TriangleGlyphStyle triangleGlyphStyle, Canvas.GlyphSize glyphSize, Canvas.FillStyle fillStyle, Style style)
Parameters
Type | Name | Description |
---|---|---|
Point | location | The cell location. |
Canvas.TriangleGlyphStyle | triangleGlyphStyle | The orientation of the glyph. |
Canvas.GlyphSize | glyphSize | The glyph size. |
Canvas.FillStyle | fillStyle | The fill style of the glyph. |
Style | style | The cell style. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
Glyph(Point, Rune, Style)
Draws a glyph at a given location
using the given text style.
Declaration
public void Glyph(Point location, Rune rune, Style style)
Parameters
Type | Name | Description |
---|---|---|
Point | location | The cell location. |
Rune | rune | The rune to draw. |
Style | style | The text style. |
Line(PointF, PointF, Style)
Draws a line between two points in the drawing using block characters.
Declaration
public void Line(PointF startLocation, PointF endLocation, Style style)
Parameters
Type | Name | Description |
---|---|---|
PointF | startLocation | The starting cell. |
PointF | endLocation | The ending cell. |
Style | style | The cell style. |
Line(PointF, float, Orientation, LineStyle, Style)
Draws a line starting at a given starting at a given point vertically or horizontally using line drawing characters.
Declaration
public void Line(PointF location, float length, Canvas.Orientation orientation, Canvas.LineStyle lineStyle, Style style)
Parameters
Type | Name | Description |
---|---|---|
PointF | location | The start location. |
float | length | The length of the line. |
Canvas.Orientation | orientation | The line orientation. |
Canvas.LineStyle | lineStyle | The line style. |
Style | style | The cell style. |
Point(PointF, Style)
Draws a block-based point in the given location
.
Declaration
public void Point(PointF location, Style style)
Parameters
Type | Name | Description |
---|---|---|
PointF | location | The location of the point. |
Style | style | The text style to use. |
Rectangle(RectangleF, Style)
Draws a block-based rectangle in the given area
.
Declaration
public void Rectangle(RectangleF area, Style style)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | area | The area of the rectangle. |
Style | style | The text style to use. |
Text(Point, string, Orientation, Style)
Writes a given text
into the drawing. If the text length exceed the available space,
it is cropped.
Declaration
public void Text(Point location, string text, Canvas.Orientation orientation, Style style)
Parameters
Type | Name | Description |
---|---|---|
Point | location | The start location of the text. |
string | text | The text. |
Canvas.Orientation | orientation | The orientation for the text. |
Style | style | The text style. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |