Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pixie.nimble
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version = "5.1.0"
version = "6.0.0"
author = "Andre von Houck and Ryan Oldenburg"
description = "Full-featured 2d graphics library for Nim."
license = "MIT"

srcDir = "src"

requires "nim >= 1.4.8"
requires "vmath >= 1.1.4"
requires "vmath >= 3.0.0"
requires "chroma >= 0.2.6"
requires "zippy >= 0.10.3"
requires "flatty >= 0.3.4"
Expand Down
2 changes: 1 addition & 1 deletion src/pixie/contexts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ proc scale*(ctx: Context, x, y: float32) {.inline, raises: [].} =

proc rotate*(ctx: Context, angle: float32) {.inline, raises: [].} =
## Adds a rotation to the transformation matrix.
ctx.mat = ctx.mat * rotate(-angle)
ctx.mat = ctx.mat * rotate(angle)

proc resetTransform*(ctx: Context) {.inline, raises: [].} =
## Resets the current transform to the identity matrix.
Expand Down
2 changes: 1 addition & 1 deletion src/pixie/fileformats/svg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ proc parseSvgProperties(node: XmlNode, inherited: SvgProperties): SvgProperties
elif f.startsWith("rotate("):
let
values = splitArgs(f[7 .. ^2])
angle: float32 = parseFloat(values[0]) * -PI / 180
angle: float32 = parseFloat(values[0]) * PI / 180
var cx, cy: float32
if values.len > 1:
cx = parseFloat(values[1])
Expand Down
2 changes: 1 addition & 1 deletion src/pixie/paints.nim
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ proc fillGradientRadial(image: Image, paint: Paint) =
gradientAngle = normalize(center - edge).angle().fixAngle()
mat = (
translate(center) *
rotate(-gradientAngle) *
rotate(gradientAngle) *
scale(vec2(distanceX, distanceY))
).inverse()
for y in 0 ..< image.height:
Expand Down
2 changes: 1 addition & 1 deletion src/pixie/paths.nim
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ proc commandsToShapes(

ArcParams(
radii: radii,
rotMat: rotate(-radians),
rotMat: rotate(radians),
center: center,
theta: theta,
delta: delta
Expand Down
20 changes: 10 additions & 10 deletions tests/test_images_draw.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ block:
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))

a.draw(b, translate(vec2(250, 250)) * rotate(90 * PI.float32 / 180))
a.draw(b, translate(vec2(250, 250)) * rotate(-90 * PI.float32 / 180))
a.xray("tests/images/rotate90.png")

block:
Expand All @@ -27,7 +27,7 @@ block:
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))

a.draw(b, translate(vec2(250, 250)) * rotate(180 * PI.float32 / 180))
a.draw(b, translate(vec2(250, 250)) * rotate(-180 * PI.float32 / 180))
a.xray("tests/images/rotate180.png")

block:
Expand All @@ -37,7 +37,7 @@ block:
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))

a.draw(b, translate(vec2(250, 250)) * rotate(270 * PI.float32 / 180))
a.draw(b, translate(vec2(250, 250)) * rotate(-270 * PI.float32 / 180))
a.xray("tests/images/rotate270.png")

block:
Expand All @@ -47,7 +47,7 @@ block:
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))

a.draw(b, translate(vec2(250, 250)) * rotate(360 * PI.float32 / 180))
a.draw(b, translate(vec2(250, 250)) * rotate(-360 * PI.float32 / 180))
a.xray("tests/images/rotate360.png")

block:
Expand Down Expand Up @@ -143,7 +143,7 @@ block:
b = newImage(50, 50)
a.fill(rgba(255, 255, 255, 255))
b.fill(rgbx(0, 0, 0, 255))
a.draw(b, translate(vec2(0, 50)) * rotate(45.toRadians))
a.draw(b, translate(vec2(0, 50)) * rotate(-45.toRadians))
a.xray("tests/images/masters/smooth2.png")

block:
Expand All @@ -170,7 +170,7 @@ block:
b = newImage(10, 10)
a.fill(rgba(255, 255, 255, 255))
b.fill(rgbx(255, 0, 0, 255))
let m = translate(vec2(50, 50)) * rotate(30.toRadians)
let m = translate(vec2(50, 50)) * rotate(-30.toRadians)
a.draw(b, m)
a.xray("tests/images/masters/smooth5.png")

Expand All @@ -179,7 +179,7 @@ block:
a = newImage(100, 100)
b = readImage(&"tests/images/turtle.png")
a.fill(rgba(255, 255, 255, 255))
let m = translate(vec2(50, 50)) * rotate(30.toRadians)
let m = translate(vec2(50, 50)) * rotate(-30.toRadians)
a.draw(b, m)
a.xray("tests/images/masters/smooth6.png")

Expand All @@ -188,7 +188,7 @@ block:
a = newImage(100, 100)
b = readImage(&"tests/images/turtle@10x.png")
a.fill(rgba(255, 255, 255, 255))
let m = translate(vec2(50, 50)) * rotate(30.toRadians) * scale(vec2(0.1, 0.1))
let m = translate(vec2(50, 50)) * rotate(-30.toRadians) * scale(vec2(0.1, 0.1))
a.draw(b, m)
a.xray("tests/images/masters/smooth7.png")

Expand Down Expand Up @@ -225,7 +225,7 @@ block:
b = readImage(&"tests/images/turtle.png")
a.fill(rgba(255, 255, 255, 255))
let m = translate(vec2(-43.29, -103.87)) *
rotate(-15.toRadians) *
rotate(15.toRadians) *
scale(vec2(263.86/40, 263.86/40))
a.draw(b, m)
a.xray("tests/images/masters/smooth11.png")
Expand All @@ -235,7 +235,7 @@ block:
a = newImage(100, 100)
b = readImage(&"tests/images/turtle.png")
a.fill(rgba(255, 255, 255, 255))
let m = translate(vec2(50, 50)) * rotate(-5.toRadians)
let m = translate(vec2(50, 50)) * rotate(5.toRadians)
a.draw(b, m * translate(vec2(0, 0)))
a.draw(b, m * translate(vec2(-40, 0)))
a.draw(b, m * translate(vec2(-40, -40)))
Expand Down
Loading