google / wuffs

Wrangling Untrusted File Formats Safely
Other
4.18k stars 131 forks source link

Add support for reading X11 cursors #56

Open pjanx opened 3 years ago

pjanx commented 3 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 3 years ago

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

nigeltao commented 3 years ago

Got an example file in that format?

pjanx commented 3 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.