def load_dds(self, ddspath, convert_tonormal): da = pyglet.image.load( ddspath, decoder=DDSImageDecoder()).get_texture().get_image_data() img_format = 'RGBA' if len(da.format) == 4 else 'RGB' imagedata = da.get_data(img_format, len(da.format) * da.width) img = Image.fromstring(img_format, (da.width, da.height), imagedata) img = img.transpose(1) if convert_tonormal: img = self.readHeight2Bump(img) return img
class TEST_DDS_RGBA_DXT5(base_load.TestLoad): texture_file = 'rgba_dxt5.dds' decoder = DDSImageDecoder()
class TEST_DDS_RGB_DXT1(base_load.TestLoad): texture_file = 'rgb_dxt1.dds' decoder = DDSImageDecoder()
def test_dds_loading(image_test, image_name): """Test loading DDS images.""" from pyglet.image.codecs.dds import DDSImageDecoder image_test.test_image_loading(DDSImageDecoder(), image_name)
def test_dds_load(self): from pyglet.image.codecs.dds import DDSImageDecoder self._test_load(dds_files, DDSImageDecoder())