how does Image relate to ScratchImage?
joreg opened this issue · 4 comments
hei deng, thanks for this wrapper!
according to the 3rd sample here:
https://github.com/Microsoft/DirectXTex/wiki/DDS-I-O-Functions#examples
i should be able to call SaveToDDSFile() with an Image as its first parameter but that doesn't seem possible in this wrapper as it insists on a ScratchImage.
am i doing something wrong?
Hi joreg,
like in the original DirectXTex an Image is part of a ScratchImage, which can consist of multiple Images (MipMaps, 3D Slices, TextureArray, TextureCube).
In DirectXTexNet I've decided to make the SaveTo* methods part of the main ScratchImage class. If you really want to save just a single Image, use the SaveToDDSFile(int imageIndex, DDS_FLAGS flags, String szFile) overload.
If you want to construct your own Image instances from scratch, you would need to use TexHelper.Instance.InitializeTemporary(Image[] images, ..) and then use that temporary ScratchImage to call SaveToDDSFile.
Greetings,
deng0
perfect, that works, thanks!
now the scenario i'd like to achieve:
- i have a pointer to an rgba array
- i was hoping that i can use this lib to create an image from it and compress it to the BC3 format
- then save that to disk as .dds file
what i get so far is saving the byte array to a .dds in rgba format. can you give me a hint as to how i'd go for the compression (if possible at all).
yes, sure you can achieve that.
If you have created the temporary scratchImage from your rgba array, just call
compressedScratchImage = scratchImage.Compress(..) and then compressedScratchImage.SaveToDDSFile(..)
perfect, thanks!