google / wuffs

Wrangling Untrusted File Formats Safely
Other
4.07k stars 129 forks source link

Add support for reading X11 cursors #56

Open pjanx opened 2 years ago

pjanx commented 2 years ago

It is an uncompressed format using alpha-premultiplied ARGB32, and it supports animations: https://www.x.org/releases/current/doc/man/man3/Xcursor.3.xhtml

Reading in only one nominal size would already be useful, e.g., the first contiguous stream of equivalent dimensions in the file.

I might try to implement it myself. I suspect the greatest issue will be handling seeking, since the format uses byte offsets. They are always little-endian, because that is what libXcursor does.

pjanx commented 2 years ago

Actually, I'll special case it for my use case. But it remains an easy enough format to (poorly) support.

nigeltao commented 2 years ago

Got an example file in that format?

pjanx commented 2 years ago

Interesting, these are built: https://gitlab.freedesktop.org/xorg/data/cursors

In that case, https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/raw/master/Adwaita/cursors/watch is animated.