Enable basic support for 'RGBa' raw encoding/decoding

This commit is contained in:
immerrr 2015-02-02 11:53:16 +03:00
parent 5fa52f8891
commit d41fed6732
3 changed files with 20 additions and 0 deletions

View File

@ -48,6 +48,10 @@ class TestLibPack(PillowTestCase):
self.assertEqual(pack("RGBA", "RGBA"), [1, 2, 3, 4])
self.assertEqual(pack("RGBa", "RGBa"), [1, 2, 3, 4])
self.assertEqual(pack("RGBa", "BGRa"), [3, 2, 1, 4])
self.assertEqual(pack("RGBa", "aBGR"), [4, 3, 2, 1])
self.assertEqual(pack("CMYK", "CMYK"), [1, 2, 3, 4])
self.assertEqual(pack("YCbCr", "YCbCr"), [1, 2, 3])
@ -125,6 +129,11 @@ class TestLibPack(PillowTestCase):
self.assertEqual(unpack("RGBA", "BGRA;15", 2), (0, 131, 8, 0))
self.assertEqual(unpack("RGBA", "RGBA;4B", 2), (17, 0, 34, 0))
self.assertEqual(unpack("RGBa", "RGBa", 4), (1, 2, 3, 4))
self.assertEqual(unpack("RGBa", "BGRa", 4), (3, 2, 1, 4))
self.assertEqual(unpack("RGBa", "aRGB", 4), (2, 3, 4, 1))
self.assertEqual(unpack("RGBa", "aBGR", 4), (4, 3, 2, 1))
self.assertEqual(unpack("RGBX", "RGBX", 4), (1, 2, 3, 4)) # 4->255?
self.assertEqual(unpack("RGBX", "BGRX", 4), (3, 2, 1, 255))
self.assertEqual(unpack("RGBX", "XRGB", 4), (2, 3, 4, 255))

View File

@ -530,6 +530,11 @@ static struct {
{"RGBA", "B", 8, band2},
{"RGBA", "A", 8, band3},
/* true colour w. alpha premultiplied */
{"RGBa", "RGBa", 32, copy4},
{"RGBa", "BGRa", 32, ImagingPackBGRA},
{"RGBa", "aBGR", 32, ImagingPackABGR},
/* true colour w. padding */
{"RGBX", "RGBX", 32, copy4},
{"RGBX", "RGBX;L", 32, packRGBXL},

View File

@ -1114,6 +1114,12 @@ static struct {
{"RGBA", "B", 8, band2},
{"RGBA", "A", 8, band3},
/* true colour w. alpha premultiplied */
{"RGBa", "RGBa", 32, copy4},
{"RGBa", "BGRa", 32, unpackBGRA},
{"RGBa", "aRGB", 32, unpackARGB},
{"RGBa", "aBGR", 32, unpackABGR},
/* true colour w. padding */
{"RGBX", "RGB", 24, ImagingUnpackRGB},
{"RGBX", "RGB;L", 24, unpackRGBL},