microstudio icon indicating copy to clipboard operation
microstudio copied to clipboard

setTranslation affect gradient for fillRect but not drawLine

Open HomineLudens opened this issue 2 years ago • 1 comments

This was very odd and it jumps out in very specific case:

so i wrote a minimal test:


drawTest = function(x,y)
  local w = 48
  local h = 48
  screen.setLinearGradient(x,y-h/2,x,y+h/2,"rgb(0,0,255)","rgb(255,0,0)")
  screen.fillRect(x,y,w,h)
  screen.setLineWidth(5)
  screen.drawLine(x,y-h/2,x,y+h/2)
  screen.setLineWidth(1)
  
end

draw = function()
  
  screen.setTranslation(0)
  drawTest(-36,36)
  drawTest(-36,-36)
  
  screen.setTranslation(10,0)
  drawTest(36,36)
  drawTest(36,-36)

end

image

enjoy!

HomineLudens avatar Sep 08 '22 15:09 HomineLudens

I swear I already tried twice to understand this bug but failed miserably each time. I will get back to it sometime!

pmgl avatar Apr 19 '23 14:04 pmgl