diff --git a/.gitignore b/.gitignore index 75dc8e3..57de22a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ nimcache *.ilk .* *.dll +__pycache__ diff --git a/src/pixie/contexts.nim b/src/pixie/contexts.nim index e16ed6e..3759b82 100644 --- a/src/pixie/contexts.nim +++ b/src/pixie/contexts.nim @@ -503,20 +503,11 @@ proc setTransform*(ctx: Context, transform: Mat3) {.inline, raises: [].} = ## Overrides the transform matrix being applied to the context. ctx.mat = transform -proc setTransform*(ctx: Context, a, b, c, d, e, f: float32) {.inline, raises: [].} = - ## Overrides the transform matrix being applied to the context. - ctx.mat = mat3(a, b, 0, c, d, 0, e, f, 1) - proc transform*(ctx: Context, transform: Mat3) {.inline, raises: [].} = ## Multiplies the current transform with the matrix described by the ## arguments of this method. ctx.mat = ctx.mat * transform -proc transform*(ctx: Context, a, b, c, d, e, f: float32) {.inline, raises: [].} = - ## Multiplies the current transform with the matrix described by the - ## arguments of this method. - ctx.transform(mat3(a, b, 0, c, d, 0, e, f, 1)) - proc translate*(ctx: Context, v: Vec2) {.inline, raises: [].} = ## Adds a translation transformation to the current matrix. ctx.mat = ctx.mat * translate(v) diff --git a/src/pixie/fonts.nim b/src/pixie/fonts.nim index 5055de9..5857d36 100644 --- a/src/pixie/fonts.nim +++ b/src/pixie/fonts.nim @@ -441,7 +441,7 @@ proc textUber( target: Image | Mask, arrangement: Arrangement, transform = mat3(), - strokeWidth = 1.0, + strokeWidth: float32 = 1.0, lineCap = lcButt, lineJoin = ljMiter, miterLimit = defaultMiterLimit, @@ -550,7 +550,7 @@ proc strokeText*( target: Image | Mask, arrangement: Arrangement, transform = mat3(), - strokeWidth = 1.0, + strokeWidth: float32 = 1.0, lineCap = lcButt, lineJoin = ljMiter, miterLimit = defaultMiterLimit, @@ -574,7 +574,7 @@ proc strokeText*( font: Font, text: string, transform = mat3(), - strokeWidth = 1.0, + strokeWidth: float32 = 1.0, bounds = vec2(0, 0), hAlign = haLeft, vAlign = vaTop, diff --git a/src/pixie/paints.nim b/src/pixie/paints.nim index ec6d3e4..88882c0 100644 --- a/src/pixie/paints.nim +++ b/src/pixie/paints.nim @@ -47,7 +47,7 @@ proc newPaint*(paint: Paint): Paint {.raises: [].} = converter parseSomePaint*( paint: SomePaint -): Paint {.inline, raises: [PixieError].} = +): Paint {.inline.} = ## Given SomePaint, parse it in different ways. when type(paint) is string: result = newPaint(pkSolid) diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index 058556f..0367545 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1812,7 +1812,7 @@ proc strokePath*( mask: Mask, path: SomePath, transform = mat3(), - strokeWidth = 1.0, + strokeWidth: float32 = 1.0, lineCap = lcButt, lineJoin = ljMiter, miterLimit = defaultMiterLimit, @@ -1836,7 +1836,7 @@ proc strokePath*( path: SomePath, paint: Paint, transform = mat3(), - strokeWidth = 1.0, + strokeWidth: float32 = 1.0, lineCap = lcButt, lineJoin = ljMiter, miterLimit = defaultMiterLimit, @@ -1944,7 +1944,7 @@ proc strokeOverlaps*( path: Path, test: Vec2, transform = mat3(), ## Applied to the path, not the test point. - strokeWidth = 1.0, + strokeWidth: float32 = 1.0, lineCap = lcButt, lineJoin = ljMiter, miterLimit = defaultMiterLimit, diff --git a/tests/test_contexts.nim b/tests/test_contexts.nim index 8672bab..c27aa99 100644 --- a/tests/test_contexts.nim +++ b/tests/test_contexts.nim @@ -201,7 +201,7 @@ block: block: let ctx = newContext(newImage(300, 150)) - ctx.setTransform(1, 0.2, 0.8, 1, 0, 0) + ctx.setTransform(mat3(1, 0.2, 0, 0.8, 1, 0, 0, 0, 1)) ctx.fillRect(0, 0, 100, 100) ctx.image.writeFile("tests/images/context/setTransform_1.png") @@ -209,7 +209,7 @@ block: block: let ctx = newContext(newImage(300, 150)) - ctx.setTransform(1, 0.2, 0.8, 1, 0, 0) + ctx.setTransform(mat3(1, 0.2, 0, 0.8, 1, 0, 0, 0, 1)) ctx.fillRect(0, 0, 100, 100) ctx.image.writeFile("tests/images/context/resetTransform_1.png") @@ -225,7 +225,7 @@ block: block: let ctx = newContext(newImage(300, 150)) - ctx.transform(1, 0, 1.7, 1, 0, 0) + ctx.transform(mat3(1, 0, 0, 1.7, 1, 0, 0, 0, 1)) ctx.fillStyle = "gray" ctx.fillRect(40, 40, 50, 20) ctx.fillRect(40, 90, 50, 20) @@ -244,7 +244,7 @@ block: ctx.fillStyle = "red" ctx.fillRect(0, 0, 80, 80) - ctx.setTransform(1, 0, 0, 1, 0, 0) + ctx.setTransform(mat3(1, 0, 0, 0, 1, 0, 0, 0, 1)) ctx.fillStyle = "gray" ctx.fillRect(0, 0, 80, 80) @@ -258,7 +258,7 @@ block: ctx.fillStyle = "red" ctx.fillRect(10, 10, 8, 20) - ctx.setTransform(1, 0, 0, 1, 0, 0) + ctx.setTransform(mat3(1, 0, 0, 0, 1, 0, 0, 0, 1)) ctx.fillStyle = "gray" ctx.fillRect(10, 10, 8, 20)