mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Merge pull request #4248 from uploadcare/La-packing
Add La mode packing and unpacking
This commit is contained in:
commit
5dc8abfb16
|
@ -44,6 +44,9 @@ class TestLibPack(PillowTestCase):
|
||||||
self.assert_pack("LA", "LA", 2, (1, 2), (3, 4), (5, 6))
|
self.assert_pack("LA", "LA", 2, (1, 2), (3, 4), (5, 6))
|
||||||
self.assert_pack("LA", "LA;L", 2, (1, 4), (2, 5), (3, 6))
|
self.assert_pack("LA", "LA;L", 2, (1, 4), (2, 5), (3, 6))
|
||||||
|
|
||||||
|
def test_La(self):
|
||||||
|
self.assert_pack("La", "La", 2, (1, 2), (3, 4), (5, 6))
|
||||||
|
|
||||||
def test_P(self):
|
def test_P(self):
|
||||||
self.assert_pack("P", "P;1", b"\xe4", 1, 1, 1, 0, 0, 255, 0, 0)
|
self.assert_pack("P", "P;1", b"\xe4", 1, 1, 1, 0, 0, 255, 0, 0)
|
||||||
self.assert_pack("P", "P;2", b"\xe4", 3, 2, 1, 0)
|
self.assert_pack("P", "P;2", b"\xe4", 3, 2, 1, 0)
|
||||||
|
@ -269,6 +272,9 @@ class TestLibUnpack(PillowTestCase):
|
||||||
self.assert_unpack("LA", "LA", 2, (1, 2), (3, 4), (5, 6))
|
self.assert_unpack("LA", "LA", 2, (1, 2), (3, 4), (5, 6))
|
||||||
self.assert_unpack("LA", "LA;L", 2, (1, 4), (2, 5), (3, 6))
|
self.assert_unpack("LA", "LA;L", 2, (1, 4), (2, 5), (3, 6))
|
||||||
|
|
||||||
|
def test_La(self):
|
||||||
|
self.assert_unpack("La", "La", 2, (1, 2), (3, 4), (5, 6))
|
||||||
|
|
||||||
def test_P(self):
|
def test_P(self):
|
||||||
self.assert_unpack("P", "P;1", b"\xe4", 1, 1, 1, 0, 0, 1, 0, 0)
|
self.assert_unpack("P", "P;1", b"\xe4", 1, 1, 1, 0, 0, 1, 0, 0)
|
||||||
self.assert_unpack("P", "P;2", b"\xe4", 3, 2, 1, 0)
|
self.assert_unpack("P", "P;2", b"\xe4", 3, 2, 1, 0)
|
||||||
|
|
|
@ -555,6 +555,9 @@ static struct {
|
||||||
{"LA", "LA", 16, packLA},
|
{"LA", "LA", 16, packLA},
|
||||||
{"LA", "LA;L", 16, packLAL},
|
{"LA", "LA;L", 16, packLAL},
|
||||||
|
|
||||||
|
/* greyscale w. alpha premultiplied */
|
||||||
|
{"La", "La", 16, packLA},
|
||||||
|
|
||||||
/* palette */
|
/* palette */
|
||||||
{"P", "P;1", 1, pack1},
|
{"P", "P;1", 1, pack1},
|
||||||
{"P", "P;2", 2, packP2},
|
{"P", "P;2", 2, packP2},
|
||||||
|
|
|
@ -1307,6 +1307,9 @@ static struct {
|
||||||
{"LA", "LA", 16, unpackLA},
|
{"LA", "LA", 16, unpackLA},
|
||||||
{"LA", "LA;L", 16, unpackLAL},
|
{"LA", "LA;L", 16, unpackLAL},
|
||||||
|
|
||||||
|
/* greyscale w. alpha premultiplied */
|
||||||
|
{"La", "La", 16, unpackLA},
|
||||||
|
|
||||||
/* palette */
|
/* palette */
|
||||||
{"P", "P;1", 1, unpackP1},
|
{"P", "P;1", 1, unpackP1},
|
||||||
{"P", "P;2", 2, unpackP2},
|
{"P", "P;2", 2, unpackP2},
|
||||||
|
@ -1384,7 +1387,6 @@ static struct {
|
||||||
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
|
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* true colour w. alpha premultiplied */
|
/* true colour w. alpha premultiplied */
|
||||||
{"RGBa", "RGBa", 32, copy4},
|
{"RGBa", "RGBa", 32, copy4},
|
||||||
{"RGBa", "BGRa", 32, unpackBGRA},
|
{"RGBa", "BGRa", 32, unpackBGRA},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user