C# 클래스 StdPaint.ConsoleBuffer

Represents a two-dimensional buffer of characters that can be written to the console.
파일 보기 프로젝트 열기: TheBerkin/StdPaint 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
UnitCount int

보호된 프로퍼티들

프로퍼티 타입 설명
_buffer ].BufferUnitInfo[
_width int

공개 메소드들

메소드 설명
Clear ( BufferColor color = BufferColor.Black ) : void

Clears all units in the buffer, optionally specifying a color to fill the buffer with.

ClearBrush ( BufferBrush brush ) : void

Fills the entire buffer with a brush.

Clone ( ) : ConsoleBuffer

Returns a new ConsoleBuffer instance containing a copy of the buffer's contents.

ConsoleBuffer ( int width, int height ) : System

Initializes a new ConsoleBuffer instance with the specified dimensions.

CreateScreenBuffer ( ) : ConsoleBuffer

Creates a buffer whose size matches the current unit dimensions of the console.

DrawBox ( Rectangle rectangle, int thickness, BufferBrush border, BufferBrush fill ) : void

Draws a box from the specified rectangle and brush information.

DrawBox ( int x, int y, int w, int h, BufferBrush brush ) : void

Draws a solid box with the specified dimensions to the buffer.

DrawBox ( int x, int y, int w, int h, BufferColor color ) : void

Draws a solid box with the specified dimensions to the buffer.

DrawBox ( int x, int y, int w, int h, int thickness, BufferBrush border, BufferBrush fill ) : void

Draws a box with the specified border and fill brushes.

DrawBuffer ( ConsoleBuffer buffer, int x, int y, BufferDrawMode drawMode ) : void

Draws the contents of another buffer onto this buffer at the specified location.

DrawCircle ( int x, int y, int radius, BufferBrush brush ) : void

Draws a solid circle to the buffer with the specified attributes.

DrawCircle ( int x, int y, int radius, BufferColor color ) : void

Draws a solid circle to the buffer with the specified attributes.

DrawCircle ( int x, int y, int radius, int thickness, BufferBrush border, BufferBrush fill ) : void

Draws a circle with the specified radius, border thickness, and attributes for both border and fill.

DrawCircle ( int x, int y, int radius, int thickness, BufferColor border, BufferColor fill ) : void

Draws a circle with the specified radius, border thickness, and attributes for both border and fill.

DrawLine ( Point a, Point b, BufferBrush brush ) : void

Draws a line to the buffer with the specified brush.

DrawLine ( Point a, Point b, BufferColor color ) : void

Draws a colored line to the buffer.

DrawLine ( int x, int y, int x2, int y2, BufferBrush brush ) : void

Draws a line to the buffer.

DrawLine ( int x, int y, int x2, int y2, BufferColor color ) : void

Draws a line to the buffer.

DrawString ( int x, int y, Alignment alignment ) : void

Draws a string to the buffer with the specified alignment.

DrawString ( int x, int y, string text, BufferColor color, Alignment alignment = Alignment.Left ) : void

Prints a string to the buffer with the specified attributes and alignment.

DrawTriangle ( Point a, Point b, Point c, BufferBrush brush ) : void

Draws a triangle to the buffer.

DrawTriangle ( Point a, Point b, Point c, BufferColor color ) : void

Draws a triangle to the buffer.

DrawTriangle ( Triangle triangle, BufferBrush brush ) : void

Draws a triangle to the buffer.

DrawTriangle ( Triangle triangle, BufferBrush border, BufferBrush fill ) : void

Draws a triangle with the specified border and fill brushes.

DrawTriangle ( Triangle triangle, BufferColor color ) : void

Draws a triangle to the buffer.

FloodFill ( int x, int y, BufferBrush brush ) : void

Flood fills a closed region containing the specified coordinates with a brush.

FloodFill ( int x, int y, BufferColor color ) : void

Flood fills a closed region containing the specified coordinates with a color.

FromFile ( string path ) : ConsoleBuffer

Loads buffer data from a file and returns it as a ConsoleBuffer object.

GetColorFromUV ( double u, double v, TextureSampleMode mode = TextureSampleMode.Tile ) : BufferColor

Returns the unit background color at the specified texture coordinates.

GetUnitAttributes ( int x, int y ) : BufferUnitAttributes

Returns the attributes for the specified unit.

GetUnitBackColor ( Point point ) : BufferColor

Gets the background color of the specified unit.

GetUnitBackColor ( int x, int y ) : BufferColor

Gets the background color of the specified unit.

GetUnitCharacter ( Point point ) : char

Gets the character in the specified unit.

GetUnitCharacter ( int x, int y ) : char

Gets the character in the specified unit.

GetUnitForeColor ( Point point ) : BufferColor

Gets the foreground color of the specified unit.

GetUnitForeColor ( int x, int y ) : BufferColor

Gets the foreground color of the specified unit.

ResampledCopy ( ConsoleBuffer buffer, int width, int height ) : ConsoleBuffer

Creates a resampled copy of a console buffer using the specified dimensions.

Save ( string path ) : void

Writes the buffer data to a file.

SetUnitAttributes ( Point point, BufferUnitAttributes attributes ) : void

Sets the attributes for a specific unit in the buffer.

SetUnitAttributes ( int x, int y, BufferUnitAttributes attributes ) : void

Sets attributes for a specific unit in the buffer.

SetUnitBackColor ( Point point, BufferColor color ) : void

Sets the background color for a specific unit in the buffer.

SetUnitBackColor ( int x, int y, BufferColor color ) : void

Sets the background color for a specific unit in the buffer.

SetUnitCharacter ( Point p, char c ) : void

Sets the character for a specific unit in the buffer.

SetUnitCharacter ( int x, int y, char c ) : void

Sets the character for a specific unit in the buffer.

SetUnitForeColor ( Point point, BufferColor color ) : void

Sets the foreground color for a specific unit in the buffer.

SetUnitForeColor ( int x, int y, BufferColor color ) : void

Sets the foreground color for a specific unit in the buffer.

보호된 메소드들

메소드 설명
InBounds ( Point point ) : bool
InBounds ( int x, int y ) : bool

비공개 메소드들

메소드 설명
ConsoleBuffer ( int width, int height, BufferUnitInfo bufferData ) : System

메소드 상세

Clear() 공개 메소드

Clears all units in the buffer, optionally specifying a color to fill the buffer with.
public Clear ( BufferColor color = BufferColor.Black ) : void
color BufferColor The color to fill the buffer with.
리턴 void

ClearBrush() 공개 메소드

Fills the entire buffer with a brush.
public ClearBrush ( BufferBrush brush ) : void
brush BufferBrush The brush to fill the buffer with.
리턴 void

Clone() 공개 메소드

Returns a new ConsoleBuffer instance containing a copy of the buffer's contents.
public Clone ( ) : ConsoleBuffer
리턴 ConsoleBuffer

ConsoleBuffer() 공개 메소드

Initializes a new ConsoleBuffer instance with the specified dimensions.
public ConsoleBuffer ( int width, int height ) : System
width int The width of the buffer, in units.
height int The height of the buffer, in units.
리턴 System

CreateScreenBuffer() 공개 정적인 메소드

Creates a buffer whose size matches the current unit dimensions of the console.
public static CreateScreenBuffer ( ) : ConsoleBuffer
리턴 ConsoleBuffer

DrawBox() 공개 메소드

Draws a box from the specified rectangle and brush information.
public DrawBox ( Rectangle rectangle, int thickness, BufferBrush border, BufferBrush fill ) : void
rectangle Rectangle The bounds of the box to draw.
thickness int The border thickness of the box.
border BufferBrush the border brush of the box.
fill BufferBrush The fill brush of the box.
리턴 void

DrawBox() 공개 메소드

Draws a solid box with the specified dimensions to the buffer.
public DrawBox ( int x, int y, int w, int h, BufferBrush brush ) : void
x int The X coordinate of the box.
y int The Y coordinate of the box.
w int The width of the box.
h int The height of the box.
brush BufferBrush The brush to draw the box with.
리턴 void

DrawBox() 공개 메소드

Draws a solid box with the specified dimensions to the buffer.
public DrawBox ( int x, int y, int w, int h, BufferColor color ) : void
x int The X coordinate of the box.
y int The Y coordinate of the box.
w int The width of the box.
h int The height of the box.
color BufferColor The color to draw the box with.
리턴 void

DrawBox() 공개 메소드

Draws a box with the specified border and fill brushes.
public DrawBox ( int x, int y, int w, int h, int thickness, BufferBrush border, BufferBrush fill ) : void
x int The X position of the box.
y int The Y position of the box.
w int The width of the box.
h int The height of the box.
thickness int The border thickness of the box.
border BufferBrush The brush to draw the border with.
fill BufferBrush The brush to draw the fill with.
리턴 void

DrawBuffer() 공개 메소드

Draws the contents of another buffer onto this buffer at the specified location.
public DrawBuffer ( ConsoleBuffer buffer, int x, int y, BufferDrawMode drawMode ) : void
buffer ConsoleBuffer The buffer to draw.
x int The X position to begin drawing at.
y int The Y position to begin drawing at.
drawMode BufferDrawMode Specified how the buffer should be drawn.
리턴 void

DrawCircle() 공개 메소드

Draws a solid circle to the buffer with the specified attributes.
public DrawCircle ( int x, int y, int radius, BufferBrush brush ) : void
x int The X position of the circle, relative to its center.
y int The Y position of the circle, relative to its center.
radius int The radius of the circle.
brush BufferBrush The brush to draw the circle with.
리턴 void

DrawCircle() 공개 메소드

Draws a solid circle to the buffer with the specified attributes.
public DrawCircle ( int x, int y, int radius, BufferColor color ) : void
x int The X position of the circle, relative to its center.
y int The Y position of the circle, relative to its center.
radius int The radius of the circle.
color BufferColor The color to draw the circle with.
리턴 void

DrawCircle() 공개 메소드

Draws a circle with the specified radius, border thickness, and attributes for both border and fill.
public DrawCircle ( int x, int y, int radius, int thickness, BufferBrush border, BufferBrush fill ) : void
x int The X position of the circle, relative to its center.
y int The Y position of the circle, relative to its center.
radius int The radius of the circle.
thickness int The border thickness of the circle.
border BufferBrush The border brush for the circle.
fill BufferBrush The fill brush for the circle.
리턴 void

DrawCircle() 공개 메소드

Draws a circle with the specified radius, border thickness, and attributes for both border and fill.
public DrawCircle ( int x, int y, int radius, int thickness, BufferColor border, BufferColor fill ) : void
x int The X position of the circle, relative to its center.
y int The Y position of the circle, relative to its center.
radius int The radius of the circle.
thickness int The border thickness of the circle.
border BufferColor The border color for the circle.
fill BufferColor The fill color for the circle.
리턴 void

DrawLine() 공개 메소드

Draws a line to the buffer with the specified brush.
public DrawLine ( Point a, Point b, BufferBrush brush ) : void
a Point The starting point of the line.
b Point The ending point of the line.
brush BufferBrush The brush to draw the line with.
리턴 void

DrawLine() 공개 메소드

Draws a colored line to the buffer.
public DrawLine ( Point a, Point b, BufferColor color ) : void
a Point The starting point of the line.
b Point The ending point of the line.
color BufferColor The color of the line.
리턴 void

DrawLine() 공개 메소드

Draws a line to the buffer.
public DrawLine ( int x, int y, int x2, int y2, BufferBrush brush ) : void
x int The starting X coordinate of the line.
y int The starting Y coordinate of the line.
x2 int The ending X coordinate of the line.
y2 int The ending Y coordinate of the line.
brush BufferBrush The brush to draw the line with.
리턴 void

DrawLine() 공개 메소드

Draws a line to the buffer.
public DrawLine ( int x, int y, int x2, int y2, BufferColor color ) : void
x int The starting X coordinate of the line.
y int The starting Y coordinate of the line.
x2 int The ending X coordinate of the line.
y2 int The ending Y coordinate of the line.
color BufferColor The color of the line.
리턴 void

DrawString() 공개 메소드

Draws a string to the buffer with the specified alignment.
public DrawString ( int x, int y, Alignment alignment ) : void
x int The X coordinate to start printing at.
y int The Y coordinate to start printing at.
alignment Alignment The alinment to assign to the string.
리턴 void

DrawString() 공개 메소드

Prints a string to the buffer with the specified attributes and alignment.
public DrawString ( int x, int y, string text, BufferColor color, Alignment alignment = Alignment.Left ) : void
x int The X coordinate to start printing at.
y int The Y coordinate to start printing at.
text string The string to print.
color BufferColor The color to assign to the text.
alignment Alignment The alignment of the string.
리턴 void

DrawTriangle() 공개 메소드

Draws a triangle to the buffer.
public DrawTriangle ( Point a, Point b, Point c, BufferBrush brush ) : void
a Point The first point of the triangle.
b Point The second point of the triangle.
c Point The third point of the triangle.
brush BufferBrush The brush of the line.
리턴 void

DrawTriangle() 공개 메소드

Draws a triangle to the buffer.
public DrawTriangle ( Point a, Point b, Point c, BufferColor color ) : void
a Point The first point of the triangle.
b Point The second point of the triangle.
c Point The third point of the triangle.
color BufferColor The color of the line.
리턴 void

DrawTriangle() 공개 메소드

Draws a triangle to the buffer.
public DrawTriangle ( Triangle triangle, BufferBrush brush ) : void
triangle Triangle The triangle to draw.
brush BufferBrush The brush to draw the triangle with.
리턴 void

DrawTriangle() 공개 메소드

Draws a triangle with the specified border and fill brushes.
public DrawTriangle ( Triangle triangle, BufferBrush border, BufferBrush fill ) : void
triangle Triangle The triangle to draw.
border BufferBrush The border brush.
fill BufferBrush The fill brush.
리턴 void

DrawTriangle() 공개 메소드

Draws a triangle to the buffer.
public DrawTriangle ( Triangle triangle, BufferColor color ) : void
triangle Triangle The triangle to draw.
color BufferColor The color to draw the triangle.
리턴 void

FloodFill() 공개 메소드

Flood fills a closed region containing the specified coordinates with a brush.
public FloodFill ( int x, int y, BufferBrush brush ) : void
x int The X coordinate to begin filling at.
y int The Y coordinate to begin filling at.
brush BufferBrush The brush to fill the region with.
리턴 void

FloodFill() 공개 메소드

Flood fills a closed region containing the specified coordinates with a color.
public FloodFill ( int x, int y, BufferColor color ) : void
x int The X coordinate to begin filling at.
y int The Y coordinate to begin filling at.
color BufferColor The color to fill the region with.
리턴 void

FromFile() 공개 정적인 메소드

Loads buffer data from a file and returns it as a ConsoleBuffer object.
public static FromFile ( string path ) : ConsoleBuffer
path string The path to the buffer file.
리턴 ConsoleBuffer

GetColorFromUV() 공개 메소드

Returns the unit background color at the specified texture coordinates.
public GetColorFromUV ( double u, double v, TextureSampleMode mode = TextureSampleMode.Tile ) : BufferColor
u double The U coordinate.
v double The V coordinate.
mode TextureSampleMode The sampling mode to use.
리턴 BufferColor

GetUnitAttributes() 공개 메소드

Returns the attributes for the specified unit.
public GetUnitAttributes ( int x, int y ) : BufferUnitAttributes
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
리턴 BufferUnitAttributes

GetUnitBackColor() 공개 메소드

Gets the background color of the specified unit.
public GetUnitBackColor ( Point point ) : BufferColor
point Point The location of the unit.
리턴 BufferColor

GetUnitBackColor() 공개 메소드

Gets the background color of the specified unit.
public GetUnitBackColor ( int x, int y ) : BufferColor
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
리턴 BufferColor

GetUnitCharacter() 공개 메소드

Gets the character in the specified unit.
public GetUnitCharacter ( Point point ) : char
point Point The location of the unit.
리턴 char

GetUnitCharacter() 공개 메소드

Gets the character in the specified unit.
public GetUnitCharacter ( int x, int y ) : char
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
리턴 char

GetUnitForeColor() 공개 메소드

Gets the foreground color of the specified unit.
public GetUnitForeColor ( Point point ) : BufferColor
point Point The location of the unit.
리턴 BufferColor

GetUnitForeColor() 공개 메소드

Gets the foreground color of the specified unit.
public GetUnitForeColor ( int x, int y ) : BufferColor
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
리턴 BufferColor

InBounds() 보호된 메소드

protected InBounds ( Point point ) : bool
point Point
리턴 bool

InBounds() 보호된 메소드

protected InBounds ( int x, int y ) : bool
x int
y int
리턴 bool

ResampledCopy() 공개 정적인 메소드

Creates a resampled copy of a console buffer using the specified dimensions.
public static ResampledCopy ( ConsoleBuffer buffer, int width, int height ) : ConsoleBuffer
buffer ConsoleBuffer The buffer to be resampled.
width int The width of the resampled buffer.
height int The height of the resampled buffer.
리턴 ConsoleBuffer

Save() 공개 메소드

Writes the buffer data to a file.
public Save ( string path ) : void
path string The path to the file.
리턴 void

SetUnitAttributes() 공개 메소드

Sets the attributes for a specific unit in the buffer.
public SetUnitAttributes ( Point point, BufferUnitAttributes attributes ) : void
point Point The location of the unit.
attributes BufferUnitAttributes The attributes to assign to the unit.
리턴 void

SetUnitAttributes() 공개 메소드

Sets attributes for a specific unit in the buffer.
public SetUnitAttributes ( int x, int y, BufferUnitAttributes attributes ) : void
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
attributes BufferUnitAttributes The attributes to assign to the unit.
리턴 void

SetUnitBackColor() 공개 메소드

Sets the background color for a specific unit in the buffer.
public SetUnitBackColor ( Point point, BufferColor color ) : void
point Point The location of the unit.
color BufferColor The background color to set the unit to.
리턴 void

SetUnitBackColor() 공개 메소드

Sets the background color for a specific unit in the buffer.
public SetUnitBackColor ( int x, int y, BufferColor color ) : void
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
color BufferColor The background color to set the unit to.
리턴 void

SetUnitCharacter() 공개 메소드

Sets the character for a specific unit in the buffer.
public SetUnitCharacter ( Point p, char c ) : void
p Point The location of the unit.
c char The character to assign to the unit.
리턴 void

SetUnitCharacter() 공개 메소드

Sets the character for a specific unit in the buffer.
public SetUnitCharacter ( int x, int y, char c ) : void
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
c char The character to assign to the unit.
리턴 void

SetUnitForeColor() 공개 메소드

Sets the foreground color for a specific unit in the buffer.
public SetUnitForeColor ( Point point, BufferColor color ) : void
point Point The location of the unit.
color BufferColor The foreground color to set the unit to.
리턴 void

SetUnitForeColor() 공개 메소드

Sets the foreground color for a specific unit in the buffer.
public SetUnitForeColor ( int x, int y, BufferColor color ) : void
x int The X coordinate of the unit.
y int The Y coordinate of the unit.
color BufferColor The foreground color to set the unit to.
리턴 void

프로퍼티 상세

UnitCount 공개적으로 프로퍼티

The total number of units in this buffer.
public int UnitCount
리턴 int

_buffer 보호되어 있는 프로퍼티

Buffer data
protected BufferUnitInfo[,] _buffer
리턴 ].BufferUnitInfo[

_width 보호되어 있는 프로퍼티

Buffer dimensions
protected int _width
리턴 int