I have the following code to render “pixels” to a canvas texture:
local texture = graphics.newTexture({ type = ‘canvas’, width = 3, height = 3 })
texture:draw(display.newRect(0, 0, 1, 1))
texture:draw(display.newRect(1, 0, 1, 1))
texture:draw(display.newRect(2, 0, 1, 1))
texture:draw(display.newRect(0, 1, 1, 1))
texture:draw(display.newRect(2, 1, 1, 1))
texture:draw(display.newRect(0, 2, 1, 1))
texture:draw(display.newRect(1, 2, 1, 1))
texture:draw(display.newRect(2, 2, 1, 1))
texture:invalidate()
local rect = display.newImageRect(texture.filename, texture.baseDir, 3, 3)
rect:scale(5, 5)
rect:translate(display.contentCenterX, display.contentCenterY)
You can see that my Rects are clearly within the bounds of the texture’s dimensions. However, if I render it like above, I can only see half of the image. Only if I increase the dimensions of my texture, I can see the full picture.
Is this is a bug?