Table of Contents

Interface ICanvas2D

Namespace
AstraEngine.Canvas2D
Assembly
AstraEngine.Canvas2D.dll

A ICanvas2D provides methods for drawing in 2D space.

public interface ICanvas2D

Methods

BeginDrawing()

This method is called at the start of a render frame.

void BeginDrawing()

Clear(Color)

Clears the canvas with the specified color

void Clear(Color color)

Parameters

color Color

The color to fill the canvas

DrawCircle(Position2D, float, Color)

Draws a decagon (circle)

void DrawCircle(Position2D position, float radius, Color color)

Parameters

position Position2D

The center position of the decagon

radius float

The radius of the decagon

color Color

The color of the decagon

DrawLine(Position2D, Position2D, double, Color)

void DrawLine(Position2D start, Position2D end, double width, Color color)

Parameters

start Position2D

The start of the line

end Position2D

The end of the line

width double

The width of the line

color Color

The color of the line

DrawPixel(Position2D, Color)

Draws pixel

void DrawPixel(Position2D location, Color color)

Parameters

location Position2D

The location of the pixel

color Color

The color of the pixel

DrawPoly(Position2D, int, float, float, Color)

Draws a polygon

void DrawPoly(Position2D origin, int sides, float radius, float rotation, Color color)

Parameters

origin Position2D

The first vertex of the polygon

sides int

The number of sides of the polygon

radius float

The radius of the polygon

rotation float

The rotation of the polygon

color Color

The color of the polygon

DrawRectangle(Position2D, double, double, Color)

Draws a rectangle

void DrawRectangle(Position2D topLeft, double width, double height, Color color)

Parameters

topLeft Position2D

The top left corner of the rectangle

width double

The width of the rectangle

height double

The height of the rectangle

color Color

The color of the rectangle

DrawText(Position2D, string, Color)

Draws text

void DrawText(Position2D location, string message, Color color)

Parameters

location Position2D

The location of the text

message string

The message in the text

color Color

The color of the text

DrawTriangle(Vector2, Vector2, Vector2, Color, Position2D)

Draws a triangle

void DrawTriangle(Vector2 top, Vector2 bottomLeft, Vector2 bottomRight, Color color, Position2D position)

Parameters

top Vector2

The top point of the triangle

bottomLeft Vector2

The lower left point of the triangle

bottomRight Vector2

The lower right point of the triangle

color Color

The color of the triangle

position Position2D

The offset for the triangle

Drawtext(Position2D, double, Color, string)

This method is called at the end of a render frame.

void Drawtext(Position2D topleft, double fsize, Color color, string text)

Parameters

topleft Position2D
fsize double
color Color
text string

EndDrawing()

Ends the drawing

void EndDrawing()