ZepDisplay_ImGui is the ImGui rendering backend for Zep. It implements the ZepDisplay interface using Dear ImGui’s drawing API.
Header: include/zep/imgui/display_imgui.h
Classes
ZepDisplay_ImGui
ImGui implementation of the display interface.ZepFont_ImGui
ImGui font wrapper.Implementation Details
Drawing Operations
All drawing operations useImGui::GetWindowDrawList() to add primitives to the current ImGui window’s draw list.
DrawChars (display_imgui.h:86)
- Casts the font to
ZepFont_ImGuito get the underlyingImFont* - Uses
ImDrawList::AddText()to render text - Applies clipping rectangle if set
- Modulates color with
ImGui::GetStyle().Alpha
DrawLine (display_imgui.h:106)
- Uses
ImDrawList::AddLine() - Respects the current clipping rectangle
- Modulates color with style alpha
DrawRectFilled (display_imgui.h:123)
- Uses
ImDrawList::AddRectFilled() - Applies clipping if active
Clipping (display_imgui.h:140)
Clipping is managed viaSetClipRect(). When a clip rect is set:
- The rect is stored in
m_clipRect - Drawing operations push/pop clip rects using
ImDrawList::PushClipRect()andPopClipRect() - A zero-width clip rect disables clipping
Font Management (display_imgui.h:145)
- Creates
ZepFont_ImGuiinstances on demand - Uses the first font from
ImGui::GetIO().Fonts - Scales pixel height by the display’s pixel scale
Text Measurement (display_imgui.h:51)
ZepFont_ImGui::GetTextSize() uses ImFont::CalcTextSizeA() with:
- Font size set to pixel height
- No wrapping (
FLT_MAXfor width) - Returns character advance width (not just the glyph bounds)
- Falls back to ‘A’ character size for invalid glyphs
Color Conversion (display_imgui.h:155)
NVec4f colors to ImGui’s packed ImU32 format (ABGR), modulating alpha with ImGui::GetStyle().Alpha.
Helper Functions
The header provides conversion utilities:Greek Character Support (display_imgui.h:33)
Usage Example
Related
- ZepEditor - Main editor class
- ZepDisplay - Abstract display interface
- ZepDisplay_Qt - Qt implementation
