Interface ISurface
Inherited Members
Namespace: Sharpie.Abstractions
Assembly: sharpie.dll
Syntax
[PublicAPI]
public interface ISurface : IDrawSurface
Properties
Background
Gets or sets the surface background.
Declaration
(Rune @char, Style style) Background { get; set; }
Property Value
| Type | Description |
|---|---|
| (Rune char, Style style) |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
CaretLocation
Gets or sets the current position of the caret within the surface.
Declaration
Point CaretLocation { get; set; }
Property Value
| Type | Description |
|---|---|
| Point |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
ColorMixture
Gets or sets the color mixture of the surface.
Declaration
ColorMixture ColorMixture { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorMixture |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Dirty
Specifies whether the surface has some "dirty" parts that need to be synchronized to the console.
Declaration
bool Dirty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Disposed
Checks if the surface has been disposed and is no longer usable.
Declaration
bool Disposed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Handle
The Curses handle for the surface.
Declaration
nint Handle { get; }
Property Value
| Type | Description |
|---|---|
| nint |
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
ManagedCaret
Controls whether the caret is managed by the application and should not be managed by the hardware.
Declaration
bool ManagedCaret { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Scrollable
Gets or sets the ability of the surface to scroll its contents when writing needs a new line.
Declaration
bool Scrollable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Size
Gets the size of the surface.
Declaration
Size Size { get; }
Property Value
| Type | Description |
|---|---|
| Size |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Style
Gets or sets the style of the surface.
Declaration
Style Style { get; set; }
Property Value
| Type | Description |
|---|---|
| Style |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Methods
ChangeTextStyle(int, Style)
Changes the style of the text on the current line and starting from the caret position.
Declaration
void ChangeTextStyle(int width, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The number of characters to change. |
| Style | style | The applied style. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Clear(ClearStrategy)
Clears the contents of the row/surface.
Declaration
void Clear(ClearStrategy strategy = ClearStrategy.Full)
Parameters
| Type | Name | Description |
|---|---|---|
| ClearStrategy | strategy | The strategy to use. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DeleteLines(int)
Deletes lines lines starting with the current caret position. All lines below move up.
Declaration
void DeleteLines(int lines)
Parameters
| Type | Name | Description |
|---|---|---|
| int | lines | Number of lines to inserts. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Destroy()
Removes the surface form the parent, destroys all children and itself.
Declaration
void Destroy()
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DisableAttributes(VideoAttribute)
Disables specified attributes and keep the others untouched.
Declaration
void DisableAttributes(VideoAttribute attributes)
Parameters
| Type | Name | Description |
|---|---|---|
| VideoAttribute | attributes | The attributes to disable. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Draw(Point, IDrawable)
Draws a given drawable to the surface.
Declaration
void Draw(Point location, IDrawable drawable)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | location | The location of the drawing. |
| IDrawable | drawable | The drawing to draw. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentOutOfRangeException | Thrown if |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Draw(Point, Rectangle, IDrawable)
Draws a given drawable to the surface.
Declaration
void Draw(Point location, Rectangle area, IDrawable drawable)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | location | The location of the drawing. |
| Rectangle | area | The area of the drawing to draw. |
| IDrawable | drawable | The drawing to draw. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentOutOfRangeException | Thrown if |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawBorder()
Draws a border around the surface's edges using standard characters.
Declaration
void DrawBorder()
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawBorder(Rune, Rune, Rune, Rune, Rune, Rune, Rune, Rune, Style)
Draws a vertical line from the current caret position downwards.
Declaration
void DrawBorder(Rune leftSideChar, Rune rightSideChar, Rune topSideChar, Rune bottomSideChar, Rune topLeftCornerChar, Rune topRightCornerChar, Rune bottomLeftCornerChar, Rune bottomRightCornerChar, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| Rune | leftSideChar | The left-side character. |
| Rune | rightSideChar | The right-side character. |
| Rune | topSideChar | The top-side character. |
| Rune | bottomSideChar | The bottom-side character. |
| Rune | topLeftCornerChar | The top-left corner character. |
| Rune | topRightCornerChar | The top-right corner character. |
| Rune | bottomLeftCornerChar | The bottom-left corner character. |
| Rune | bottomRightCornerChar | The bottom-right corner character. |
| Style | style | The style to use. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawHorizontalLine(int)
Draws a horizontal line using the standard line character from the current caret position downwards.
Declaration
void DrawHorizontalLine(int length)
Parameters
| Type | Name | Description |
|---|---|---|
| int | length | The length of the line. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawHorizontalLine(int, Rune, Style)
Draws a horizontal line from the current caret position downwards.
Declaration
void DrawHorizontalLine(int length, Rune @char, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| int | length | The length of the line. |
| Rune | char | The character to use for the line. |
| Style | style | The style to use. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawText(IAsciiFont, string, Style, bool, bool)
Draws text using an ASCII font at the caret position at the current
surface and advances the caret.
Declaration
void DrawText(IAsciiFont font, string text, Style style, bool interpretSpecialChars = true, bool wrap = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsciiFont | font | The ASCII font to draw with. |
| string | text | The text to write. |
| Style | style | The style of the text. |
| bool | interpretSpecialChars | If |
| bool | wrap | If |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawText(IAsciiFont, string, bool, bool)
Draws text using an ASCII font at the caret position at the current
surface and advances the caret.
Declaration
void DrawText(IAsciiFont font, string text, bool interpretSpecialChars = true, bool wrap = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsciiFont | font | The ASCII font to draw with. |
| string | text | The text to write. |
| bool | interpretSpecialChars | If |
| bool | wrap | If |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawVerticalLine(int)
Draws a vertical line using the standard line character from the current caret position downwards.
Declaration
void DrawVerticalLine(int length)
Parameters
| Type | Name | Description |
|---|---|---|
| int | length | The length of the line. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
DrawVerticalLine(int, Rune, Style)
Draws a vertical line from the current caret position downwards.
Declaration
void DrawVerticalLine(int length, Rune @char, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| int | length | The length of the line. |
| Rune | char | The character to use for the line. |
| Style | style | The style to use. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
EnableAttributes(VideoAttribute)
Enables specified attributes and keep the others untouched.
Declaration
void EnableAttributes(VideoAttribute attributes)
Parameters
| Type | Name | Description |
|---|---|---|
| VideoAttribute | attributes | The attributes to enable. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
GetText(int)
Gets the text from the surface at the caret position to the right.
Declaration
(Rune @char, Style style)[] GetText(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of characters to get. |
Returns
| Type | Description |
|---|---|
| (Rune char, Style style)[] |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
InsertEmptyLines(int)
Inserts lines empty lines at the current caret position.
Declaration
void InsertEmptyLines(int lines)
Parameters
| Type | Name | Description |
|---|---|---|
| int | lines | Number of lines to inserts. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
IsPointWithin(Point)
Checks if a given point fits within the current surface.
Declaration
bool IsPointWithin(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point |
Returns
| Type | Description |
|---|---|
| bool | The result of the check. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
IsRectangleWithin(Rectangle)
Checks if a given rectangle fits within the current surface.
Declaration
bool IsRectangleWithin(Rectangle rect)
Parameters
| Type | Name | Description |
|---|---|---|
| Rectangle | rect |
Returns
| Type | Description |
|---|---|
| bool | The result of the check. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
LineDirty(int)
Checks if the line at y is dirty.
Declaration
bool LineDirty(int y)
Parameters
| Type | Name | Description |
|---|---|---|
| int | y |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
MarkDirty()
Marks the entire contents of the surface as Dirty.
Declaration
void MarkDirty()
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
MarkDirty(int, int)
Marks a number of lines within the surface as Dirty.
Declaration
void MarkDirty(int y, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | y | The line to start with. |
| int | count | The count of lines to mark dirty. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
NextLine()
Helper method that moves the caret to the start of the next line. If the surface is Scrollable, and the caret if on the last line, it will push the contents of the surface up by one line.
Declaration
void NextLine()
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
RemoveText(int)
Removes the text under the caret and moves the contents of the line to the left.
Declaration
void RemoveText(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of characters to remove. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Replace(ISurface, ReplaceStrategy)
Replaces the content of a given surface with the contents of the current surface.
Declaration
void Replace(ISurface surface, ReplaceStrategy strategy)
Parameters
| Type | Name | Description |
|---|---|---|
| ISurface | surface | The surface to copy contents to. |
| ReplaceStrategy | strategy | The used strategy. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The |
| ArgumentException | The contents of |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
Replace(ISurface, Rectangle, Point, ReplaceStrategy)
Replaces the content of a given surface with the contents of the current surface.
Declaration
void Replace(ISurface surface, Rectangle srcRect, Point destPos, ReplaceStrategy strategy)
Parameters
| Type | Name | Description |
|---|---|---|
| ISurface | surface | The surface to copy contents to. |
| Rectangle | srcRect | The source rectangle to copy. |
| Point | destPos | The destination position. |
| ReplaceStrategy | strategy | The used strategy. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
ScrollDown(int)
Scrolls the contents of the surface lines down. Only works for scrollable surfaces.
Declaration
void ScrollDown(int lines)
Parameters
| Type | Name | Description |
|---|---|---|
| int | lines | Number of lines to scroll. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The Scrollable is |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
ScrollUp(int)
Scrolls the contents of the surface lines up. Only works for scrollable surfaces.
Declaration
void ScrollUp(int lines)
Parameters
| Type | Name | Description |
|---|---|---|
| int | lines | Number of lines to scroll. |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The |
| NotSupportedException | The Scrollable is |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
WriteText(StyledText, bool)
Writes a text at the caret position at the current surface and advances the caret.
Declaration
void WriteText(StyledText text, bool wrap = true)
Parameters
| Type | Name | Description |
|---|---|---|
| StyledText | text | The styled text to write. |
| bool | wrap | If |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
WriteText(string, Style, bool)
Writes a text at the caret position at the current surface and advances the caret.
Declaration
void WriteText(string text, Style style, bool wrap = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to write. |
| Style | style | The style of the text. |
| bool | wrap | If |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |
WriteText(string, bool)
Writes a text at the caret position at the current surface and advances the caret.
Declaration
void WriteText(string text, bool wrap = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to write. |
| bool | wrap | If |
Remarks
This operation is not thread safe.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The |
| ObjectDisposedException | Surface is no longer usable. |
| CursesSynchronizationException | Thrown if this operation was expected to run on the main thread/context but wasn't. |