// Flags for ImDrawList::AddShadowRect(), AddShadowCircle() etc.
enumImDrawShadowFlags_
{
ImDrawShadowFlags_None=0,
ImDrawShadowFlags_CutOutShapeBackground=1<<0// Do not render the shadow shape under the objects to be shadowed to save on fill-rate or facilitate blending. Slower on CPU.
};
// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
// It is however possible to temporarily alter flags between calls to ImDrawList:: functions.
enumImDrawListFlags_
@ -2850,17 +2858,19 @@ struct ImDrawList
// Shadows primitives
// [BETA] API
// - Add a shadow for a rectangular object, with min-max giving the object extents, and offset shifting the shadow. Rounding parameters refer to the object itself, not the shadow.
// - The filled parameter causes the shadow "under" the object to be drawn as well. In the vast majority of cases, filled shadows are unnecessary and wasteful. We still provide the primitives for consistency and flexibility.
// - Add shadow for a object, with min/max or center/radius describing the object extents, and offset shifting the shadow.
// - Rounding parameters refer to the object itself, not the shadow!
// - By default, the area under the object is filled, because this is simpler to process.
// Using the ImDrawShadowFlags_CutOutShapeBackground flag makes the function not render this area and leave a hole under the object.
// - Shadows w/ fill under the object: a bit faster for CPU, more pixels rendered, visible/darkening if used behind a transparent shape.
// Typically used by: small, frequent objects, opaque objects, transparent objects if shadow darkening isn't an issue.
// - Shadows w/ hole under the object: a bit slower for CPU, less pixels rendered, no difference if used behind a transparent shape.
// Typically used by: large, infrequent objects, transparent objects if exact blending/color matter.
// - FIXME-SHADOWS: 'offset' + ImDrawShadowFlags_CutOutBackground are not currently supported together with AddShadowCircle(), AddShadowConvexPoly().
IMGUI_APIvoidAddShadowCircle(constImVec2¢er,floatradius,floatshadow_thickness,constImVec2&offset,ImU32col,intnum_segments=12);// Offset not currently supported
IMGUI_APIvoidAddShadowCircleFilled(constImVec2¢er,floatradius,floatshadow_thickness,constImVec2&offset,ImU32col,intnum_segments=12);// Offset not currently supported
IMGUI_APIvoidAddShadowNGon(constImVec2¢er,floatradius,floatshadow_thickness,constImVec2&offset,ImU32col,intnum_segments);// Offset not currently supported
IMGUI_APIvoidAddShadowNGonFilled(constImVec2¢er,floatradius,floatshadow_thickness,constImVec2&offset,ImU32col,intnum_segments);// Offset not currently supported
IMGUI_APIvoidAddShadowConvexPoly(constImVec2*points,intnum_points,floatshadow_thickness,constImVec2&offset,ImU32col);// Offset not currently supported
IMGUI_APIvoidAddShadowConvexPolyFilled(constImVec2*points,intnum_points,floatshadow_thickness,constImVec2&offset,ImU32col);// Offset not currently supported
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
// - Important: filled shapes must always use clockwise winding order! The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing.
draw_list->AddShadowCircle(c,50.0f,shadow_thickness,ImVec2(0.0f,0.0f),ImGui::GetColorU32(shadow_color));// Offset forced to zero here because it isn't supported
draw_list->AddShadowConvexPoly(poly_points,num_poly_points,shadow_thickness,ImVec2(0.0f,0.0f),ImGui::GetColorU32(shadow_color));// Offset forced to zero because it isn't supported
// FIXME-SHADOWS: Offset forced to zero when shadow is not filled because it isn't supported
draw_list->PrimRectUV(draw_min+offset,draw_max+offset,uv_min,uv_max,col);// No clipping path (draw entire shadow)
PrimRectUV(draw_min+shadow_offset,draw_max+shadow_offset,uv_min,uv_max,shadow_col);// No clipping path (draw entire shadow)
elseif(is_rounded)
AddSubtractedRect(draw_list,draw_min+offset,draw_max+offset,uv_min,uv_max,inner_rect_points,inner_rect_points_count,col);// Complex path for rounded rectangles
AddSubtractedRect(this,draw_min+shadow_offset,draw_max+shadow_offset,uv_min,uv_max,inner_rect_points,inner_rect_points_count,shadow_col);// Complex path for rounded rectangles
else
AddSubtractedRect(draw_list,draw_min+offset,draw_max+offset,uv_min,uv_max,p_min,p_max,col);// Simple fast path for non-rounded rectangles
AddSubtractedRect(this,draw_min+shadow_offset,draw_max+shadow_offset,uv_min,uv_max,obj_min,obj_max,shadow_col);// Simple fast path for non-rounded rectangles
IM_ASSERT((is_filled||(ImLengthSqr(offset)<0.00001f))&&"Drawing circle/convex shape shadows with no center fill and an offset is not currently supported");
IM_ASSERT((is_filled||(ImLengthSqr(shadow_offset)<0.00001f))&&"Drawing circle/convex shape shadows with no center fill and an offset is not currently supported");
// We need to do this because we need the edge strips to have widths that match up with the corner sections, otherwise pixel cracking can occur along the boundaries
constintmax_vertices=(4+(3*2)+(is_filled?1:0))*num_edges;// 4 vertices per edge plus 3*2 for potentially two corner triangles, plus one per vertex for fill
constintmax_indices=((6+(3*2))*num_edges)+(is_filled?((num_edges-2)*3):0);// 2 tris per edge plus up to two corner triangles, plus fill triangles