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
colorColorThe color to fill the canvas
DrawCircle(Position2D, float, Color)
Draws a decagon (circle)
void DrawCircle(Position2D position, float radius, Color color)
Parameters
positionPosition2DThe center position of the decagon
radiusfloatThe radius of the decagon
colorColorThe color of the decagon
DrawLine(Position2D, Position2D, double, Color)
void DrawLine(Position2D start, Position2D end, double width, Color color)
Parameters
startPosition2DThe start of the line
endPosition2DThe end of the line
widthdoubleThe width of the line
colorColorThe color of the line
DrawPixel(Position2D, Color)
Draws pixel
void DrawPixel(Position2D location, Color color)
Parameters
locationPosition2DThe location of the pixel
colorColorThe 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
originPosition2DThe first vertex of the polygon
sidesintThe number of sides of the polygon
radiusfloatThe radius of the polygon
rotationfloatThe rotation of the polygon
colorColorThe color of the polygon
DrawRectangle(Position2D, double, double, Color)
Draws a rectangle
void DrawRectangle(Position2D topLeft, double width, double height, Color color)
Parameters
topLeftPosition2DThe top left corner of the rectangle
widthdoubleThe width of the rectangle
heightdoubleThe height of the rectangle
colorColorThe color of the rectangle
DrawText(Position2D, string, Color)
Draws text
void DrawText(Position2D location, string message, Color color)
Parameters
locationPosition2DThe location of the text
messagestringThe message in the text
colorColorThe 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
topVector2The top point of the triangle
bottomLeftVector2The lower left point of the triangle
bottomRightVector2The lower right point of the triangle
colorColorThe color of the triangle
positionPosition2DThe 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
topleftPosition2DfsizedoublecolorColortextstring
EndDrawing()
Ends the drawing
void EndDrawing()