mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Add support for DXT3 to DdsImagePlugin
This commit is contained in:
parent
18a91cebcf
commit
b46804ea27
|
@ -122,6 +122,9 @@ class DdsImageFile(ImageFile.ImageFile):
|
|||
if fourcc == b"DXT1":
|
||||
self.pixel_format = "DXT1"
|
||||
n = 1
|
||||
elif fourcc == b"DXT3":
|
||||
self.pixel_format = "DXT3"
|
||||
n = 2
|
||||
elif fourcc == b"DXT5":
|
||||
self.pixel_format = "DXT5"
|
||||
n = 3
|
||||
|
|
Binary file not shown.
BIN
Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.png
Normal file
BIN
Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
|
@ -36,12 +36,21 @@ class TestFileDds(PillowTestCase):
|
|||
self.assertEqual(im.mode, "RGBA")
|
||||
self.assertEqual(im.size, (256, 256))
|
||||
|
||||
self.assert_image_equal(target, im, 5)
|
||||
self.assert_image_equal(target, im)
|
||||
|
||||
def test_sanity_dxt3(self):
|
||||
"""Check DXT3 images are not supported"""
|
||||
self.assertRaises(NotImplementedError,
|
||||
lambda: Image.open(TEST_FILE_DXT3))
|
||||
"""Check DXT3 images can be opened"""
|
||||
|
||||
target = Image.open(TEST_FILE_DXT3.replace('.dds', '.png'))
|
||||
|
||||
im = Image.open(TEST_FILE_DXT3)
|
||||
im.load()
|
||||
|
||||
self.assertEqual(im.format, "DDS")
|
||||
self.assertEqual(im.mode, "RGBA")
|
||||
self.assertEqual(im.size, (256, 256))
|
||||
|
||||
self.assert_image_equal(target, im)
|
||||
|
||||
def test__validate_true(self):
|
||||
"""Check valid prefix"""
|
||||
|
|
|
@ -153,7 +153,7 @@ static void decode_bc1_block(rgba *col, const UINT8* src) {
|
|||
|
||||
static void decode_bc2_block(rgba *col, const UINT8* src) {
|
||||
int n, bitI, byI, av;
|
||||
decode_bc1_color(col, src);
|
||||
decode_bc1_color(col, src + 8);
|
||||
for (n = 0; n < 16; n++) {
|
||||
bitI = n * 4;
|
||||
byI = bitI >> 3;
|
||||
|
|
Loading…
Reference in New Issue
Block a user