SDL/include
Sam Lantinga 981e0d367c Fixed bug 4903 - Lack of color multiply with alpha (SDL_BLENDMODE_MOD + SDL_BLENDMODE_BLEND) blending mode for all renderers
Konrad

This kind of blending is rather quite useful and in my opinion should be available for all renderers. I do need it myself, but since I didn't want to use a custom blending mode which is supported only by certain renderers (e.g. not in software which is quite important for me) I did write implementation of SDL_BLENDMODE_MUL for all renderers altogether.

SDL_BLENDMODE_MUL implements following equation:

dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
dstA = (srcA * dstA) + (dstA * (1-srcA))

Background:

https://i.imgur.com/UsYhydP.png

Blended texture:

https://i.imgur.com/0juXQcV.png

Result for SDL_BLENDMODE_MOD:

https://i.imgur.com/wgNSgUl.png

Result for SDL_BLENDMODE_MUL:

https://i.imgur.com/Veokzim.png

I think I did cover all possibilities within included patch, but I didn't write any tests for SDL_BLENDMODE_MUL, so it would be lovely if someone could do it.
2020-01-16 08:52:59 -08:00
..
SDL.h Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h. 2019-08-05 12:35:32 -03:00
SDL_assert.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_atomic.h Fixed memory barrier macro check so it isn't quite so fragile 2019-06-30 23:58:31 -07:00
SDL_audio.h Fixed bug 3894 - Fuzzing crashes for SDL_LoadWAV 2019-06-08 19:02:42 -07:00
SDL_bits.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_blendmode.h Fixed bug 4903 - Lack of color multiply with alpha (SDL_BLENDMODE_MOD + SDL_BLENDMODE_BLEND) blending mode for all renderers 2020-01-16 08:52:59 -08:00
SDL_clipboard.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_config.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_config.h.cmake CMakeLists.txt: add several missing function checks for unix case. 2019-11-21 10:33:56 +03:00
SDL_config.h.in Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp() 2019-11-20 16:42:50 -08:00
SDL_config_android.h added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
SDL_config_iphoneos.h added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
SDL_config_macosx.h added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
SDL_config_minimal.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_config_os2.h updated os/2 config file 2019-11-21 11:33:50 +03:00
SDL_config_pandora.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_config_psp.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_config_windows.h added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
SDL_config_winrt.h added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
SDL_config_wiz.h added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
SDL_copying.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_cpuinfo.h ARM: Create configure option --enable-arm-simd to govern assembly optimizations 2019-10-24 21:12:08 -04:00
SDL_egl.h Don't have Windows headers define min/max, in case they're defined by application code 2019-09-11 15:08:37 -07:00
SDL_endian.h SDL_endian.h: Use endian.h for OpenBSD. 2019-10-21 22:22:28 +03:00
SDL_error.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_events.h Fixed a comment typo (thanks, Dominus!). 2019-11-01 04:32:44 -04:00
SDL_filesystem.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_gamecontroller.h Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks. 2019-12-20 20:12:03 -08:00
SDL_gesture.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_haptic.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_hints.h Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee 2019-12-19 15:01:35 -08:00
SDL_joystick.h Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks. 2019-12-20 20:12:03 -08:00
SDL_keyboard.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_keycode.h Remove 'Enum' suffixes (bug 4813) 2019-10-11 06:18:24 +02:00
SDL_loadso.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_log.h Remove 'Enum' suffixes (bug 4813) 2019-10-11 06:18:24 +02:00
SDL_main.h Fixed building with C++ 2019-03-19 10:59:41 -07:00
SDL_messagebox.h SDL_messagebox.h: remove comma at end of enumerator list 2019-09-22 21:41:20 +03:00
SDL_metal.h Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h. 2019-08-05 12:35:32 -03:00
SDL_mouse.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_mutex.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_name.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_opengl.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_opengl_glext.h Don't have Windows headers define min/max, in case they're defined by application code 2019-09-11 15:08:37 -07:00
SDL_opengles.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_opengles2.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_opengles2_gl2.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_opengles2_gl2ext.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_opengles2_gl2platform.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_opengles2_khrplatform.h Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL_pixels.h Added SDL_PIXELFORMAT_BGR444 2019-11-02 22:58:52 +00:00
SDL_platform.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_power.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_quit.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_rect.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_render.h Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode 2019-12-22 13:39:44 -08:00
SDL_revision.h revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
SDL_rwops.h Fixed bug 4526 - replace SDL_RW* macros with functions for using in bindings 2019-06-08 17:43:23 -07:00
SDL_scancode.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_sensor.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_shape.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_stdinc.h Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp() 2019-11-20 16:42:50 -08:00
SDL_surface.h Rename surface aligned memory flag to SDL_SIMD_ALIGNED 2019-02-04 08:34:24 +01:00
SDL_system.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_syswm.h haiku: Implement message box for Haiku 2019-11-11 16:44:40 -05:00
SDL_test.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_assert.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_common.h test: unify all the command line usage logging. 2019-05-28 17:39:13 -04:00
SDL_test_compare.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_crc32.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_font.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_fuzzer.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_harness.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_images.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_log.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_md5.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_memory.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_test_random.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_thread.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_timer.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_touch.h Add hint SDL_HINT_MOUSE_TOUCH_EVENTS for mouse events to generate touch events 2019-04-04 16:51:50 +02:00
SDL_types.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_version.h Updated SDL development builds to version 2.0.11 2019-09-22 10:37:16 -07:00
SDL_video.h include: Removed a FIXME comment. 2019-10-15 14:17:32 -04:00
SDL_vulkan.h Fixed bug 4570 - Support Vulkan Portability rather than MoltenVK specifically 2019-06-11 18:13:46 -07:00
begin_code.h Fixed bug 4641 - clang and clang-cl builds on windows create -Wpragma-pack warnings 2019-06-10 08:46:20 -07:00
close_code.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00