Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nlbuescher opened this issue Feb 6, 2020 · 2 comments
Open

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

nlbuescher opened this issue Feb 6, 2020 · 2 comments

Comments

@nlbuescher
Copy link
Collaborator

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
Copy link
Owner

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 😅, so I'll remove it and let it be a workaround for now, until I add the method.

@Dominaezzz
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants