RFC: automatic cursor scaling (Mac OS X)

While building Tux Paint, I discovered that all cursors in Mac OS X
must be 16x16 or smaller. Since Tux Paint uses 32x32 and 16x32 cursors,
this presents a problem. In the current version of SDL, the cursor data
is read (by the OS I presume) as if it is 16x16, so you end up with a
funky-looking thing.

So I said to myself “why not scale the cursor automatically in SDL to
16x16?” This is actually pretty easy using the Quartz 2D API’s, though
it ends up being about 100 lines of code. In this code, I trim the
transparent space around the cursor (if any), scale it to within 16x16
while preserving the aspect ratio, and translate/scale the hotx/hoty.

One caveat is that with interpolation turned on, the scaled cursor is a
bit blurry. With interpolation turned off, the cursor can end up with
holes in it. So I opted to keep interpolation on (Mac OS X supports
32-bit color w/alpha cursors).

The optimal fix for this is for the developer to have a small set of
16x16 cursors in addition to the larger cursors. That way you don’t
suffer from the blurring problem. That’s more data to manage though, so
scaling might be preferable.

My question is if this is something people would like to have in SDL
(initially just for Mac OS X), and SDL maintainers deem appropriate?

-D

While building Tux Paint, I discovered that all cursors in Mac OS X
must be 16x16 or smaller.

That’s annoying. All other OS’s that I know of allow up to 32x32 cursors.
Oh well, feel free to add the scaling code and we’ll only scale the cursor
if it is above 16x16.

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment