I need a PNG decoder written in pure C#, available under one of the sane opensource licenses like zlib, bsd, mit, etc. Relying on C libraries (even on zlib) in this case is not acceptable.
Has anyone seen anything like it? I’m having a hard time finding it.
Basically, I need to access png palette in an editor extension and I need to do it before it becomes a texture. Unity does not provide such functionality. I wrote a small native plugin that provides helper function, but the thing is I can’t really compile one binary and use it on every platform unity supports (see: https://forum.unity3d.com/threads/making-a-c-plugin-cross-platform.488525/ ), and this thing is a major pain to compile on windows platform.
So i’d like to have a pure C# code to deal with this. I sorta have a half-finished C# implementation I started to write myself, but I’d rather do something else. If I could cross-compile C++ into IL, it would work as well, but I’m not seeing any tool that provides such functionality, and don’t want to experiment with C++ to IL crorss-compilation myself.
I kinda thought there might be some sort of IR to IL converter for clang, but I’m not finding something like that.
I understand your problem. Sorry, dont have a solution. Just be aware, doing decoding of large images will be very slow under the CLR compared to its native counterpart. Lots of bit shifting and other low level operations going on.
Eh, it is an editor extension, and the images won’t be that huge. So it is manageable.
Yeah, but the thing is I wanted eventually release that, and I wouldn’t expect the user to deal with this mess by themselves. I also don’t have an access to macos. That’s the reason why I want C# implementation.
Guess I’ll tinker with my own mini-decoder a bit longer. At least C# has deflate function so I won’t need to write THAT.