Using drawScaled cancels out inverted images

, ,

It appears that, when calling image.drawScaled, any images that are inverted are ignored.

Steps to Reproduce

  1. Have an image at hand.
  2. Make a copy of this image using invertedImage to invert the colors.
  3. Call drawScaled on this inverted image. Notice the colors aren't inverted anymore.

Example Code:

local fg = playdate.graphics.image.new("foo")
if fg ~= nil then
    -- isFilled is just an example condition here
    if (isFilled) then
        fg = fg:invertedImage()
    end

    fg:drawScaled(x, y, 2)
end

playdate-20240919-220407

Expected Behavior
drawScaled should respect that the image is inverted and draw it as desired.

Known Workarounds

  • Use scaledImage, and then draw that normally:
local fg = playdate.graphics.image.new("foo")
if fg ~= nil then
    -- isFilled is just an example condition here
    if (isFilled) then
        fg = fg:invertedImage()
    end
    fg:scaledImage(2, 2):draw(x, y, gfx.kImageUnflipped)
end

playdate-20240919-223953

Environment

  • SDK Version: 2.5.0
  • Platform: Windows 11 23H2
  • Device: Surface Pro 9
4 Likes

This bug report is 10/10. Well done.

2 Likes