From a3491867ad61030809e84c1b78341f83d39a3ea5 Mon Sep 17 00:00:00 2001 From: treeform Date: Fri, 4 Dec 2020 09:33:58 -0800 Subject: [PATCH] Better examples. --- README.md | 16 ++++++---------- examples/rounded_rectangle.nim | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 401f177..d18ca5f 100644 --- a/README.md +++ b/README.md @@ -40,16 +40,12 @@ let y = 50.0 w = 100.0 h = 100.0 - nw = 25.0 - ne = 25.0 - se = 25.0 - sw = 25.0 -path.moveTo(x+nw, y) -path.arcTo(x+w, y, x+w, y+h, ne) -path.arcTo(x+w, y+h, x, y+h, se) -path.arcTo(x, y+h, x, y, sw) -path.arcTo(x, y, x+w, y, nw) -path.closePath() + r = 25.0 +path.moveTo(x+r, y) +path.arcTo(x+w, y, x+w, y+h, r) +path.arcTo(x+w, y+h, x, y+h, r) +path.arcTo(x, y+h, x, y, r) +path.arcTo(x, y, x+w, y, r) path.closePath() image.fillPath(path, rgba(255, 0, 0, 255)) ``` diff --git a/examples/rounded_rectangle.nim b/examples/rounded_rectangle.nim index 6164ec0..28be1ff 100644 --- a/examples/rounded_rectangle.nim +++ b/examples/rounded_rectangle.nim @@ -9,16 +9,12 @@ let y = 50.0 w = 100.0 h = 100.0 - nw = 25.0 - ne = 25.0 - se = 25.0 - sw = 25.0 -path.moveTo(x+nw, y) -path.arcTo(x+w, y, x+w, y+h, ne) -path.arcTo(x+w, y+h, x, y+h, se) -path.arcTo(x, y+h, x, y, sw) -path.arcTo(x, y, x+w, y, nw) -path.closePath() + r = 25.0 +path.moveTo(x+r, y) +path.arcTo(x+w, y, x+w, y+h, r) +path.arcTo(x+w, y+h, x, y+h, r) +path.arcTo(x, y+h, x, y, r) +path.arcTo(x, y, x+w, y, r) path.closePath() image.fillPath(path, rgba(255, 0, 0, 255))