Dominaezzz / kgl

Thin multiplatform wrappers for graphics.
Apache License 2.0
106 stars 14 forks source link

`kgl-stb` doesn't not have a "load from file" function #17

Open nlbuescher opened 4 years ago

nlbuescher commented 4 years ago
unsigned char* stbi_load(const char* filename, int* x, int* y, int* channels_in_file, int desired_channels)

or equivalent

fun STBImage.loadFrom(filename: String, desiredChannels: Int? = null)

are not present in kgl-stb, and at this point, there is no good way to interact with files using kotlinx-io because of the massive restructuring they're doing right now.

The cinterop def explicitly defines STB_NO_STDIO, which prevents the generation of stbi_load, but stbi_load works fine with cinterop. What was the reason for defining STB_NO_STDIO?

Dominaezzz commented 4 years ago

I'm having trouble finding the details now but the combination of JVM, Windows and stbi_load breaks because of some encoding issue (haven't tested this myself). I decided to postpone the addition of this method until I did some testing myself. Defining STB_NO_STDIO may have been overkill :sweat_smile:, so I'll remove it and let it be a workaround for now, until I add the method.

Dominaezzz commented 4 years ago

The work-around is now available in 0.1.9-dev-7. Will leave this issue open until wrapper is made.