Skip to content

paintutils.drawImage incorrectly modifies terminal background color #2283

@WorldChallenge1

Description

@WorldChallenge1

Minecraft Version

1.20.1

Version

1.133.0 (Fabric)

Details

Description

The paintutils.drawImage() function incorrectly modifies the terminal's background color when drawing an image, even when the image should not affect the background color outside of the drawn area.

Expected Behavior

After calling paintutils.drawImage(), the terminal's background color should remain unchanged from what was set before the function call. The function should only modify pixels within the bounds of the drawn image.

Actual Behavior

The terminal's background color is changed after calling paintutils.drawImage(), affecting the entire terminal's background color setting.

Steps to Reproduce

  • Set a specific background color using term.setBackgroundColor()
  • Clear the terminal and note the current background color
  • Parse an image using paintutils.parseImage()
  • Draw the image using paintutils.drawImage()
  • Check the background color after drawing - it will have changed

Reproduction Code

-- Bug reproduction for paintutils.drawImage changing background color
term.setBackgroundColor(colors.cyan)
term.clear()
term.setCursorPos(1, 1)

current_color = term.getBackgroundColour()
print("Current color: " .. tostring(current_color))

local sprite = [[
 55
5555
5555
 55 ]]

local image = paintutils.parseImage(sprite)
paintutils.drawImage(image, 10, 5) -- Bug occurs here

color_after = term.getBackgroundColour()
print("Color after drawing image: " .. tostring(color_after))
if current_color == color_after then
    print("Background color unchanged after drawing image.")
else
    print("Background color changed after drawing image!")
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem or unexpected behaviour with the mod.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions