Warning
This module is not yet ready and some changes should be expected.
Helper utilities for .dds-file processing.
See also
Creates a 4CC string from an int.
Creates a 4CC int from a string.
This class can load and manipulate a (very) limited set of .dds-files.
The constructor loads and verifies .dds headers.
Returns a format string describing one pixel. Compatible with the struct-module. Can return None if the format is not supported.
Returns True if the file has a DDS_HEADER_DXT10-header in it.
Reads the first surface into a list which in turn contains lists containing RGBA-objects.
f = DDSFile("myfile.dds")
data = f.readSurface()
#Process every pixel.
for row in data:
for pixel in row:
pixel.r = 0
...
#Change pixel (x=42, y=30) to red, full alpha.
data[42][30] = RGBA(255, 0, 0, 255)
#Set pixels (10, 15) alpha component to 0 (fully transparent).
data[10][15].a = 0
#Save the processed data into a new file.
f.save("myfile_out.dds", data)
| Parameters: |
|---|