Rotated a TiledImagePaint causes an IndexDefect in debug mode. In release mode, some pixels appear in the wrong places.
import std/math
import pixie
let tile = newImage(4, 4)
tile.fill(rgba(255, 255, 255, 255))
for x in 0 ..< tile.width:
tile[x, 0] = rgba(35, 115, 210, 255)
let paint = newPaint(TiledImagePaint)
paint.image = tile
paint.imageMat = rotate(-7.0.float32 * PI.float32 / 180.0.float32)
let image = newImage(256, 160)
image.fill(paint)
image.writeFile("result.png")
On the Nim forum, janAkali suggested the following workaround in images.nim file, which fixes the issue in my tests:
x0y0 = image.unsafe[x0.euclMod(image.width), y0.euclMod(image.height)]
x1y0 = image.unsafe[x1.euclMod(image.width), y0.euclMod(image.height)]
x0y1 = image.unsafe[x0.euclMod(image.width), y1.euclMod(image.height)]
x1y1 = image.unsafe[x1.euclMod(image.width), y1.euclMod(image.height)]
However, I would prefer not not to have to modify Pixie’s source code locally, which is why I am reporting the issue here.
Rotated a TiledImagePaint causes an IndexDefect in debug mode. In release mode, some pixels appear in the wrong places.
On the Nim forum, janAkali suggested the following workaround in images.nim file, which fixes the issue in my tests:
However, I would prefer not not to have to modify Pixie’s source code locally, which is why I am reporting the issue here.