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

Bindings for some missing parts of the raw SDL2 API #205

Merged
merged 2 commits into from
Dec 2, 2021

Conversation

evanrinehart
Copy link
Contributor

Namely the functions SDL_ComposeCustomBlendMode and the associated enums,
SDL_GetWindowBordersSize, and SDL_GetDisplayUsableBounds.

I ran into an issue combining Cairo and SDL2 where I needed the custom blending mode. Cairo outputs texture data which uses pre-multiplied alpha, but SDL built-in blending modes do not support this. So blending two anti-aliased cairo-generated textures with SDL2 looks really bad by default, too dark around the edges. It works (on OSX) if you make a custom blending mode that implements the formulas

dstRGB = srcRGB + dstRGB*(1 - srcAlpha)
dstAlpha = srcAlpha + dstAlpha*(1 - srcAlpha)

Perhaps we're holding off on 2.0.6 support for some reason. Though I was surprised to see SDL_GetWindowBordersSize and SDL_GetDisplayUsableBounds missing, which were supposedly added in SDL 2.0.5.

Sorry I did not do a diff for all the missing API. These are just the things I ran into trying to make some graphics.

Namely the function SDL_ComposeCustomBlendMode and the associated enums,
SDL_GetWindowBordersSize, and SDL_GetDisplayUsableBounds.
@ocharles
Copy link
Member

Thanks for this! I'm a little behind on this project ATM, but I'll try and use this PR as a forcing function to get things up to date. Hopefully I'll merge this soon, it looks good!

@dpwiz dpwiz merged commit 3f00354 into haskell-game:master Dec 2, 2021
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

Successfully merging this pull request may close these issues.

3 participants