2 Commits

Author SHA1 Message Date
Harald Kuhr
aab7b6f7f5 Add source region and subsample support + license.txt 2024-09-25 17:47:57 +02:00
Paul Allen
3c01071452
Microsoft Direct DrawSurface (DDS) support. (#1021)
* Basic wrapper around DDSReader.

Nasty hack to get initial plugin working...
Mark and Reset the imageinput stream when reading the header.  Then read the whole buffer into DDSReader and generate a fixed BufferedImage ignoring the getDestination() BufferedImage.

* Read header (DDSHeader) and pass into DDSReader

Remove header methods using buffer offset addressing.
Switch endian for DX1-DX5 types

* Fix pixel order to ARGB

* Push ImageInputStream into DDSReader

Unable to determine buffer length (so as a hack I over allocate buffer and read)

```
byte[] buffer = new byte[width * height * 4];
int len = imageInput.read(buffer);
```

Added test files for all supported formats.

* Added processImageStarted and stubbed out processImageProgress and processReadAborted

Added all DDS format test cases to getTestData

* Remove offset and use imageInput.readFully

Reads next image calculating/updating width/height from mipmapLevel.
Probably will never get used as we only want the largest image returned.

* Code cleanup and added exception handling.

* Use Enum DDSType instead of int values.

Pass imageIndex into mipmap.

* Update imageio/imageio-dds/src/main/java/com/twelvemonkeys/imageio/plugins/dds/DDSHeader.java

Improve IIOException "Invalid DDS header size"

Co-authored-by: Harald Kuhr <harald.kuhr@gmail.com>

* Update imageio/imageio-dds/src/main/java/com/twelvemonkeys/imageio/plugins/dds/DDSHeader.java

Improve Magic IIOException

Co-authored-by: Harald Kuhr <harald.kuhr@gmail.com>

* Delete .run directory

* Format tabs -> 4 spaces

* Convert 4byte array into %08x string format.

* Don't need to expose classes outside the package

DDSHeader, DDSReader, DDSType

* (fix) wrong public...

* Move setByteOrder to DDSImageReader.readHeader

* Use imageIndex to calculate height/width and buffer offset.

* Delete .gitignore

* Revert "Delete .gitignore"

This reverts commit 71a4e73ca61265e9ad59f7196d39470b069aab5b.

* Undelete/Restore .gitignore

* Simplify String.format into one.

* Override failing tests and ignore.

* Revert formatting on PNGImageReaderTest.java

---------

Co-authored-by: Harald Kuhr <harald.kuhr@gmail.com>
2024-09-25 15:40:09 +02:00