Skip to content

Commit

Permalink
Merge pull request #107 from Shallowmallow/strokeFillPath
Browse files Browse the repository at this point in the history
strokePath to strokeFillPath
  • Loading branch information
ianharrigan authored May 8, 2024
2 parents c843c8c + a789d60 commit c6c3554
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/hx/widgets/GraphicsContext.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GraphicsContext extends GraphicsObject {
}

@:access(hx.widgets.GraphicsPath)
public function strokePath(path:GraphicsPath) {
public function strokeFillPath(path:GraphicsPath, stroke:Bool = true, fill:Bool = true) {
var nativePath = graphicscontextRef.ptr.createPath();
for (call in path.calls) {
switch (call) {
Expand Down Expand Up @@ -54,9 +54,17 @@ class GraphicsContext extends GraphicsObject {
}

}
graphicscontextRef.ptr.strokePath(nativePath);
if (stroke) graphicscontextRef.ptr.strokePath(nativePath);
if (fill) graphicscontextRef.ptr.fillPath(nativePath);
}

public function strokePath(path:GraphicsPath) {
strokeFillPath(path, true, false);
}

public function fillPath(path:GraphicsPath) {
strokeFillPath(path, false, true);
}

public function strokeLine(x1:Float, y1:Float, x2:Float, y2:Float) {
graphicscontextRef.ptr.strokeLine(x1, y1, x2, y2);
Expand Down
1 change: 1 addition & 0 deletions src/wx/widgets/GraphicsContext.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern class GraphicsContext extends GraphicsObject {
@:native("CreatePath") public function createPath():GraphicsPath;
@:native("StrokePath") public function strokePath(path:GraphicsPath):Void;
@:native("StrokeLine") public function strokeLine(x1:Float, y1:Float, x2:Float, y2:Float):Void;
@:native("FillPath") public function fillPath(path:GraphicsPath):Void;
@:native("SetPen") public function setPen(pen:Pen):Void;
@:native("SetBrush") public function setBrush(brush:Brush):Void;
@:native("SetFont") public function setFont(font:Font, colour:Colour):Void;
Expand Down

0 comments on commit c6c3554

Please sign in to comment.