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

Feature request: Expose the pitch field of Surface #175

Open
Mikolaj opened this issue Jan 17, 2018 · 0 comments
Open

Feature request: Expose the pitch field of Surface #175

Mikolaj opened this issue Jan 17, 2018 · 0 comments

Comments

@Mikolaj
Copy link
Contributor

Mikolaj commented Jan 17, 2018

See https://wiki.libsdl.org/SDL_Surface?highlight=%28%5CbCategoryStruct%5Cb%29%7C%28SDLStructTemplate%29

I can get it via

let formatBpp = fromIntegral (SDL.Raw.Types.pixelFormatBytesPerPixel pixelFormat)
in SDL.Raw.Types.surfaceW surface * formatBpp

but I don't know if it's not guaranteed to be equal always, e.e.g, in some exotic pixel formats.

agentultra added a commit to agentultra/WaveFunctionCollapse that referenced this issue Jan 8, 2025
We pass in the Surface so that we can calculate the byte offset to the
pixel data based on the surface pixel format.

We have to calculate pitch based on the image width and pixel format
because the pitch field from the SDL_Surface struct is not exposed in
the wrapper.

See: haskell-game/sdl2#175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants