It's been a quiet week on the list, with few juicy code examples. In view of the recent discussion of picture rotation I thought I would post a 90-degree rotation method with two advantages: (1) It works in _any_ color depth. (2) It will use up many spare leisure hours while you try to understand it

How does it work?
The series of masked and shifted COPYBITS calls in FN WeirdRotate rotates the 4 quadrants of the picture. Each iteration then refines the mask to subdivide each quadrant into 4, until finally the 4x4 pixel sub-sub-sub.. quadrants are the last to be rotated, all at once (you can see this as "de-fuzzing" on the last iteration). I think of it as a 2-dimensional generalisation of the old trick to exchange two variables:-