[cairo] ARGB1555 conversion
Mike Gran
spk121 at yahoo.com
Sat Aug 25 11:43:45 PDT 2012
Hi-
I have a set of game art that was stored as 16-bit ARGB1555 format:
5 bits per RGB color plus 1 bit that is basically a color key bit to signal
that the pixel is completely transparent. ARGB1555 is a format from both
old DOS-era Targa files and from NintendoDS homebrew games.
FWIW, these are 8x8 pixel tiles, and I'll end up blitting maybe 2000 of them
per frame. To make it work, I paint each the tiles onto a CAIRO_FORMAT_ARGB32
image surface, and then just paint the entire image surface to the GTK window's
surface. (Painting the tiles directly onto the GTK window surface was slower)
I've been up-converting the 16-bit ARGB1555 to CAIRO_FORMAT_ARGB32, which is
okay so far. Is that the best way? Can I somehow use ARGB1555 natively?
If all I care about is 100% alpha and 0% alpha Should I instead be trying
to use CAIRO_FORMAT_A1 + CAIRO_FORMAT_RGB16_565 somehow, since speed is my
primary concern?
Thanks,
Mike
More information about the cairo
mailing list