Version/Branch of Dear ImGui:
Version 1.93.0, Branch: master
Back-ends:
n/a
Compiler, OS:
n/a
Full config/build information:
No response
Details:
Feature request
It would be nice if ImGui::Begin() / ImGui::End() could reserve draw list channels to allow user rendering behind the window decorations.
I'm thinking something along the lines of adding this to ImGui::Begin(), before RenderWindowDecorations():
window->DrawList->ChannelsSplit( 3 );
window->DrawList->ChannelsSetCurrent( 1 );and this to ImGui::End():
window->DrawList->ChannelsMerge( );This would allow code like:
const bool item_visible = ImGui::Begin( str_id, nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize );
if ( !item_visible )
return false;
ImDrawList* draw_list = ImGui::GetWindowDrawList( );
const ImVec2 p1 = ImGui::GetWindowPos( );
const ImVec2 p2 = ImGui::GetWindowPos( ) + ImGui::GetWindowSize( );
draw_list->ChannelsSetCurrent( 0 );
draw_list->AddRectFilled( p1 - ImVec2( 4.0f, 4.0f ), p2 + ImVec2( 4.0f, 4.0f ), IM_COL32( 0, 0, 255, 255 ) );
draw_list->ChannelsSetCurrent( 1 );The idea is that channel 0 would be rendered behind the window decorations, while channel 1 would remain the normal window contents, and channel '2' would act as a foreground above the window simply for consistency.
This would make it possible to easily draw things like backgrounds, glows, shadows, etc. that extend outside/behind the window decorations without having to modify ImGui or manually manage the draw list around Begin() / End().
I believe the existing ImDrawList channel API already provides everything needed for this; this would mainly make the functionality available through the normal Begin() / End() flow.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();Activity
0No activity yet.