Thanks all!
It's validating a filetype plugin for hardware compressed textures.
In C++:
1. Load in PNG
2. Compress to BC1 (aka DXT1)
3. Save as DDS
4. Save in my custom format.
5. Load my custom format and make sure it's the same (including all mips)
6. Decompress DDS with DirectXTex and save as PNG
In C#:
1. Load DDS
2. Load my custom format in C# and make sure it's the same
3. Decompress custom format to BGRA as part of the filetype plugin
4. Compare my BGRA to the decompressed PNG to make sure they are the same.
Similar process with ETC, but using KTX images not DDS. ASTC and PVRTC are on the radar, but that's about it.
All this is external to Paint.NET - I just use it as my viewer. As such, I don't have access to services for IPngFileType.
Even if I had a Document, I seem to need to set each pixel individually, which seems inefficient
BitmapLayer layer = ( BitmapLayer )document.Layers[ 0 ];
for( int32 x = 0; x < layer.Width; x++ )
{
for( int32 y = 0; y < layer.Height; y++ )
{
reference_bgra[x + ( y * layer.Width)] = ( int32 )layer.Surface[x, y].Bgra;
}
}
In the end, I opted for LoadFromWICFile:
private static int32[] LoadPNGImage( string fullPNGPath )
{
ScratchImage scratch_image = TexHelper.Instance.LoadFromWICFile( fullPNGPath + ".png", WIC_FLAGS.NONE );
Image image = scratch_image.GetImage( 0 );
int32[] reference_bgra = new int32[image.Width * image.Height];
Marshal.Copy( image.Pixels, reference_bgra, 0, image.Width * image.Height );
return reference_bgra;
}
I'm all ears for better approaches
Cheers
John