ImDrawCmd Structure
ImVec4
Clipping rectangle (x1, y1, x2, y2). Subtract
ImDrawData->DisplayPos to get clipping rectangle in viewport coordinates.ImTextureRef
Reference to font/texture atlas or user-provided texture ID.
unsigned int
Start offset in vertex buffer. Always 0 unless
ImGuiBackendFlags_RendererHasVtxOffset is enabled.unsigned int
Number of indices to render (multiple of 3 for triangles).
Polygon Primitives
AddPolyline
const ImVec2*
Array of points
int
Number of points in array
ImU32
Color
ImDrawFlags
Flags (e.g.,
ImDrawFlags_Closed to close the polyline)float
Line thickness
AddConvexPolyFilled
AddConcavePolyFilled
Image Primitives
AddImage
ImTextureRef
Texture reference
const ImVec2&
Top-left corner position
const ImVec2&
Bottom-right corner position
const ImVec2&
default:"(0, 0)"
Top-left UV coordinate
const ImVec2&
default:"(1, 1)"
Bottom-right UV coordinate
ImU32
default:"IM_COL32_WHITE"
Tint color
Using (0,0)->(1,1) texture coordinates will generally display the entire texture.
AddImageQuad
const ImVec2&
Four corner positions
const ImVec2&
UV coordinates for each corner
AddImageRounded
float
Corner rounding radius
ImDrawFlags
Flags to control which corners are rounded
Path API
The path API allows building complex shapes by accumulating points, then rendering them.PathClear
PathLineTo
const ImVec2&
Point position
PathLineToMergeDuplicate
PathFillConvex
ImU32
Fill color
PathFillConcave
PathFillConvex().
PathStroke
ImU32
Stroke color
ImDrawFlags
Flags (e.g.,
ImDrawFlags_Closed)float
default:"1.0f"
Line thickness
Path Arcs
const ImVec2&
Arc center
float
Arc radius
float
Start angle in radians
float
End angle in radians
PathArcToFast() uses precomputed angles for a 12-step circle. a_min_of_12 and a_max_of_12 are in range 0-11.Path Bezier Curves
PathRect
Advanced: Draw Callbacks
AddCallback
ImDrawCallback
Function pointer to callback
void*
User data to pass to callback
size_t
default:"0"
Size of data to copy (0 = just copy pointer)
AddDrawCmd
Channels (Advanced)
Channels allow splitting render into layers that can be drawn out-of-order.Prefer using your own persistent instance of
ImDrawListSplitter instead of the channel functions.See Also
- ImDrawList - Main draw list overview
- ImDrawData - Frame draw data