@ -30,12 +30,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
!- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
- drawlist: move Font, FontSize, FontTexUvWhitePixel inside ImDrawList and make it self-contained (apart from drawing settings?)
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
- drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack.
- drawlist: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command).
- drawlist: avoid passing null (-9999,+9999) rectangle to end-user, instead perhaps pass rectangle based on io.DisplaySize?
- drawlist: primtiives/helpers to manipulate vertices post submission, so e.g. a quad/rect can be resized to fit later submitted content, _without_ using the ChannelSplit api
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
- drawlist: non-AA strokes have gaps between points (#593, #288), especially RenderCheckmark().
- drawlist: would be good to be able to deep copy a draw list (ImVector= op?).
- drawlist/opt: AddRect() axis aligned pixel aligned (no-aa) could use 8 triangles instead of 16 and no normal calculation.
DisplayWindowPadding=ImVec2(22,22);// Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
DisplaySafeAreaPadding=ImVec2(4,4);// If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
AntiAliasedLines=true;// Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.
AntiAliasedShapes=true;// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
CurveTessellationTol=1.25f;// Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
CurveTessellationTol=1.25f;// Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.
// B) When buf==NULL vsnprintf() will return the output size.
overlay_draw_list->AddPolyline(triangles_pos,3,IM_COL32(255,255,0,255),true,1.0f,false);// Add triangle without AA, more readable for large-thin triangle
IMGUI_APIImVec2CalcItemRectClosestPoint(constImVec2&pos,boolon_edge=false,floatoutward=+0.0f);// utility to find the closest point the last item bounding rectangle edge. useful to visually link items
ImVec2DisplayWindowPadding;// Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
ImVec2DisplaySafeAreaPadding;// If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
boolAntiAliasedLines;// Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
boolAntiAliasedShapes;// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
floatCurveTessellationTol;// Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
boolAntiAliasedFill;// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
floatCurveTessellationTol;// Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
ImVec4Colors[ImGuiCol_COUNT];
IMGUI_APIImGuiStyle();
@ -1368,7 +1371,7 @@ struct ImDrawCmd
ImDrawCallbackUserCallback;// If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
void*UserCallbackData;// The draw callback code can access this.
// Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h)
@ -1413,21 +1416,28 @@ enum ImDrawCornerFlags_
ImDrawCornerFlags_All=0xF// In your function calls you may use ~0 (= all bits sets) instead of ImDrawCornerFlags_All, as a convenience
};
enumImDrawListFlags_
{
ImDrawListFlags_AntiAliasedLines=1<<0,
ImDrawListFlags_AntiAliasedFill=1<<1
};
// Draw command list
// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future.
// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
// Each ImGui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to access the current window draw list and draw custom primitives.
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
// All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), however you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well)
// Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions).
// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.
structImDrawList
{
// This is what you have to render
ImVector<ImDrawCmd>CmdBuffer;// Commands. Typically 1 command = 1 GPU draw call.
ImVector<ImDrawCmd>CmdBuffer;// Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.
ImVector<ImDrawIdx>IdxBuffer;// Index buffer. Each command consume ImDrawCmd::ElemCount of those
ImVector<ImDrawVert>VtxBuffer;// Vertex buffer.
// [Internal, used while building lists]
ImDrawListFlagsFlags;// Flags, you may poke into these to adjust anti-aliasing settings per-primitive.
constImDrawListSharedData*_Data;// Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
constchar*_OwnerName;// Pointer to owner window's name for debugging
IMGUI_APIvoidPushClipRect(ImVec2clip_rect_min,ImVec2clip_rect_max,boolintersect_with_current_clip_rect=false);// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
ImGui::Checkbox("Anti-aliased lines",&style.AntiAliasedLines);ImGui::SameLine();ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
// IMPORTANT: This is one of the few instance of breaking the encapsulation of ImDrawList, as we pull this from ImGui state, but it is just SO useful.
// Might just move Font/FontSize to ImDrawList?
// Pull default font/size from the shared ImDrawListSharedData instance
if(font==NULL)
font=GImGui->Font;
font=_Data->Font;
if(font_size==0.0f)
font_size=GImGui->FontSize;
font_size=_Data->FontSize;
IM_ASSERT(font->ContainerAtlas->TexID==_TextureIdStack.back());// Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font.
// We are keeping those not leaking to the user by default, in the case the user has implicit cast operators between ImVec2 and its own types (when IM_VEC2_CLASS_EXTRA is defined)
@ -472,6 +472,21 @@ struct ImGuiColumnsSet
}
};
structImDrawListSharedData
{
ImVec2TexUvWhitePixel;// UV of white pixel in the atlas
ImFont*Font;// Current/default font (optional, for simplified AddText overload)
floatFontSize;// Current/default font size (optional, for simplified AddText overload)
floatCurveTessellationTol;
ImVec4ClipRectFullscreen;// Value for PushClipRectFullscreen()
// Const data
// FIXME: Bake rounded corners fill/borders in atlas