examples: Add blending example (#15657)

This commit is contained in:
Ahmed Lyas
2026-05-19 21:05:23 -07:00
committed by GitHub
parent f9380e15de
commit c9e2e732b6
6 changed files with 252 additions and 0 deletions
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{B938A3C0-6C64-4734-B705-ED3642C01B47}</ProjectGuid>
</PropertyGroup>
<Import Project="$(SolutionDir)\examples\Examples.props" />
<ItemGroup>
<None Include="$(SolutionDir)\..\examples\renderer\20-blending\README.txt" />
<ClCompile Include="$(SolutionDir)\..\examples\renderer\20-blending\blending.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
+1
View File
@@ -142,6 +142,7 @@ add_sdl_example_executable(renderer-cliprect SOURCES renderer/15-cliprect/clipre
add_sdl_example_executable(renderer-read-pixels SOURCES renderer/17-read-pixels/read-pixels.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.png)
add_sdl_example_executable(renderer-debug-text SOURCES renderer/18-debug-text/debug-text.c)
add_sdl_example_executable(renderer-affine-textures SOURCES renderer/19-affine-textures/affine-textures.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.png)
add_sdl_example_executable(renderer-blending SOURCES renderer/20-blending/blending.c)
add_sdl_example_executable(audio-simple-playback SOURCES audio/01-simple-playback/simple-playback.c)
add_sdl_example_executable(audio-simple-playback-callback SOURCES audio/02-simple-playback-callback/simple-playback-callback.c)
add_sdl_example_executable(audio-load-wav SOURCES audio/03-load-wav/load-wav.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.wav)
+5
View File
@@ -0,0 +1,5 @@
This example uses SDL_SetTextureBlendMode() to apply blending to textures,
and SDL_ComposeCustomBlendMode() to create a custom blend mode.
You can also use SDL_SetRenderDrawBlendMode() to apply blending to the
entire renderer, but it only affects filled rects and lines, not texture
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB