How rotatePixels samples the source at an angle that is not a multiple of a quarter turn.
'nearest' takes the closest single source pixel: the fast path, and the right one for pixel
art that is meant to stay crisp. 'linear' blends the four pixels around the sample point, so
an edge comes out as an edge instead of a staircase - what a tile rotated by 30 or 60 degrees
onto a hex grid needs, and what art with soft or anti-aliased edges wants anyway. Either mode
samples premultiplied, so a transparent neighbour contributes coverage and never colour: a
straight RGBA blend would pull the (arbitrary) colour of transparent pixels into the edge and
fringe every cut-out sprite.
How
rotatePixelssamples the source at an angle that is not a multiple of a quarter turn.'nearest'takes the closest single source pixel: the fast path, and the right one for pixel art that is meant to stay crisp.'linear'blends the four pixels around the sample point, so an edge comes out as an edge instead of a staircase - what a tile rotated by 30 or 60 degrees onto a hex grid needs, and what art with soft or anti-aliased edges wants anyway. Either mode samples premultiplied, so a transparent neighbour contributes coverage and never colour: a straight RGBA blend would pull the (arbitrary) colour of transparent pixels into the edge and fringe every cut-out sprite.