Skip to content

Commit

Permalink
Merge pull request #3 from radim-nedved/drawing-methods
Browse files Browse the repository at this point in the history
Add drawing methods
  • Loading branch information
mizrael authored Dec 30, 2023
2 parents e38bac4 + 7d1ebec commit 24e1aac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Blazorex/IRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ void DrawImage(ElementReference imageRef,

void Save();
void Restore();
void Arc(float x, float y, float radius, float startAngle, float endAngle, bool anticlockwise = false);
void LineTo(float x, float y);
void MoveTo(float x, float y);
void ClosePath();
void Fill();
void Stroke();
void Rect(float x, float y, float width, float height);


object FillStyle { get; set; }
Expand Down
21 changes: 21 additions & 0 deletions src/Blazorex/RenderContext2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,27 @@ public void Save()
public void Restore()
=> this.Call("restore");

public void LineTo(float x, float y)
=> this.Call("lineTo", x, y);

public void MoveTo(float x, float y)
=> this.Call("moveTo", x, y);

public void ClosePath()
=> this.Call("closePath");

public void Fill()
=> this.Call("fill");

public void Stroke()
=> this.Call("stroke");

public void Arc(float x, float y, float radius, float startAngle, float endAngle, bool anticlockwise = false)
=> this.Call("arc", x, y, radius, startAngle, endAngle, anticlockwise);

public void Rect(float x, float y, float width, float height)
=> this.Call("rect", x, y, width, height);

#endregion public methods

#region properties
Expand Down

0 comments on commit 24e1aac

Please sign in to comment.