Drawing image:fadedImage(1.0, gfx.image.kDitherTypeBayer4x4) results in offset image

  1. load source image as image
  2. sprite:setImage( image:fadedImage(1.0, playdate.graphics.image.kDitherTypeBayer4x4) )
  3. resulting image is incorrect
    • it is shifted horizontally left by one pixel compared to the source
    • left-most column of pixels appears as the right-most column of pixels in the faded image

Result

  • a jarring transition from our faded image to the original image

Workaround

  • use a different image as source for the fade, with a second image for after the transition

Notes

  • not tested any other dither types
  • not tested drawFaded()

related: blendWithImage is offset x -1 with kDitherTypeBayer4x4

I'll check it out!

2 Likes

Another note:

  • doing this on a transparent image gives a column of black pixels down the right hand side

This all feels like an off-by-one problem?

spot the bug! :person_facepalming:

	if ( rowstride > 0 )
		val = pix[index++];

	if ( pix[index] > rowpattern[(x+xphase)%4] )
		outbyte |= bit;