kivy/kivy — pull request #911 by p1tt (2013-01-24 20:15:08+00:00)
Title: Add support for GL_OES_compressed_paletted_texture.

Support for using GL_OES_compressed_paletted_texture colorfmt textures.
(http://www.opengl.org/registry/specs/OES/OES_compressed_paletted_texture.txt)

Example usage for an 4bit palette (in my special use case only the first 5 colors are really used, all others are red to detect an error in the imagedata easily):
lookupTable = bytes(bytearray((
0x00, 0x00, 0x00,
0x40, 0x40, 0x40,
0x80, 0x80, 0x80,
0xC0, 0xC0, 0xC0,
0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00
)))

palbuffer = bytes(bytearray((0x01, 0x23, 0x45, 0x43, 0x21, 0x00, 0x12, 0x34, 0x54, 0x32, 0x10) * 22))

texture = Texture.create(size=(22, 22))
texture.blit_buffer(lookupTable + palbuffer, colorfmt='palette4_rgb8', bufferfmt='ubyte')