Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
ImDrawList Struct Reference

#include <src/imgui/imgui.h>

+ Collaboration diagram for ImDrawList:

Public Member Functions

 ImDrawList (const ImDrawListSharedData *shared_data)
 
 ~ImDrawList ()
 
IMGUI_API void PushClipRect (ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
 
IMGUI_API void PushClipRectFullScreen ()
 
IMGUI_API void PopClipRect ()
 
IMGUI_API void PushTextureID (ImTextureID texture_id)
 
IMGUI_API void PopTextureID ()
 
ImVec2 GetClipRectMin () const
 
ImVec2 GetClipRectMax () const
 
IMGUI_API void AddLine (const ImVec2 &p1, const ImVec2 &p2, ImU32 col, float thickness=1.0f)
 
IMGUI_API void AddRect (const ImVec2 &p_min, const ImVec2 &p_max, ImU32 col, float rounding=0.0f, ImDrawFlags flags=0, float thickness=1.0f)
 
IMGUI_API void AddRectFilled (const ImVec2 &p_min, const ImVec2 &p_max, ImU32 col, float rounding=0.0f, ImDrawFlags flags=0)
 
IMGUI_API void AddRectFilledMultiColor (const ImVec2 &p_min, const ImVec2 &p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
 
IMGUI_API void AddQuad (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, ImU32 col, float thickness=1.0f)
 
IMGUI_API void AddQuadFilled (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, ImU32 col)
 
IMGUI_API void AddTriangle (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, ImU32 col, float thickness=1.0f)
 
IMGUI_API void AddTriangleFilled (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, ImU32 col)
 
IMGUI_API void AddCircle (const ImVec2 &center, float radius, ImU32 col, int num_segments=0, float thickness=1.0f)
 
IMGUI_API void AddCircleFilled (const ImVec2 &center, float radius, ImU32 col, int num_segments=0)
 
IMGUI_API void AddNgon (const ImVec2 &center, float radius, ImU32 col, int num_segments, float thickness=1.0f)
 
IMGUI_API void AddNgonFilled (const ImVec2 &center, float radius, ImU32 col, int num_segments)
 
IMGUI_API void AddText (const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
 
IMGUI_API void AddText (const ImFont *font, float font_size, const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL, float wrap_width=0.0f, const ImVec4 *cpu_fine_clip_rect=NULL)
 
IMGUI_API void AddPolyline (const ImVec2 *points, int num_points, ImU32 col, ImDrawFlags flags, float thickness)
 
IMGUI_API void AddConvexPolyFilled (const ImVec2 *points, int num_points, ImU32 col)
 
IMGUI_API void AddBezierCubic (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, ImU32 col, float thickness, int num_segments=0)
 
IMGUI_API void AddBezierQuadratic (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, ImU32 col, float thickness, int num_segments=0)
 
IMGUI_API void AddImage (ImTextureID user_texture_id, const ImVec2 &p_min, const ImVec2 &p_max, const ImVec2 &uv_min=ImVec2(0, 0), const ImVec2 &uv_max=ImVec2(1, 1), ImU32 col=IM_COL32_WHITE)
 
IMGUI_API void AddImageQuad (ImTextureID user_texture_id, const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, const ImVec2 &uv1=ImVec2(0, 0), const ImVec2 &uv2=ImVec2(1, 0), const ImVec2 &uv3=ImVec2(1, 1), const ImVec2 &uv4=ImVec2(0, 1), ImU32 col=IM_COL32_WHITE)
 
IMGUI_API void AddImageRounded (ImTextureID user_texture_id, const ImVec2 &p_min, const ImVec2 &p_max, const ImVec2 &uv_min, const ImVec2 &uv_max, ImU32 col, float rounding, ImDrawFlags flags=0)
 
void PathClear ()
 
void PathLineTo (const ImVec2 &pos)
 
void PathLineToMergeDuplicate (const ImVec2 &pos)
 
void PathFillConvex (ImU32 col)
 
void PathStroke (ImU32 col, ImDrawFlags flags=0, float thickness=1.0f)
 
IMGUI_API void PathArcTo (const ImVec2 &center, float radius, float a_min, float a_max, int num_segments=0)
 
IMGUI_API void PathArcToFast (const ImVec2 &center, float radius, int a_min_of_12, int a_max_of_12)
 
IMGUI_API void PathBezierCubicCurveTo (const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, int num_segments=0)
 
IMGUI_API void PathBezierQuadraticCurveTo (const ImVec2 &p2, const ImVec2 &p3, int num_segments=0)
 
IMGUI_API void PathRect (const ImVec2 &rect_min, const ImVec2 &rect_max, float rounding=0.0f, ImDrawFlags flags=0)
 
IMGUI_API void AddCallback (ImDrawCallback callback, void *callback_data)
 
IMGUI_API void AddDrawCmd ()
 
IMGUI_API ImDrawListCloneOutput () const
 
void ChannelsSplit (int count)
 
void ChannelsMerge ()
 
void ChannelsSetCurrent (int n)
 
IMGUI_API void PrimReserve (int idx_count, int vtx_count)
 
IMGUI_API void PrimUnreserve (int idx_count, int vtx_count)
 
IMGUI_API void PrimRect (const ImVec2 &a, const ImVec2 &b, ImU32 col)
 
IMGUI_API void PrimRectUV (const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a, const ImVec2 &uv_b, ImU32 col)
 
IMGUI_API void PrimQuadUV (const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &d, const ImVec2 &uv_a, const ImVec2 &uv_b, const ImVec2 &uv_c, const ImVec2 &uv_d, ImU32 col)
 
void PrimWriteVtx (const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
 
void PrimWriteIdx (ImDrawIdx idx)
 
void PrimVtx (const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
 
void AddBezierCurve (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, ImU32 col, float thickness, int num_segments=0)
 
void PathBezierCurveTo (const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, int num_segments=0)
 
IMGUI_API void _ResetForNewFrame ()
 
IMGUI_API void _ClearFreeMemory ()
 
IMGUI_API void _PopUnusedDrawCmd ()
 
IMGUI_API void _OnChangedClipRect ()
 
IMGUI_API void _OnChangedTextureID ()
 
IMGUI_API void _OnChangedVtxOffset ()
 
IMGUI_API int _CalcCircleAutoSegmentCount (float radius) const
 
IMGUI_API void _PathArcToFastEx (const ImVec2 &center, float radius, int a_min_sample, int a_max_sample, int a_step)
 
IMGUI_API void _PathArcToN (const ImVec2 &center, float radius, float a_min, float a_max, int num_segments)
 

Public Attributes

ImVector< ImDrawCmdCmdBuffer
 
ImVector< ImDrawIdxIdxBuffer
 
ImVector< ImDrawVertVtxBuffer
 
ImDrawListFlags Flags
 
unsigned int _VtxCurrentIdx
 
const ImDrawListSharedData_Data
 
const char * _OwnerName
 
ImDrawVert_VtxWritePtr
 
ImDrawIdx_IdxWritePtr
 
ImVector< ImVec4_ClipRectStack
 
ImVector< ImTextureID_TextureIdStack
 
ImVector< ImVec2_Path
 
ImDrawCmdHeader _CmdHeader
 
ImDrawListSplitter _Splitter
 
float _FringeScale
 

Detailed Description

Constructor & Destructor Documentation

◆ ImDrawList()

ImDrawList::ImDrawList ( const ImDrawListSharedData shared_data)
inline
2369{ memset(this, 0, sizeof(*this)); _Data = shared_data; }
const ImDrawListSharedData * _Data
Definition imgui.h:2357

◆ ~ImDrawList()

ImDrawList::~ImDrawList ( )
inline
2371{ _ClearFreeMemory(); }
IMGUI_API void _ClearFreeMemory()
Definition imgui_draw.cpp:428

Member Function Documentation

◆ _CalcCircleAutoSegmentCount()

int ImDrawList::_CalcCircleAutoSegmentCount ( float  radius) const
558{
559 // Automatic segment count
560 const int radius_idx = (int)(radius + 0.999999f); // ceil to never reduce accuracy
561 if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))
562 return _Data->CircleSegmentCounts[radius_idx]; // Use cached value
563 else
565}
#define IM_ARRAYSIZE(_ARR)
Definition imgui.h:83
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR)
Definition imgui_internal.h:670
float CircleSegmentMaxError
Definition imgui_internal.h:690
ImU8 CircleSegmentCounts[64]
Definition imgui_internal.h:697

References _Data, ImDrawListSharedData::CircleSegmentCounts, ImDrawListSharedData::CircleSegmentMaxError, IM_ARRAYSIZE, and IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC.

Referenced by _PathArcToFastEx(), AddCircle(), AddCircleFilled(), PathArcTo(), and ImGui::ShowStyleEditor().

+ Here is the caller graph for this function:

◆ _ClearFreeMemory()

void ImDrawList::_ClearFreeMemory ( )
429{
434 _VtxCurrentIdx = 0;
435 _VtxWritePtr = NULL;
436 _IdxWritePtr = NULL;
439 _Path.clear();
441}
@ ImDrawListFlags_None
Definition imgui.h:2331
unsigned int _VtxCurrentIdx
Definition imgui.h:2356
ImDrawListSplitter _Splitter
Definition imgui.h:2365
ImVector< ImVec2 > _Path
Definition imgui.h:2363
ImVector< ImDrawCmd > CmdBuffer
Definition imgui.h:2350
ImDrawVert * _VtxWritePtr
Definition imgui.h:2359
ImDrawIdx * _IdxWritePtr
Definition imgui.h:2360
ImVector< ImTextureID > _TextureIdStack
Definition imgui.h:2362
ImVector< ImDrawVert > VtxBuffer
Definition imgui.h:2352
ImDrawListFlags Flags
Definition imgui.h:2353
ImVector< ImDrawIdx > IdxBuffer
Definition imgui.h:2351
ImVector< ImVec4 > _ClipRectStack
Definition imgui.h:2361
IMGUI_API void ClearFreeMemory()
Definition imgui_draw.cpp:1663
void clear()
Definition imgui.h:1678

References _ClipRectStack, _IdxWritePtr, _Path, _Splitter, _TextureIdStack, _VtxCurrentIdx, _VtxWritePtr, ImVector< T >::clear(), ImDrawListSplitter::ClearFreeMemory(), CmdBuffer, Flags, IdxBuffer, ImDrawListFlags_None, and VtxBuffer.

Referenced by ImGui::GcCompactTransientWindowBuffers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _OnChangedClipRect()

void ImDrawList::_OnChangedClipRect ( )
499{
500 // If current command is used with different settings we need to add a new command
501 ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
502 if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0)
503 {
504 AddDrawCmd();
505 return;
506 }
507 IM_ASSERT(curr_cmd->UserCallback == NULL);
508
509 // Try to merge with previous command if it matches, else use current command
510 ImDrawCmd* prev_cmd = curr_cmd - 1;
511 if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && prev_cmd->UserCallback == NULL)
512 {
514 return;
515 }
516
517 curr_cmd->ClipRect = _CmdHeader.ClipRect;
518}
ImVec4 ClipRect
Definition imgui.h:2277
#define IM_ASSERT(_EXPR)
Definition imgui.h:81
#define ImDrawCmd_HeaderCompare(CMD_LHS, CMD_RHS)
Definition imgui_draw.cpp:493
Definition imgui.h:2236
ImVec4 ClipRect
Definition imgui.h:2237
unsigned int ElemCount
Definition imgui.h:2241
ImDrawCallback UserCallback
Definition imgui.h:2242
IMGUI_API void AddDrawCmd()
Definition imgui_draw.cpp:453
ImDrawCmdHeader _CmdHeader
Definition imgui.h:2364
Definition imgui.h:258
void pop_back()
Definition imgui.h:1697
int Size
Definition imgui.h:1655
T * Data
Definition imgui.h:1657

References _CmdHeader, AddDrawCmd(), ImDrawCmd::ClipRect, ImDrawCmdHeader::ClipRect, CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, IM_ASSERT, ImDrawCmd_HeaderCompare, ImVector< T >::pop_back(), ImVector< T >::Size, and ImDrawCmd::UserCallback.

Referenced by PopClipRect(), and PushClipRect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _OnChangedTextureID()

void ImDrawList::_OnChangedTextureID ( )
521{
522 // If current command is used with different settings we need to add a new command
523 ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
524 if (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != _CmdHeader.TextureId)
525 {
526 AddDrawCmd();
527 return;
528 }
529 IM_ASSERT(curr_cmd->UserCallback == NULL);
530
531 // Try to merge with previous command if it matches, else use current command
532 ImDrawCmd* prev_cmd = curr_cmd - 1;
533 if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && prev_cmd->UserCallback == NULL)
534 {
536 return;
537 }
538
539 curr_cmd->TextureId = _CmdHeader.TextureId;
540}
ImTextureID TextureId
Definition imgui.h:2278
ImTextureID TextureId
Definition imgui.h:2238

References _CmdHeader, AddDrawCmd(), CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, IM_ASSERT, ImDrawCmd_HeaderCompare, ImVector< T >::pop_back(), ImVector< T >::Size, ImDrawCmd::TextureId, ImDrawCmdHeader::TextureId, and ImDrawCmd::UserCallback.

Referenced by PopTextureID(), and PushTextureID().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _OnChangedVtxOffset()

void ImDrawList::_OnChangedVtxOffset ( )
543{
544 // We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.
545 _VtxCurrentIdx = 0;
546 ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
547 //IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349
548 if (curr_cmd->ElemCount != 0)
549 {
550 AddDrawCmd();
551 return;
552 }
553 IM_ASSERT(curr_cmd->UserCallback == NULL);
554 curr_cmd->VtxOffset = _CmdHeader.VtxOffset;
555}
unsigned int VtxOffset
Definition imgui.h:2279
unsigned int VtxOffset
Definition imgui.h:2239

References _CmdHeader, _VtxCurrentIdx, AddDrawCmd(), CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, IM_ASSERT, ImVector< T >::Size, ImDrawCmd::UserCallback, ImDrawCmd::VtxOffset, and ImDrawCmdHeader::VtxOffset.

Referenced by PrimReserve().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _PathArcToFastEx()

void ImDrawList::_PathArcToFastEx ( const ImVec2 center,
float  radius,
int  a_min_sample,
int  a_max_sample,
int  a_step 
)
1043{
1044 if (radius <= 0.0f)
1045 {
1046 _Path.push_back(center);
1047 return;
1048 }
1049
1050 // Calculate arc auto segment step size
1051 if (a_step <= 0)
1053
1054 // Make sure we never do steps larger than one quarter of the circle
1055 a_step = ImClamp(a_step, 1, IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4);
1056
1057 const int sample_range = ImAbs(a_max_sample - a_min_sample);
1058 const int a_next_step = a_step;
1059
1060 int samples = sample_range + 1;
1061 bool extra_max_sample = false;
1062 if (a_step > 1)
1063 {
1064 samples = sample_range / a_step + 1;
1065 const int overstep = sample_range % a_step;
1066
1067 if (overstep > 0)
1068 {
1069 extra_max_sample = true;
1070 samples++;
1071
1072 // When we have overstep to avoid awkwardly looking one long line and one tiny one at the end,
1073 // distribute first step range evenly between them by reducing first step size.
1074 if (sample_range > 0)
1075 a_step -= (a_step - overstep) / 2;
1076 }
1077 }
1078
1079 _Path.resize(_Path.Size + samples);
1080 ImVec2* out_ptr = _Path.Data + (_Path.Size - samples);
1081
1082 int sample_index = a_min_sample;
1083 if (sample_index < 0 || sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX)
1084 {
1085 sample_index = sample_index % IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1086 if (sample_index < 0)
1087 sample_index += IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1088 }
1089
1090 if (a_max_sample >= a_min_sample)
1091 {
1092 for (int a = a_min_sample; a <= a_max_sample; a += a_step, sample_index += a_step, a_step = a_next_step)
1093 {
1094 // a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more
1095 if (sample_index >= IM_DRAWLIST_ARCFAST_SAMPLE_MAX)
1096 sample_index -= IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1097
1098 const ImVec2 s = _Data->ArcFastVtx[sample_index];
1099 out_ptr->x = center.x + s.x * radius;
1100 out_ptr->y = center.y + s.y * radius;
1101 out_ptr++;
1102 }
1103 }
1104 else
1105 {
1106 for (int a = a_min_sample; a >= a_max_sample; a -= a_step, sample_index -= a_step, a_step = a_next_step)
1107 {
1108 // a_step is clamped to IM_DRAWLIST_ARCFAST_SAMPLE_MAX, so we have guaranteed that it will not wrap over range twice or more
1109 if (sample_index < 0)
1110 sample_index += IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1111
1112 const ImVec2 s = _Data->ArcFastVtx[sample_index];
1113 out_ptr->x = center.x + s.x * radius;
1114 out_ptr->y = center.y + s.y * radius;
1115 out_ptr++;
1116 }
1117 }
1118
1119 if (extra_max_sample)
1120 {
1121 int normalized_max_sample = a_max_sample % IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1122 if (normalized_max_sample < 0)
1123 normalized_max_sample += IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1124
1125 const ImVec2 s = _Data->ArcFastVtx[normalized_max_sample];
1126 out_ptr->x = center.x + s.x * radius;
1127 out_ptr->y = center.y + s.y * radius;
1128 out_ptr++;
1129 }
1130
1131 IM_ASSERT_PARANOID(_Path.Data + _Path.Size == out_ptr);
1132}
static T ImClamp(T v, T mn, T mx)
Definition imgui_internal.h:411
#define IM_ASSERT_PARANOID(_EXPR)
Definition imgui_internal.h:212
static int ImAbs(int x)
Definition imgui_internal.h:395
#define IM_DRAWLIST_ARCFAST_TABLE_SIZE
Definition imgui_internal.h:678
#define IM_DRAWLIST_ARCFAST_SAMPLE_MAX
Definition imgui_internal.h:680
IMGUI_API int _CalcCircleAutoSegmentCount(float radius) const
Definition imgui_draw.cpp:557
ImVec2 ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE]
Definition imgui_internal.h:695
Definition imgui.h:245
float y
Definition imgui.h:246
float x
Definition imgui.h:246
void push_back(const T &v)
Definition imgui.h:1696
void resize(int new_size)
Definition imgui.h:1690

References _CalcCircleAutoSegmentCount(), _Data, _Path, ImDrawListSharedData::ArcFastVtx, ImVector< T >::Data, IM_ASSERT_PARANOID, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, IM_DRAWLIST_ARCFAST_TABLE_SIZE, ImAbs(), ImClamp(), ImVector< T >::push_back(), ImVector< T >::resize(), ImVector< T >::Size, ImVec2::x, and ImVec2::y.

Referenced by PathArcTo(), and PathArcToFast().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _PathArcToN()

void ImDrawList::_PathArcToN ( const ImVec2 center,
float  radius,
float  a_min,
float  a_max,
int  num_segments 
)
1135{
1136 if (radius <= 0.0f)
1137 {
1138 _Path.push_back(center);
1139 return;
1140 }
1141
1142 // Note that we are adding a point at both a_min and a_max.
1143 // If you are trying to draw a full closed circle you don't want the overlapping points!
1144 _Path.reserve(_Path.Size + (num_segments + 1));
1145 for (int i = 0; i <= num_segments; i++)
1146 {
1147 const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min);
1148 _Path.push_back(ImVec2(center.x + ImCos(a) * radius, center.y + ImSin(a) * radius));
1149 }
1150}
#define ImCos(X)
Definition imgui_internal.h:384
#define ImSin(X)
Definition imgui_internal.h:385
void reserve(int new_capacity)
Definition imgui.h:1693

References _Path, ImCos, ImSin, ImVector< T >::push_back(), ImVector< T >::reserve(), ImVector< T >::Size, ImVec2::x, and ImVec2::y.

Referenced by PathArcTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _PopUnusedDrawCmd()

void ImDrawList::_PopUnusedDrawCmd ( )
468{
469 if (CmdBuffer.Size == 0)
470 return;
471 ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
472 if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL)
474}

References CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, ImVector< T >::pop_back(), ImVector< T >::Size, and ImDrawCmd::UserCallback.

Referenced by AddDrawListToDrawData(), and ImDrawListSplitter::Merge().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ResetForNewFrame()

void ImDrawList::_ResetForNewFrame ( )
405{
406 // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory.
407 // (those should be IM_STATIC_ASSERT() in theory but with our pre C++11 setup the whole check doesn't compile with GCC)
408 IM_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0);
409 IM_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4));
410 IM_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID));
411
412 CmdBuffer.resize(0);
413 IdxBuffer.resize(0);
414 VtxBuffer.resize(0);
416 memset(&_CmdHeader, 0, sizeof(_CmdHeader));
417 _VtxCurrentIdx = 0;
418 _VtxWritePtr = NULL;
419 _IdxWritePtr = NULL;
422 _Path.resize(0);
425 _FringeScale = 1.0f;
426}
#define IM_OFFSETOF(_TYPE, _MEMBER)
Definition imgui.h:88
void * ImTextureID
Definition imgui.h:205
float _FringeScale
Definition imgui.h:2366
ImDrawListFlags InitialFlags
Definition imgui_internal.h:692
void Clear()
Definition imgui.h:2300

References _ClipRectStack, _CmdHeader, _Data, _FringeScale, _IdxWritePtr, _Path, _Splitter, _TextureIdStack, _VtxCurrentIdx, _VtxWritePtr, ImDrawListSplitter::Clear(), CmdBuffer, Flags, IdxBuffer, IM_ASSERT, IM_OFFSETOF, ImDrawListSharedData::InitialFlags, ImVector< T >::push_back(), ImVector< T >::resize(), and VtxBuffer.

Referenced by ImGui::Begin(), and GetViewportDrawList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddBezierCubic()

void ImDrawList::AddBezierCubic ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
ImU32  col,
float  thickness,
int  num_segments = 0 
)
1544{
1545 if ((col & IM_COL32_A_MASK) == 0)
1546 return;
1547
1548 PathLineTo(p1);
1549 PathBezierCubicCurveTo(p2, p3, p4, num_segments);
1550 PathStroke(col, 0, thickness);
1551}
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
Definition BlockMethods.h:838
#define IM_COL32_A_MASK
Definition imgui.h:2175
IMGUI_API void PathBezierCubicCurveTo(const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, int num_segments=0)
Definition imgui_draw.cpp:1276
void PathStroke(ImU32 col, ImDrawFlags flags=0, float thickness=1.0f)
Definition imgui.h:2418
void PathLineTo(const ImVec2 &pos)
Definition imgui.h:2415

References col(), IM_COL32_A_MASK, PathBezierCubicCurveTo(), PathLineTo(), and PathStroke().

Referenced by ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddBezierCurve()

void ImDrawList::AddBezierCurve ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
ImU32  col,
float  thickness,
int  num_segments = 0 
)
inline
2453{ AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); }
IMGUI_API void AddBezierCubic(const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, ImU32 col, float thickness, int num_segments=0)
Definition imgui_draw.cpp:1543

References col().

+ Here is the call graph for this function:

◆ AddBezierQuadratic()

void ImDrawList::AddBezierQuadratic ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
ImU32  col,
float  thickness,
int  num_segments = 0 
)
1555{
1556 if ((col & IM_COL32_A_MASK) == 0)
1557 return;
1558
1559 PathLineTo(p1);
1560 PathBezierQuadraticCurveTo(p2, p3, num_segments);
1561 PathStroke(col, 0, thickness);
1562}
IMGUI_API void PathBezierQuadraticCurveTo(const ImVec2 &p2, const ImVec2 &p3, int num_segments=0)
Definition imgui_draw.cpp:1291

References col(), IM_COL32_A_MASK, PathBezierQuadraticCurveTo(), PathLineTo(), and PathStroke().

Referenced by ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddCallback()

void ImDrawList::AddCallback ( ImDrawCallback  callback,
void callback_data 
)
477{
478 ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
479 IM_ASSERT(curr_cmd->UserCallback == NULL);
480 if (curr_cmd->ElemCount != 0)
481 {
482 AddDrawCmd();
483 curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
484 }
485 curr_cmd->UserCallback = callback;
486 curr_cmd->UserCallbackData = callback_data;
487
488 AddDrawCmd(); // Force a new command after us (see comment below)
489}
void * UserCallbackData
Definition imgui.h:2243

References AddDrawCmd(), CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, IM_ASSERT, ImVector< T >::Size, ImDrawCmd::UserCallback, and ImDrawCmd::UserCallbackData.

+ Here is the call graph for this function:

◆ AddCircle()

void ImDrawList::AddCircle ( const ImVec2 center,
float  radius,
ImU32  col,
int  num_segments = 0,
float  thickness = 1.0f 
)
1467{
1468 if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)
1469 return;
1470
1471 // Obtain segment count
1472 if (num_segments <= 0)
1473 {
1474 // Automatic segment count
1475 num_segments = _CalcCircleAutoSegmentCount(radius);
1476 }
1477 else
1478 {
1479 // Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
1480 num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
1481 }
1482
1483 // Because we are filling a closed shape we remove 1 from the count of segments/points
1484 const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
1485 if (num_segments == 12)
1486 PathArcToFast(center, radius - 0.5f, 0, 12 - 1);
1487 else
1488 PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
1489 PathStroke(col, ImDrawFlags_Closed, thickness);
1490}
@ ImDrawFlags_Closed
Definition imgui.h:2312
#define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX
Definition imgui_internal.h:669
#define IM_PI
Definition imgui_internal.h:222
IMGUI_API void PathArcToFast(const ImVec2 &center, float radius, int a_min_of_12, int a_max_of_12)
Definition imgui_draw.cpp:1153
IMGUI_API void PathArcTo(const ImVec2 &center, float radius, float a_min, float a_max, int num_segments=0)
Definition imgui_draw.cpp:1163

References _CalcCircleAutoSegmentCount(), col(), IM_COL32_A_MASK, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX, IM_PI, ImClamp(), ImDrawFlags_Closed, PathArcTo(), PathArcToFast(), and PathStroke().

Referenced by ImGui::ColorPicker4(), ImGui::RadioButton(), ShowExampleAppCustomRendering(), and ImGui::ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddCircleFilled()

void ImDrawList::AddCircleFilled ( const ImVec2 center,
float  radius,
ImU32  col,
int  num_segments = 0 
)
1493{
1494 if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)
1495 return;
1496
1497 // Obtain segment count
1498 if (num_segments <= 0)
1499 {
1500 // Automatic segment count
1501 num_segments = _CalcCircleAutoSegmentCount(radius);
1502 }
1503 else
1504 {
1505 // Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
1506 num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
1507 }
1508
1509 // Because we are filling a closed shape we remove 1 from the count of segments/points
1510 const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
1511 if (num_segments == 12)
1512 PathArcToFast(center, radius, 0, 12 - 1);
1513 else
1514 PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);
1516}
void PathFillConvex(ImU32 col)
Definition imgui.h:2417

References _CalcCircleAutoSegmentCount(), col(), IM_COL32_A_MASK, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX, IM_PI, ImClamp(), PathArcTo(), PathArcToFast(), and PathFillConvex().

Referenced by ImGui::CloseButton(), ImGui::CollapseButton(), ImGui::ColorPicker4(), ImGui::NavUpdate(), ImGui::RadioButton(), Slic3r::GUI::GCodeViewer::render_legend(), ImGui::RenderBullet(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddConvexPolyFilled()

void ImDrawList::AddConvexPolyFilled ( const ImVec2 points,
int  num_points,
ImU32  col 
)
962{
963 if (points_count < 3)
964 return;
965
966 const ImVec2 uv = _Data->TexUvWhitePixel;
967
969 {
970 // Anti-aliased Fill
971 const float AA_SIZE = _FringeScale;
972 const ImU32 col_trans = col & ~IM_COL32_A_MASK;
973 const int idx_count = (points_count - 2)*3 + points_count * 6;
974 const int vtx_count = (points_count * 2);
975 PrimReserve(idx_count, vtx_count);
976
977 // Add indexes for fill
978 unsigned int vtx_inner_idx = _VtxCurrentIdx;
979 unsigned int vtx_outer_idx = _VtxCurrentIdx + 1;
980 for (int i = 2; i < points_count; i++)
981 {
982 _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + ((i - 1) << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_inner_idx + (i << 1));
983 _IdxWritePtr += 3;
984 }
985
986 // Compute normals
987 ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630
988 for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
989 {
990 const ImVec2& p0 = points[i0];
991 const ImVec2& p1 = points[i1];
992 float dx = p1.x - p0.x;
993 float dy = p1.y - p0.y;
995 temp_normals[i0].x = dy;
996 temp_normals[i0].y = -dx;
997 }
998
999 for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
1000 {
1001 // Average normals
1002 const ImVec2& n0 = temp_normals[i0];
1003 const ImVec2& n1 = temp_normals[i1];
1004 float dm_x = (n0.x + n1.x) * 0.5f;
1005 float dm_y = (n0.y + n1.y) * 0.5f;
1006 IM_FIXNORMAL2F(dm_x, dm_y);
1007 dm_x *= AA_SIZE * 0.5f;
1008 dm_y *= AA_SIZE * 0.5f;
1009
1010 // Add vertices
1011 _VtxWritePtr[0].pos.x = (points[i1].x - dm_x); _VtxWritePtr[0].pos.y = (points[i1].y - dm_y); _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; // Inner
1012 _VtxWritePtr[1].pos.x = (points[i1].x + dm_x); _VtxWritePtr[1].pos.y = (points[i1].y + dm_y); _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans; // Outer
1013 _VtxWritePtr += 2;
1014
1015 // Add indexes for fringes
1016 _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (i0 << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1));
1017 _IdxWritePtr[3] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); _IdxWritePtr[4] = (ImDrawIdx)(vtx_outer_idx + (i1 << 1)); _IdxWritePtr[5] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1));
1018 _IdxWritePtr += 6;
1019 }
1020 _VtxCurrentIdx += (ImDrawIdx)vtx_count;
1021 }
1022 else
1023 {
1024 // Non Anti-aliased Fill
1025 const int idx_count = (points_count - 2)*3;
1026 const int vtx_count = points_count;
1027 PrimReserve(idx_count, vtx_count);
1028 for (int i = 0; i < vtx_count; i++)
1029 {
1030 _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;
1031 _VtxWritePtr++;
1032 }
1033 for (int i = 2; i < points_count; i++)
1034 {
1036 _IdxWritePtr += 3;
1037 }
1038 _VtxCurrentIdx += (ImDrawIdx)vtx_count;
1039 }
1040}
unsigned int ImU32
Definition imgui.h:229
@ ImDrawListFlags_AntiAliasedFill
Definition imgui.h:2334
ImU32 col
Definition imgui.h:2264
ImVec2 uv
Definition imgui.h:2263
ImVec2 pos
Definition imgui.h:2262
unsigned short ImDrawIdx
Definition imgui.h:2255
#define IM_FIXNORMAL2F(VX, VY)
Definition imgui_draw.cpp:701
#define IM_NORMALIZE2F_OVER_ZERO(VX, VY)
Definition imgui_draw.cpp:699
IMGUI_API void PrimReserve(int idx_count, int vtx_count)
Definition imgui_draw.cpp:616
ImVec2 TexUvWhitePixel
Definition imgui_internal.h:686

References _Data, _FringeScale, _IdxWritePtr, _VtxCurrentIdx, _VtxWritePtr, col(), ImDrawVert::col, Flags, IM_FIXNORMAL2F, IM_NORMALIZE2F_OVER_ZERO, ImDrawListFlags_AntiAliasedFill, ImDrawVert::pos, PrimReserve(), ImDrawListSharedData::TexUvWhitePixel, ImDrawVert::uv, ImVec2::x, and ImVec2::y.

+ Here is the call graph for this function:

◆ AddDrawCmd()

void ImDrawList::AddDrawCmd ( )
454{
455 ImDrawCmd draw_cmd;
456 draw_cmd.ClipRect = _CmdHeader.ClipRect; // Same as calling ImDrawCmd_HeaderCopy()
457 draw_cmd.TextureId = _CmdHeader.TextureId;
458 draw_cmd.VtxOffset = _CmdHeader.VtxOffset;
459 draw_cmd.IdxOffset = IdxBuffer.Size;
460
461 IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w);
462 CmdBuffer.push_back(draw_cmd);
463}
unsigned int IdxOffset
Definition imgui.h:2240
float x
Definition imgui.h:259
float y
Definition imgui.h:259
float z
Definition imgui.h:259
float w
Definition imgui.h:259

References _CmdHeader, ImDrawCmd::ClipRect, ImDrawCmdHeader::ClipRect, CmdBuffer, IdxBuffer, ImDrawCmd::IdxOffset, IM_ASSERT, ImVector< T >::push_back(), ImVector< T >::Size, ImDrawCmd::TextureId, ImDrawCmdHeader::TextureId, ImDrawCmd::VtxOffset, ImDrawCmdHeader::VtxOffset, ImVec4::w, ImVec4::x, ImVec4::y, and ImVec4::z.

Referenced by _OnChangedClipRect(), _OnChangedTextureID(), _OnChangedVtxOffset(), AddCallback(), ImDrawListSplitter::Merge(), and ImDrawListSplitter::SetCurrentChannel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddImage()

void ImDrawList::AddImage ( ImTextureID  user_texture_id,
const ImVec2 p_min,
const ImVec2 p_max,
const ImVec2 uv_min = ImVec2(0, 0),
const ImVec2 uv_max = ImVec2(1, 1),
ImU32  col = IM_COL32_WHITE 
)
1599{
1600 if ((col & IM_COL32_A_MASK) == 0)
1601 return;
1602
1603 const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;
1604 if (push_texture_id)
1605 PushTextureID(user_texture_id);
1606
1607 PrimReserve(6, 4);
1608 PrimRectUV(p_min, p_max, uv_min, uv_max, col);
1609
1610 if (push_texture_id)
1611 PopTextureID();
1612}
IMGUI_API void PrimRectUV(const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a, const ImVec2 &uv_b, ImU32 col)
Definition imgui_draw.cpp:668
IMGUI_API void PushTextureID(ImTextureID texture_id)
Definition imgui_draw.cpp:599
IMGUI_API void PopTextureID()
Definition imgui_draw.cpp:606

References _CmdHeader, col(), IM_COL32_A_MASK, PopTextureID(), PrimRectUV(), PrimReserve(), PushTextureID(), and ImDrawCmdHeader::TextureId.

Referenced by AddImageRounded(), Slic3r::GUI::ImGuiWrapper::draw_icon(), ImGui::Image(), Slic3r::GUI::image_button_ex(), ImGui::ImageButtonEx(), and ImGui::RenderMouseCursor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddImageQuad()

void ImDrawList::AddImageQuad ( ImTextureID  user_texture_id,
const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
const ImVec2 uv1 = ImVec2(0, 0),
const ImVec2 uv2 = ImVec2(1, 0),
const ImVec2 uv3 = ImVec2(1, 1),
const ImVec2 uv4 = ImVec2(0, 1),
ImU32  col = IM_COL32_WHITE 
)
1615{
1616 if ((col & IM_COL32_A_MASK) == 0)
1617 return;
1618
1619 const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;
1620 if (push_texture_id)
1621 PushTextureID(user_texture_id);
1622
1623 PrimReserve(6, 4);
1624 PrimQuadUV(p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
1625
1626 if (push_texture_id)
1627 PopTextureID();
1628}
IMGUI_API void PrimQuadUV(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &d, const ImVec2 &uv_a, const ImVec2 &uv_b, const ImVec2 &uv_c, const ImVec2 &uv_d, ImU32 col)
Definition imgui_draw.cpp:683

References _CmdHeader, col(), IM_COL32_A_MASK, PopTextureID(), PrimQuadUV(), PrimReserve(), PushTextureID(), and ImDrawCmdHeader::TextureId.

+ Here is the call graph for this function:

◆ AddImageRounded()

void ImDrawList::AddImageRounded ( ImTextureID  user_texture_id,
const ImVec2 p_min,
const ImVec2 p_max,
const ImVec2 uv_min,
const ImVec2 uv_max,
ImU32  col,
float  rounding,
ImDrawFlags  flags = 0 
)
1631{
1632 if ((col & IM_COL32_A_MASK) == 0)
1633 return;
1634
1635 flags = FixRectCornerFlags(flags);
1636 if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
1637 {
1638 AddImage(user_texture_id, p_min, p_max, uv_min, uv_max, col);
1639 return;
1640 }
1641
1642 const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;
1643 if (push_texture_id)
1644 PushTextureID(user_texture_id);
1645
1646 int vert_start_idx = VtxBuffer.Size;
1647 PathRect(p_min, p_max, rounding, flags);
1649 int vert_end_idx = VtxBuffer.Size;
1650 ImGui::ShadeVertsLinearUV(this, vert_start_idx, vert_end_idx, p_min, p_max, uv_min, uv_max, true);
1651
1652 if (push_texture_id)
1653 PopTextureID();
1654}
@ ImDrawFlags_RoundCornersNone
Definition imgui.h:2317
@ ImDrawFlags_RoundCornersMask_
Definition imgui.h:2324
static ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)
Definition imgui_draw.cpp:1307
IMGUI_API void ShadeVertsLinearUV(ImDrawList *draw_list, int vert_start_idx, int vert_end_idx, const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a, const ImVec2 &uv_b, bool clamp)
Definition imgui_draw.cpp:1870
IMGUI_API void PathRect(const ImVec2 &rect_min, const ImVec2 &rect_max, float rounding=0.0f, ImDrawFlags flags=0)
Definition imgui_draw.cpp:1340
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2 &p_min, const ImVec2 &p_max, const ImVec2 &uv_min=ImVec2(0, 0), const ImVec2 &uv_max=ImVec2(1, 1), ImU32 col=IM_COL32_WHITE)
Definition imgui_draw.cpp:1598

References _CmdHeader, AddImage(), col(), FixRectCornerFlags(), IM_COL32_A_MASK, ImDrawFlags_RoundCornersMask_, ImDrawFlags_RoundCornersNone, PathFillConvex(), PathRect(), PopTextureID(), PushTextureID(), ImGui::ShadeVertsLinearUV(), ImVector< T >::Size, ImDrawCmdHeader::TextureId, and VtxBuffer.

+ Here is the call graph for this function:

◆ AddLine()

void ImDrawList::AddLine ( const ImVec2 p1,
const ImVec2 p2,
ImU32  col,
float  thickness = 1.0f 
)
1367{
1368 if ((col & IM_COL32_A_MASK) == 0)
1369 return;
1370 PathLineTo(p1 + ImVec2(0.5f, 0.5f));
1371 PathLineTo(p2 + ImVec2(0.5f, 0.5f));
1372 PathStroke(col, 0, thickness);
1373}

References col(), IM_COL32_A_MASK, PathLineTo(), and PathStroke().

Referenced by ImGui::BeginTabBarEx(), ImGui::CloseButton(), ImGui::DebugNodeTabBar(), Slic3r::GUI::ImGuiWrapper::draw(), ImGui::EndColumns(), ImGui::InputTextEx(), ImGui::PlotEx(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_bar(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::GCodeViewer::render_legend(), ImGui::RenderWindowDecorations(), ImGui::RenderWindowOuterBorders(), ImGui::SeparatorEx(), ShowDemoWindowMisc(), ShowExampleAppCustomRendering(), ImGui::TableDrawBorders(), and ImGui::TableEndRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddNgon()

void ImDrawList::AddNgon ( const ImVec2 center,
float  radius,
ImU32  col,
int  num_segments,
float  thickness = 1.0f 
)
1520{
1521 if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
1522 return;
1523
1524 // Because we are filling a closed shape we remove 1 from the count of segments/points
1525 const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
1526 PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
1527 PathStroke(col, ImDrawFlags_Closed, thickness);
1528}

References col(), IM_COL32_A_MASK, IM_PI, ImDrawFlags_Closed, PathArcTo(), and PathStroke().

Referenced by ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddNgonFilled()

void ImDrawList::AddNgonFilled ( const ImVec2 center,
float  radius,
ImU32  col,
int  num_segments 
)
1532{
1533 if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
1534 return;
1535
1536 // Because we are filling a closed shape we remove 1 from the count of segments/points
1537 const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
1538 PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);
1540}

References col(), IM_COL32_A_MASK, IM_PI, PathArcTo(), and PathFillConvex().

Referenced by Slic3r::GUI::GLGizmoCut3D::render_color_marker(), Slic3r::GUI::GCodeViewer::render_legend(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddPolyline()

void ImDrawList::AddPolyline ( const ImVec2 points,
int  num_points,
ImU32  col,
ImDrawFlags  flags,
float  thickness 
)
706{
707 if (points_count < 2)
708 return;
709
710 const bool closed = (flags & ImDrawFlags_Closed) != 0;
711 const ImVec2 opaque_uv = _Data->TexUvWhitePixel;
712 const int count = closed ? points_count : points_count - 1; // The number of line segments we need to draw
713 const bool thick_line = (thickness > _FringeScale);
714
716 {
717 // Anti-aliased stroke
718 const float AA_SIZE = _FringeScale;
719 const ImU32 col_trans = col & ~IM_COL32_A_MASK;
720
721 // Thicknesses <1.0 should behave like thickness 1.0
722 thickness = ImMax(thickness, 1.0f);
723 const int integer_thickness = (int)thickness;
724 const float fractional_thickness = thickness - integer_thickness;
725
726 // Do we want to draw this line using a texture?
727 // - For now, only draw integer-width lines using textures to avoid issues with the way scaling occurs, could be improved.
728 // - If AA_SIZE is not 1.0f we cannot use the texture path.
729 const bool use_texture = (Flags & ImDrawListFlags_AntiAliasedLinesUseTex) && (integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX) && (fractional_thickness <= 0.00001f) && (AA_SIZE == 1.0f);
730
731 // We should never hit this, because NewFrame() doesn't set ImDrawListFlags_AntiAliasedLinesUseTex unless ImFontAtlasFlags_NoBakedLines is off
733
734 const int idx_count = use_texture ? (count * 6) : (thick_line ? count * 18 : count * 12);
735 const int vtx_count = use_texture ? (points_count * 2) : (thick_line ? points_count * 4 : points_count * 3);
736 PrimReserve(idx_count, vtx_count);
737
738 // Temporary buffer
739 // The first <points_count> items are normals at each line point, then after that there are either 2 or 4 temp points for each line point
740 ImVec2* temp_normals = (ImVec2*)alloca(points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)); //-V630
741 ImVec2* temp_points = temp_normals + points_count;
742
743 // Calculate normals (tangents) for each line segment
744 for (int i1 = 0; i1 < count; i1++)
745 {
746 const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;
747 float dx = points[i2].x - points[i1].x;
748 float dy = points[i2].y - points[i1].y;
750 temp_normals[i1].x = dy;
751 temp_normals[i1].y = -dx;
752 }
753 if (!closed)
754 temp_normals[points_count - 1] = temp_normals[points_count - 2];
755
756 // If we are drawing a one-pixel-wide line without a texture, or a textured line of any width, we only need 2 or 3 vertices per point
757 if (use_texture || !thick_line)
758 {
759 // [PATH 1] Texture-based lines (thick or non-thick)
760 // [PATH 2] Non texture-based lines (non-thick)
761
762 // The width of the geometry we need to draw - this is essentially <thickness> pixels for the line itself, plus "one pixel" for AA.
763 // - In the texture-based path, we don't use AA_SIZE here because the +1 is tied to the generated texture
764 // (see ImFontAtlasBuildRenderLinesTexData() function), and so alternate values won't work without changes to that code.
765 // - In the non texture-based paths, we would allow AA_SIZE to potentially be != 1.0f with a patch (e.g. fringe_scale patch to
766 // allow scaling geometry while preserving one-screen-pixel AA fringe).
767 const float half_draw_size = use_texture ? ((thickness * 0.5f) + 1) : AA_SIZE;
768
769 // If line is not closed, the first and last points need to be generated differently as there are no normals to blend
770 if (!closed)
771 {
772 temp_points[0] = points[0] + temp_normals[0] * half_draw_size;
773 temp_points[1] = points[0] - temp_normals[0] * half_draw_size;
774 temp_points[(points_count-1)*2+0] = points[points_count-1] + temp_normals[points_count-1] * half_draw_size;
775 temp_points[(points_count-1)*2+1] = points[points_count-1] - temp_normals[points_count-1] * half_draw_size;
776 }
777
778 // Generate the indices to form a number of triangles for each line segment, and the vertices for the line edges
779 // This takes points n and n+1 and writes into n+1, with the first point in a closed line being generated from the final one (as n+1 wraps)
780 // FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.
781 unsigned int idx1 = _VtxCurrentIdx; // Vertex index for start of line segment
782 for (int i1 = 0; i1 < count; i1++) // i1 is the first point of the line segment
783 {
784 const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1; // i2 is the second point of the line segment
785 const unsigned int idx2 = ((i1 + 1) == points_count) ? _VtxCurrentIdx : (idx1 + (use_texture ? 2 : 3)); // Vertex index for end of segment
786
787 // Average normals
788 float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;
789 float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;
790 IM_FIXNORMAL2F(dm_x, dm_y);
791 dm_x *= half_draw_size; // dm_x, dm_y are offset to the outer edge of the AA area
792 dm_y *= half_draw_size;
793
794 // Add temporary vertexes for the outer edges
795 ImVec2* out_vtx = &temp_points[i2 * 2];
796 out_vtx[0].x = points[i2].x + dm_x;
797 out_vtx[0].y = points[i2].y + dm_y;
798 out_vtx[1].x = points[i2].x - dm_x;
799 out_vtx[1].y = points[i2].y - dm_y;
800
801 if (use_texture)
802 {
803 // Add indices for two triangles
804 _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 1); // Right tri
805 _IdxWritePtr[3] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[4] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); // Left tri
806 _IdxWritePtr += 6;
807 }
808 else
809 {
810 // Add indexes for four triangles
811 _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2); // Right tri 1
812 _IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); // Right tri 2
813 _IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0); // Left tri 1
814 _IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1); // Left tri 2
815 _IdxWritePtr += 12;
816 }
817
818 idx1 = idx2;
819 }
820
821 // Add vertexes for each point on the line
822 if (use_texture)
823 {
824 // If we're using textures we only need to emit the left/right edge vertices
825 ImVec4 tex_uvs = _Data->TexUvLines[integer_thickness];
826 /*if (fractional_thickness != 0.0f) // Currently always zero when use_texture==false!
827 {
828 const ImVec4 tex_uvs_1 = _Data->TexUvLines[integer_thickness + 1];
829 tex_uvs.x = tex_uvs.x + (tex_uvs_1.x - tex_uvs.x) * fractional_thickness; // inlined ImLerp()
830 tex_uvs.y = tex_uvs.y + (tex_uvs_1.y - tex_uvs.y) * fractional_thickness;
831 tex_uvs.z = tex_uvs.z + (tex_uvs_1.z - tex_uvs.z) * fractional_thickness;
832 tex_uvs.w = tex_uvs.w + (tex_uvs_1.w - tex_uvs.w) * fractional_thickness;
833 }*/
834 ImVec2 tex_uv0(tex_uvs.x, tex_uvs.y);
835 ImVec2 tex_uv1(tex_uvs.z, tex_uvs.w);
836 for (int i = 0; i < points_count; i++)
837 {
838 _VtxWritePtr[0].pos = temp_points[i * 2 + 0]; _VtxWritePtr[0].uv = tex_uv0; _VtxWritePtr[0].col = col; // Left-side outer edge
839 _VtxWritePtr[1].pos = temp_points[i * 2 + 1]; _VtxWritePtr[1].uv = tex_uv1; _VtxWritePtr[1].col = col; // Right-side outer edge
840 _VtxWritePtr += 2;
841 }
842 }
843 else
844 {
845 // If we're not using a texture, we need the center vertex as well
846 for (int i = 0; i < points_count; i++)
847 {
848 _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col; // Center of line
849 _VtxWritePtr[1].pos = temp_points[i * 2 + 0]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col_trans; // Left-side outer edge
850 _VtxWritePtr[2].pos = temp_points[i * 2 + 1]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col_trans; // Right-side outer edge
851 _VtxWritePtr += 3;
852 }
853 }
854 }
855 else
856 {
857 // [PATH 2] Non texture-based lines (thick): we need to draw the solid line core and thus require four vertices per point
858 const float half_inner_thickness = (thickness - AA_SIZE) * 0.5f;
859
860 // If line is not closed, the first and last points need to be generated differently as there are no normals to blend
861 if (!closed)
862 {
863 const int points_last = points_count - 1;
864 temp_points[0] = points[0] + temp_normals[0] * (half_inner_thickness + AA_SIZE);
865 temp_points[1] = points[0] + temp_normals[0] * (half_inner_thickness);
866 temp_points[2] = points[0] - temp_normals[0] * (half_inner_thickness);
867 temp_points[3] = points[0] - temp_normals[0] * (half_inner_thickness + AA_SIZE);
868 temp_points[points_last * 4 + 0] = points[points_last] + temp_normals[points_last] * (half_inner_thickness + AA_SIZE);
869 temp_points[points_last * 4 + 1] = points[points_last] + temp_normals[points_last] * (half_inner_thickness);
870 temp_points[points_last * 4 + 2] = points[points_last] - temp_normals[points_last] * (half_inner_thickness);
871 temp_points[points_last * 4 + 3] = points[points_last] - temp_normals[points_last] * (half_inner_thickness + AA_SIZE);
872 }
873
874 // Generate the indices to form a number of triangles for each line segment, and the vertices for the line edges
875 // This takes points n and n+1 and writes into n+1, with the first point in a closed line being generated from the final one (as n+1 wraps)
876 // FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.
877 unsigned int idx1 = _VtxCurrentIdx; // Vertex index for start of line segment
878 for (int i1 = 0; i1 < count; i1++) // i1 is the first point of the line segment
879 {
880 const int i2 = (i1 + 1) == points_count ? 0 : (i1 + 1); // i2 is the second point of the line segment
881 const unsigned int idx2 = (i1 + 1) == points_count ? _VtxCurrentIdx : (idx1 + 4); // Vertex index for end of segment
882
883 // Average normals
884 float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;
885 float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;
886 IM_FIXNORMAL2F(dm_x, dm_y);
887 float dm_out_x = dm_x * (half_inner_thickness + AA_SIZE);
888 float dm_out_y = dm_y * (half_inner_thickness + AA_SIZE);
889 float dm_in_x = dm_x * half_inner_thickness;
890 float dm_in_y = dm_y * half_inner_thickness;
891
892 // Add temporary vertices
893 ImVec2* out_vtx = &temp_points[i2 * 4];
894 out_vtx[0].x = points[i2].x + dm_out_x;
895 out_vtx[0].y = points[i2].y + dm_out_y;
896 out_vtx[1].x = points[i2].x + dm_in_x;
897 out_vtx[1].y = points[i2].y + dm_in_y;
898 out_vtx[2].x = points[i2].x - dm_in_x;
899 out_vtx[2].y = points[i2].y - dm_in_y;
900 out_vtx[3].x = points[i2].x - dm_out_x;
901 out_vtx[3].y = points[i2].y - dm_out_y;
902
903 // Add indexes
904 _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2);
905 _IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 1);
906 _IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0);
907 _IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1);
908 _IdxWritePtr[12] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[13] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[14] = (ImDrawIdx)(idx1 + 3);
909 _IdxWritePtr[15] = (ImDrawIdx)(idx1 + 3); _IdxWritePtr[16] = (ImDrawIdx)(idx2 + 3); _IdxWritePtr[17] = (ImDrawIdx)(idx2 + 2);
910 _IdxWritePtr += 18;
911
912 idx1 = idx2;
913 }
914
915 // Add vertices
916 for (int i = 0; i < points_count; i++)
917 {
918 _VtxWritePtr[0].pos = temp_points[i * 4 + 0]; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col_trans;
919 _VtxWritePtr[1].pos = temp_points[i * 4 + 1]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col;
920 _VtxWritePtr[2].pos = temp_points[i * 4 + 2]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col;
921 _VtxWritePtr[3].pos = temp_points[i * 4 + 3]; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col_trans;
922 _VtxWritePtr += 4;
923 }
924 }
925 _VtxCurrentIdx += (ImDrawIdx)vtx_count;
926 }
927 else
928 {
929 // [PATH 4] Non texture-based, Non anti-aliased lines
930 const int idx_count = count * 6;
931 const int vtx_count = count * 4; // FIXME-OPT: Not sharing edges
932 PrimReserve(idx_count, vtx_count);
933
934 for (int i1 = 0; i1 < count; i1++)
935 {
936 const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;
937 const ImVec2& p1 = points[i1];
938 const ImVec2& p2 = points[i2];
939
940 float dx = p2.x - p1.x;
941 float dy = p2.y - p1.y;
943 dx *= (thickness * 0.5f);
944 dy *= (thickness * 0.5f);
945
946 _VtxWritePtr[0].pos.x = p1.x + dy; _VtxWritePtr[0].pos.y = p1.y - dx; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col;
947 _VtxWritePtr[1].pos.x = p2.x + dy; _VtxWritePtr[1].pos.y = p2.y - dx; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col;
948 _VtxWritePtr[2].pos.x = p2.x - dy; _VtxWritePtr[2].pos.y = p2.y + dx; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col;
949 _VtxWritePtr[3].pos.x = p1.x - dy; _VtxWritePtr[3].pos.y = p1.y + dx; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col;
950 _VtxWritePtr += 4;
951
954 _IdxWritePtr += 6;
955 _VtxCurrentIdx += 4;
956 }
957 }
958}
@ ImDrawListFlags_AntiAliasedLinesUseTex
Definition imgui.h:2333
@ ImDrawListFlags_AntiAliasedLines
Definition imgui.h:2332
#define IM_DRAWLIST_TEX_LINES_WIDTH_MAX
Definition imgui.h:2210
@ ImFontAtlasFlags_NoBakedLines
Definition imgui.h:2568
static T ImMax(T lhs, T rhs)
Definition imgui_internal.h:410
IGL_INLINE void count(const Eigen::SparseMatrix< XType > &X, const int dim, Eigen::SparseVector< SType > &S)
Definition count.cpp:12
const ImVec4 * TexUvLines
Definition imgui_internal.h:698
ImFont * Font
Definition imgui_internal.h:687
ImFontAtlasFlags Flags
Definition imgui.h:2653
ImFontAtlas * ContainerAtlas
Definition imgui.h:2702

References _Data, _FringeScale, _IdxWritePtr, _VtxCurrentIdx, _VtxWritePtr, col(), ImDrawVert::col, ImFont::ContainerAtlas, Flags, ImFontAtlas::Flags, ImDrawListSharedData::Font, IM_ASSERT_PARANOID, IM_DRAWLIST_TEX_LINES_WIDTH_MAX, IM_FIXNORMAL2F, IM_NORMALIZE2F_OVER_ZERO, ImDrawFlags_Closed, ImDrawListFlags_AntiAliasedLines, ImDrawListFlags_AntiAliasedLinesUseTex, ImFontAtlasFlags_NoBakedLines, ImMax(), ImDrawVert::pos, PrimReserve(), ImDrawListSharedData::TexUvLines, ImDrawListSharedData::TexUvWhitePixel, ImDrawVert::uv, ImVec4::w, ImVec2::x, ImVec4::x, ImVec2::y, ImVec4::y, and ImVec4::z.

Referenced by ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(), and ImGui::DebugNodeDrawList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddQuad()

void ImDrawList::AddQuad ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
ImU32  col,
float  thickness = 1.0f 
)
1421{
1422 if ((col & IM_COL32_A_MASK) == 0)
1423 return;
1424
1425 PathLineTo(p1);
1426 PathLineTo(p2);
1427 PathLineTo(p3);
1428 PathLineTo(p4);
1429 PathStroke(col, ImDrawFlags_Closed, thickness);
1430}

References col(), IM_COL32_A_MASK, ImDrawFlags_Closed, PathLineTo(), and PathStroke().

+ Here is the call graph for this function:

◆ AddQuadFilled()

void ImDrawList::AddQuadFilled ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
ImU32  col 
)
1433{
1434 if ((col & IM_COL32_A_MASK) == 0)
1435 return;
1436
1437 PathLineTo(p1);
1438 PathLineTo(p2);
1439 PathLineTo(p3);
1440 PathLineTo(p4);
1442}

References col(), IM_COL32_A_MASK, PathFillConvex(), and PathLineTo().

+ Here is the call graph for this function:

◆ AddRect()

void ImDrawList::AddRect ( const ImVec2 p_min,
const ImVec2 p_max,
ImU32  col,
float  rounding = 0.0f,
ImDrawFlags  flags = 0,
float  thickness = 1.0f 
)
1378{
1379 if ((col & IM_COL32_A_MASK) == 0)
1380 return;
1382 PathRect(p_min + ImVec2(0.50f, 0.50f), p_max - ImVec2(0.50f, 0.50f), rounding, flags);
1383 else
1384 PathRect(p_min + ImVec2(0.50f, 0.50f), p_max - ImVec2(0.49f, 0.49f), rounding, flags); // Better looking lower-right corner and rounded non-AA shapes.
1385 PathStroke(col, ImDrawFlags_Closed, thickness);
1386}

References col(), Flags, IM_COL32_A_MASK, ImDrawFlags_Closed, ImDrawListFlags_AntiAliasedLines, PathRect(), and PathStroke().

Referenced by ImGui::AcceptDragDropPayload(), ImGui::Begin(), ImGui::ColorButton(), ImGui::DebugDrawItemRect(), ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(), ImGui::DebugNodeDrawList(), ImGui::DebugNodeTabBar(), ImGui::DebugNodeTable(), ImGui::DebugNodeWindow(), ImGui::DebugRenderViewportThumbnail(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), ImGui::Image(), ImGui::ItemHoverable(), ImGui::NavScoreItem(), ImGui::NavUpdate(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::render_extruders_combo(), ImGui::RenderFrame(), ImGui::RenderFrameBorder(), ImGui::RenderNavHighlight(), ImGui::RenderWindowOuterBorders(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowFont(), ImGui::ShowMetricsWindow(), ImGui::TableDrawBorders(), and ImGui::TableMergeDrawChannels().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddRectFilled()

void ImDrawList::AddRectFilled ( const ImVec2 p_min,
const ImVec2 p_max,
ImU32  col,
float  rounding = 0.0f,
ImDrawFlags  flags = 0 
)
1389{
1390 if ((col & IM_COL32_A_MASK) == 0)
1391 return;
1392 if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
1393 {
1394 PrimReserve(6, 4);
1395 PrimRect(p_min, p_max, col);
1396 }
1397 else
1398 {
1399 PathRect(p_min, p_max, rounding, flags);
1401 }
1402}
IMGUI_API void PrimRect(const ImVec2 &a, const ImVec2 &b, ImU32 col)
Definition imgui_draw.cpp:653

References col(), IM_COL32_A_MASK, ImDrawFlags_RoundCornersMask_, ImDrawFlags_RoundCornersNone, PathFillConvex(), PathRect(), PrimRect(), and PrimReserve().

Referenced by ImGui::Begin(), ImGui::BeginCombo(), ImGui::Checkbox(), ImGui::ColorButton(), ImGui::DebugRenderViewportThumbnail(), Slic3r::GUI::image_button_ex(), ImGui::ImageButtonEx(), ImGui::InputTextEx(), ImGui::NavScoreItem(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), ImGui::PlotEx(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::render_extruders_combo(), Slic3r::GUI::GCodeViewer::render_legend(), ImGui::RenderColorRectWithAlphaCheckerboard(), ImGui::RenderFrame(), ImGui::RenderRectFilledRangeH(), ImGui::RenderRectFilledWithHole(), ImGui::RenderWindowDecorations(), ImGui::ScrollbarEx(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleMenuFile(), ImGui::ShowMetricsWindow(), ImGui::SliderScalar(), ImGui::SplitterBehavior(), ImGui::TableEndRow(), ImGui::TableMergeDrawChannels(), and ImGui::VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddRectFilledMultiColor()

void ImDrawList::AddRectFilledMultiColor ( const ImVec2 p_min,
const ImVec2 p_max,
ImU32  col_upr_left,
ImU32  col_upr_right,
ImU32  col_bot_right,
ImU32  col_bot_left 
)
1406{
1407 if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0)
1408 return;
1409
1410 const ImVec2 uv = _Data->TexUvWhitePixel;
1411 PrimReserve(6, 4);
1414 PrimWriteVtx(p_min, uv, col_upr_left);
1415 PrimWriteVtx(ImVec2(p_max.x, p_min.y), uv, col_upr_right);
1416 PrimWriteVtx(p_max, uv, col_bot_right);
1417 PrimWriteVtx(ImVec2(p_min.x, p_max.y), uv, col_bot_left);
1418}
void PrimWriteIdx(ImDrawIdx idx)
Definition imgui.h:2449
void PrimWriteVtx(const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
Definition imgui.h:2448

References _Data, _VtxCurrentIdx, IM_COL32_A_MASK, PrimReserve(), PrimWriteIdx(), PrimWriteVtx(), ImDrawListSharedData::TexUvWhitePixel, ImVec2::x, and ImVec2::y.

Referenced by ImGui::ColorPicker4(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddText() [1/2]

void ImDrawList::AddText ( const ImFont font,
float  font_size,
const ImVec2 pos,
ImU32  col,
const char *  text_begin,
const char *  text_end = NULL,
float  wrap_width = 0.0f,
const ImVec4 cpu_fine_clip_rect = NULL 
)
1565{
1566 if ((col & IM_COL32_A_MASK) == 0)
1567 return;
1568
1569 if (text_end == NULL)
1570 text_end = text_begin + strlen(text_begin);
1571 if (text_begin == text_end)
1572 return;
1573
1574 // Pull default font/size from the shared ImDrawListSharedData instance
1575 if (font == NULL)
1576 font = _Data->Font;
1577 if (font_size == 0.0f)
1578 font_size = _Data->FontSize;
1579
1580 IM_ASSERT(font->ContainerAtlas->TexID == _CmdHeader.TextureId); // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font.
1581
1582 ImVec4 clip_rect = _CmdHeader.ClipRect;
1583 if (cpu_fine_clip_rect)
1584 {
1585 clip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x);
1586 clip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y);
1587 clip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z);
1588 clip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w);
1589 }
1590 font->RenderText(this, font_size, pos, col, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL);
1591}
static T ImMin(T lhs, T rhs)
Definition imgui_internal.h:409
float FontSize
Definition imgui_internal.h:688
ImTextureID TexID
Definition imgui.h:2654
IMGUI_API void RenderText(ImDrawList *draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4 &clip_rect, const char *text_begin, const char *text_end, float wrap_width=0.0f, bool cpu_fine_clip=false) const
Definition imgui_draw.cpp:3512

References _CmdHeader, _Data, ImDrawCmdHeader::ClipRect, col(), ImFont::ContainerAtlas, ImDrawListSharedData::Font, ImDrawListSharedData::FontSize, IM_ASSERT, IM_COL32_A_MASK, ImMax(), ImMin(), ImFont::RenderText(), ImFontAtlas::TexID, ImDrawCmdHeader::TextureId, ImVec4::w, ImVec4::x, ImVec4::y, and ImVec4::z.

+ Here is the call graph for this function:

◆ AddText() [2/2]

void ImDrawList::AddText ( const ImVec2 pos,
ImU32  col,
const char *  text_begin,
const char *  text_end = NULL 
)
1594{
1595 AddText(NULL, 0.0f, pos, col, text_begin, text_end);
1596}
IMGUI_API void AddText(const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
Definition imgui_draw.cpp:1593

References AddText(), and col().

Referenced by AddText(), ImGui::DebugRenderViewportThumbnail(), igl::opengl::glfw::imgui::ImGuiMenu::draw_text(), ImGui::InputTextEx(), ImGui::NavScoreItem(), ImGui::NavUpdate(), ImGui::RenderText(), ImGui::RenderTextClippedEx(), ImGui::RenderTextWrapped(), ShowDemoWindowLayout(), ImGui::ShowMetricsWindow(), and ImGui::TableMergeDrawChannels().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddTriangle()

void ImDrawList::AddTriangle ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
ImU32  col,
float  thickness = 1.0f 
)
1445{
1446 if ((col & IM_COL32_A_MASK) == 0)
1447 return;
1448
1449 PathLineTo(p1);
1450 PathLineTo(p2);
1451 PathLineTo(p3);
1452 PathStroke(col, ImDrawFlags_Closed, thickness);
1453}

References col(), IM_COL32_A_MASK, ImDrawFlags_Closed, PathLineTo(), and PathStroke().

Referenced by ImGui::ColorPicker4(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddTriangleFilled()

void ImDrawList::AddTriangleFilled ( const ImVec2 p1,
const ImVec2 p2,
const ImVec2 p3,
ImU32  col 
)
1456{
1457 if ((col & IM_COL32_A_MASK) == 0)
1458 return;
1459
1460 PathLineTo(p1);
1461 PathLineTo(p2);
1462 PathLineTo(p3);
1464}

References col(), IM_COL32_A_MASK, PathFillConvex(), and PathLineTo().

Referenced by ImGui::RenderArrow(), ImGui::RenderArrowPointingAt(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChannelsMerge()

void ImDrawList::ChannelsMerge ( )
inline
2437{ _Splitter.Merge(this); }
IMGUI_API void Merge(ImDrawList *draw_list)
Definition imgui_draw.cpp:1707

References ImDrawListSplitter::Merge().

+ Here is the call graph for this function:

◆ ChannelsSetCurrent()

void ImDrawList::ChannelsSetCurrent ( int  n)
inline
2438{ _Splitter.SetCurrentChannel(this, n); }
IMGUI_API void SetCurrentChannel(ImDrawList *draw_list, int channel_idx)
Definition imgui_draw.cpp:1778

References ImDrawListSplitter::SetCurrentChannel().

+ Here is the call graph for this function:

◆ ChannelsSplit()

void ImDrawList::ChannelsSplit ( int  count)
inline
2436{ _Splitter.Split(this, count); }
IMGUI_API void Split(ImDrawList *draw_list, int count)
Definition imgui_draw.cpp:1677

References ImDrawListSplitter::Split().

+ Here is the call graph for this function:

◆ CloneOutput()

ImDrawList * ImDrawList::CloneOutput ( ) const
444{
446 dst->CmdBuffer = CmdBuffer;
447 dst->IdxBuffer = IdxBuffer;
448 dst->VtxBuffer = VtxBuffer;
449 dst->Flags = Flags;
450 return dst;
451}
#define IM_NEW(_TYPE)
Definition imgui.h:1637
Definition imgui.h:2348

References _Data, CmdBuffer, Flags, IdxBuffer, IM_NEW, and VtxBuffer.

◆ GetClipRectMax()

ImVec2 ImDrawList::GetClipRectMax ( ) const
inline
2378{ const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); }
T & back()
Definition imgui.h:1685

References ImVector< T >::back(), ImVec4::w, and ImVec4::z.

+ Here is the call graph for this function:

◆ GetClipRectMin()

ImVec2 ImDrawList::GetClipRectMin ( ) const
inline
2377{ const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); }

References ImVector< T >::back(), ImVec4::x, and ImVec4::y.

+ Here is the call graph for this function:

◆ PathArcTo()

void ImDrawList::PathArcTo ( const ImVec2 center,
float  radius,
float  a_min,
float  a_max,
int  num_segments = 0 
)
1164{
1165 if (radius <= 0.0f)
1166 {
1167 _Path.push_back(center);
1168 return;
1169 }
1170
1171 if (num_segments > 0)
1172 {
1173 _PathArcToN(center, radius, a_min, a_max, num_segments);
1174 return;
1175 }
1176
1177 // Automatic segment count
1178 if (radius <= _Data->ArcFastRadiusCutoff)
1179 {
1180 const bool a_is_reverse = a_max < a_min;
1181
1182 // We are going to use precomputed values for mid samples.
1183 // Determine first and last sample in lookup table that belong to the arc.
1184 const float a_min_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_min / (IM_PI * 2.0f);
1185 const float a_max_sample_f = IM_DRAWLIST_ARCFAST_SAMPLE_MAX * a_max / (IM_PI * 2.0f);
1186
1187 const int a_min_sample = a_is_reverse ? (int)ImFloorSigned(a_min_sample_f) : (int)ImCeil(a_min_sample_f);
1188 const int a_max_sample = a_is_reverse ? (int)ImCeil(a_max_sample_f) : (int)ImFloorSigned(a_max_sample_f);
1189 const int a_mid_samples = a_is_reverse ? ImMax(a_min_sample - a_max_sample, 0) : ImMax(a_max_sample - a_min_sample, 0);
1190
1191 const float a_min_segment_angle = a_min_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1192 const float a_max_segment_angle = a_max_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX;
1193 const bool a_emit_start = (a_min_segment_angle - a_min) != 0.0f;
1194 const bool a_emit_end = (a_max - a_max_segment_angle) != 0.0f;
1195
1196 _Path.reserve(_Path.Size + (a_mid_samples + 1 + (a_emit_start ? 1 : 0) + (a_emit_end ? 1 : 0)));
1197 if (a_emit_start)
1198 _Path.push_back(ImVec2(center.x + ImCos(a_min) * radius, center.y + ImSin(a_min) * radius));
1199 if (a_mid_samples > 0)
1200 _PathArcToFastEx(center, radius, a_min_sample, a_max_sample, 0);
1201 if (a_emit_end)
1202 _Path.push_back(ImVec2(center.x + ImCos(a_max) * radius, center.y + ImSin(a_max) * radius));
1203 }
1204 else
1205 {
1206 const float arc_length = ImAbs(a_max - a_min);
1207 const int circle_segment_count = _CalcCircleAutoSegmentCount(radius);
1208 const int arc_segment_count = ImMax((int)ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0f)), (int)(2.0f * IM_PI / arc_length));
1209 _PathArcToN(center, radius, a_min, a_max, arc_segment_count);
1210 }
1211}
#define ImCeil(X)
Definition imgui_internal.h:390
static float ImFloorSigned(float f)
Definition imgui_internal.h:428
IMGUI_API void _PathArcToN(const ImVec2 &center, float radius, float a_min, float a_max, int num_segments)
Definition imgui_draw.cpp:1134
IMGUI_API void _PathArcToFastEx(const ImVec2 &center, float radius, int a_min_sample, int a_max_sample, int a_step)
Definition imgui_draw.cpp:1042

References _CalcCircleAutoSegmentCount(), _Path, _PathArcToFastEx(), _PathArcToN(), IM_DRAWLIST_ARCFAST_SAMPLE_MAX, IM_PI, ImAbs(), ImCeil, ImCos, ImFloorSigned(), ImMax(), ImSin, ImVector< T >::push_back(), ImVector< T >::reserve(), ImVector< T >::Size, ImVec2::x, and ImVec2::y.

Referenced by AddCircle(), AddCircleFilled(), AddNgon(), AddNgonFilled(), ImGui::ColorPicker4(), ImGui::RenderRectFilledRangeH(), and ImGui::RenderWindowOuterBorders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathArcToFast()

void ImDrawList::PathArcToFast ( const ImVec2 center,
float  radius,
int  a_min_of_12,
int  a_max_of_12 
)
1154{
1155 if (radius <= 0.0f)
1156 {
1157 _Path.push_back(center);
1158 return;
1159 }
1160 _PathArcToFastEx(center, radius, a_min_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, a_max_of_12 * IM_DRAWLIST_ARCFAST_SAMPLE_MAX / 12, 0);
1161}

References _Path, _PathArcToFastEx(), IM_DRAWLIST_ARCFAST_SAMPLE_MAX, and ImVector< T >::push_back().

Referenced by AddCircle(), AddCircleFilled(), PathRect(), ImGui::RenderRectFilledRangeH(), ImGui::RenderWindowDecorations(), and ImGui::TabItemBackground().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathBezierCubicCurveTo()

void ImDrawList::PathBezierCubicCurveTo ( const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
int  num_segments = 0 
)
1277{
1278 ImVec2 p1 = _Path.back();
1279 if (num_segments == 0)
1280 {
1281 PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated
1282 }
1283 else
1284 {
1285 float t_step = 1.0f / (float)num_segments;
1286 for (int i_step = 1; i_step <= num_segments; i_step++)
1287 _Path.push_back(ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step));
1288 }
1289}
ImVec2 ImBezierCubicCalc(const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, const ImVec2 &p4, float t)
Definition imgui_draw.cpp:1213
static void PathBezierCubicCurveToCasteljau(ImVector< ImVec2 > *path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)
Definition imgui_draw.cpp:1233
float CurveTessellationTol
Definition imgui_internal.h:689

References _Data, _Path, ImVector< T >::back(), ImDrawListSharedData::CurveTessellationTol, ImBezierCubicCalc(), PathBezierCubicCurveToCasteljau(), ImVector< T >::push_back(), ImVec2::x, and ImVec2::y.

Referenced by AddBezierCubic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathBezierCurveTo()

void ImDrawList::PathBezierCurveTo ( const ImVec2 p2,
const ImVec2 p3,
const ImVec2 p4,
int  num_segments = 0 
)
inline
2454{ PathBezierCubicCurveTo(p2, p3, p4, num_segments); }

◆ PathBezierQuadraticCurveTo()

void ImDrawList::PathBezierQuadraticCurveTo ( const ImVec2 p2,
const ImVec2 p3,
int  num_segments = 0 
)
1292{
1293 ImVec2 p1 = _Path.back();
1294 if (num_segments == 0)
1295 {
1296 PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0);// Auto-tessellated
1297 }
1298 else
1299 {
1300 float t_step = 1.0f / (float)num_segments;
1301 for (int i_step = 1; i_step <= num_segments; i_step++)
1302 _Path.push_back(ImBezierQuadraticCalc(p1, p2, p3, t_step * i_step));
1303 }
1304}
ImVec2 ImBezierQuadraticCalc(const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, float t)
Definition imgui_draw.cpp:1223
static void PathBezierQuadraticCurveToCasteljau(ImVector< ImVec2 > *path, float x1, float y1, float x2, float y2, float x3, float y3, float tess_tol, int level)
Definition imgui_draw.cpp:1258

References _Data, _Path, ImVector< T >::back(), ImDrawListSharedData::CurveTessellationTol, ImBezierQuadraticCalc(), PathBezierQuadraticCurveToCasteljau(), ImVector< T >::push_back(), ImVec2::x, and ImVec2::y.

Referenced by AddBezierQuadratic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathClear()

void ImDrawList::PathClear ( )
inline
2414{ _Path.Size = 0; }

References ImVector< T >::Size.

◆ PathFillConvex()

void ImDrawList::PathFillConvex ( ImU32  col)
inline
2417{ AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; } // Note: Anti-aliased filling requires points to be in clockwise order.
IMGUI_API void AddConvexPolyFilled(const ImVec2 *points, int num_points, ImU32 col)
Definition imgui_draw.cpp:961

References col(), ImVector< T >::Data, and ImVector< T >::Size.

Referenced by AddCircleFilled(), AddImageRounded(), AddNgonFilled(), AddQuadFilled(), AddRectFilled(), AddTriangleFilled(), ImGui::RenderRectFilledRangeH(), ImGui::RenderWindowDecorations(), and ImGui::TabItemBackground().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathLineTo()

void ImDrawList::PathLineTo ( const ImVec2 pos)
inline
2415{ _Path.push_back(pos); }

References ImVector< T >::push_back().

Referenced by AddBezierCubic(), AddBezierQuadratic(), AddLine(), AddQuad(), AddQuadFilled(), AddTriangle(), AddTriangleFilled(), PathRect(), ImGui::RenderCheckMark(), ImGui::RenderRectFilledRangeH(), ImGui::RenderWindowDecorations(), and ImGui::TabItemBackground().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathLineToMergeDuplicate()

void ImDrawList::PathLineToMergeDuplicate ( const ImVec2 pos)
inline
2416{ if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }

References ImVector< T >::Data, ImVector< T >::push_back(), and ImVector< T >::Size.

+ Here is the call graph for this function:

◆ PathRect()

void ImDrawList::PathRect ( const ImVec2 rect_min,
const ImVec2 rect_max,
float  rounding = 0.0f,
ImDrawFlags  flags = 0 
)
1341{
1342 flags = FixRectCornerFlags(flags);
1343 rounding = ImMin(rounding, ImFabs(b.x - a.x) * ( ((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f ) - 1.0f);
1344 rounding = ImMin(rounding, ImFabs(b.y - a.y) * ( ((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f ) - 1.0f);
1345
1346 if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
1347 {
1348 PathLineTo(a);
1349 PathLineTo(ImVec2(b.x, a.y));
1350 PathLineTo(b);
1351 PathLineTo(ImVec2(a.x, b.y));
1352 }
1353 else
1354 {
1355 const float rounding_tl = (flags & ImDrawFlags_RoundCornersTopLeft) ? rounding : 0.0f;
1356 const float rounding_tr = (flags & ImDrawFlags_RoundCornersTopRight) ? rounding : 0.0f;
1357 const float rounding_br = (flags & ImDrawFlags_RoundCornersBottomRight) ? rounding : 0.0f;
1358 const float rounding_bl = (flags & ImDrawFlags_RoundCornersBottomLeft) ? rounding : 0.0f;
1359 PathArcToFast(ImVec2(a.x + rounding_tl, a.y + rounding_tl), rounding_tl, 6, 9);
1360 PathArcToFast(ImVec2(b.x - rounding_tr, a.y + rounding_tr), rounding_tr, 9, 12);
1361 PathArcToFast(ImVec2(b.x - rounding_br, b.y - rounding_br), rounding_br, 0, 3);
1362 PathArcToFast(ImVec2(a.x + rounding_bl, b.y - rounding_bl), rounding_bl, 3, 6);
1363 }
1364}
@ ImDrawFlags_RoundCornersTopLeft
Definition imgui.h:2313
@ ImDrawFlags_RoundCornersBottomLeft
Definition imgui.h:2315
@ ImDrawFlags_RoundCornersTopRight
Definition imgui.h:2314
@ ImDrawFlags_RoundCornersBottom
Definition imgui.h:2319
@ ImDrawFlags_RoundCornersRight
Definition imgui.h:2321
@ ImDrawFlags_RoundCornersBottomRight
Definition imgui.h:2316
@ ImDrawFlags_RoundCornersLeft
Definition imgui.h:2320
@ ImDrawFlags_RoundCornersTop
Definition imgui.h:2318
#define ImFabs(X)
Definition imgui_internal.h:381

References FixRectCornerFlags(), ImDrawFlags_RoundCornersBottom, ImDrawFlags_RoundCornersBottomLeft, ImDrawFlags_RoundCornersBottomRight, ImDrawFlags_RoundCornersLeft, ImDrawFlags_RoundCornersMask_, ImDrawFlags_RoundCornersNone, ImDrawFlags_RoundCornersRight, ImDrawFlags_RoundCornersTop, ImDrawFlags_RoundCornersTopLeft, ImDrawFlags_RoundCornersTopRight, ImFabs, ImMin(), PathArcToFast(), and PathLineTo().

Referenced by AddImageRounded(), AddRect(), and AddRectFilled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PathStroke()

void ImDrawList::PathStroke ( ImU32  col,
ImDrawFlags  flags = 0,
float  thickness = 1.0f 
)
inline
2418{ AddPolyline(_Path.Data, _Path.Size, col, flags, thickness); _Path.Size = 0; }
IMGUI_API void AddPolyline(const ImVec2 *points, int num_points, ImU32 col, ImDrawFlags flags, float thickness)
Definition imgui_draw.cpp:705

References col(), ImVector< T >::Data, and ImVector< T >::Size.

Referenced by AddBezierCubic(), AddBezierQuadratic(), AddCircle(), AddLine(), AddNgon(), AddQuad(), AddRect(), AddTriangle(), ImGui::ColorPicker4(), ImGui::RenderCheckMark(), ImGui::RenderWindowOuterBorders(), and ImGui::TabItemBackground().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopClipRect()

void ImDrawList::PopClipRect ( )
593{
597}
IMGUI_API void _OnChangedClipRect()
Definition imgui_draw.cpp:498
ImVec4 ClipRectFullscreen
Definition imgui_internal.h:691

References _ClipRectStack, _CmdHeader, _Data, _OnChangedClipRect(), ImDrawCmdHeader::ClipRect, ImDrawListSharedData::ClipRectFullscreen, ImVector< T >::Data, ImVector< T >::pop_back(), and ImVector< T >::Size.

Referenced by ImGui::AcceptDragDropPayload(), ImGui::EndTable(), ImGui::PopClipRect(), ImGui::RenderNavHighlight(), ShowDemoWindowLayout(), ShowExampleAppCustomRendering(), and ImGui::TableDrawBorders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopTextureID()

void ImDrawList::PopTextureID ( )
607{
611}
IMGUI_API void _OnChangedTextureID()
Definition imgui_draw.cpp:520

References _CmdHeader, _OnChangedTextureID(), _TextureIdStack, ImVector< T >::Data, ImVector< T >::pop_back(), ImVector< T >::Size, and ImDrawCmdHeader::TextureId.

Referenced by AddImage(), AddImageQuad(), AddImageRounded(), ImGui::PopFont(), and ImGui::RenderMouseCursor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrimQuadUV()

void ImDrawList::PrimQuadUV ( const ImVec2 a,
const ImVec2 b,
const ImVec2 c,
const ImVec2 d,
const ImVec2 uv_a,
const ImVec2 uv_b,
const ImVec2 uv_c,
const ImVec2 uv_d,
ImU32  col 
)
684{
686 _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);
687 _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);
688 _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;
689 _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;
690 _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;
691 _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;
692 _VtxWritePtr += 4;
693 _VtxCurrentIdx += 4;
694 _IdxWritePtr += 6;
695}

References _IdxWritePtr, _VtxCurrentIdx, _VtxWritePtr, col(), ImDrawVert::col, ImDrawVert::pos, and ImDrawVert::uv.

Referenced by AddImageQuad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrimRect()

void ImDrawList::PrimRect ( const ImVec2 a,
const ImVec2 b,
ImU32  col 
)
654{
655 ImVec2 b(c.x, a.y), d(a.x, c.y), uv(_Data->TexUvWhitePixel);
657 _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);
658 _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);
659 _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;
660 _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col;
661 _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col;
662 _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv; _VtxWritePtr[3].col = col;
663 _VtxWritePtr += 4;
664 _VtxCurrentIdx += 4;
665 _IdxWritePtr += 6;
666}

References _Data, _IdxWritePtr, _VtxCurrentIdx, _VtxWritePtr, col(), ImDrawVert::col, ImDrawVert::pos, ImDrawListSharedData::TexUvWhitePixel, and ImDrawVert::uv.

Referenced by AddRectFilled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrimRectUV()

void ImDrawList::PrimRectUV ( const ImVec2 a,
const ImVec2 b,
const ImVec2 uv_a,
const ImVec2 uv_b,
ImU32  col 
)
669{
670 ImVec2 b(c.x, a.y), d(a.x, c.y), uv_b(uv_c.x, uv_a.y), uv_d(uv_a.x, uv_c.y);
672 _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2);
673 _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3);
674 _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;
675 _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;
676 _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;
677 _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;
678 _VtxWritePtr += 4;
679 _VtxCurrentIdx += 4;
680 _IdxWritePtr += 6;
681}

References _IdxWritePtr, _VtxCurrentIdx, _VtxWritePtr, col(), ImDrawVert::col, ImDrawVert::pos, ImDrawVert::uv, ImVec2::x, and ImVec2::y.

Referenced by AddImage(), and ImFont::RenderChar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrimReserve()

void ImDrawList::PrimReserve ( int  idx_count,
int  vtx_count 
)
617{
618 // Large mesh support (when enabled)
619 IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
620 if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset))
621 {
622 // FIXME: In theory we should be testing that vtx_count <64k here.
623 // In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us
624 // to not make that check until we rework the text functions to handle clipping and large horizontal lines better.
627 }
628
629 ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
630 draw_cmd->ElemCount += idx_count;
631
632 int vtx_buffer_old_size = VtxBuffer.Size;
633 VtxBuffer.resize(vtx_buffer_old_size + vtx_count);
634 _VtxWritePtr = VtxBuffer.Data + vtx_buffer_old_size;
635
636 int idx_buffer_old_size = IdxBuffer.Size;
637 IdxBuffer.resize(idx_buffer_old_size + idx_count);
638 _IdxWritePtr = IdxBuffer.Data + idx_buffer_old_size;
639}
@ ImDrawListFlags_AllowVtxOffset
Definition imgui.h:2335
IMGUI_API void _OnChangedVtxOffset()
Definition imgui_draw.cpp:542

References _CmdHeader, _IdxWritePtr, _OnChangedVtxOffset(), _VtxCurrentIdx, _VtxWritePtr, CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, Flags, IdxBuffer, IM_ASSERT_PARANOID, ImDrawListFlags_AllowVtxOffset, ImVector< T >::resize(), ImVector< T >::Size, VtxBuffer, and ImDrawCmdHeader::VtxOffset.

Referenced by AddConvexPolyFilled(), AddImage(), AddImageQuad(), AddPolyline(), AddRectFilled(), AddRectFilledMultiColor(), ImGui::ColorPicker4(), ImFont::RenderChar(), and ImFont::RenderText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrimUnreserve()

void ImDrawList::PrimUnreserve ( int  idx_count,
int  vtx_count 
)
643{
644 IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
645
646 ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
647 draw_cmd->ElemCount -= idx_count;
648 VtxBuffer.shrink(VtxBuffer.Size - vtx_count);
649 IdxBuffer.shrink(IdxBuffer.Size - idx_count);
650}
void shrink(int new_size)
Definition imgui.h:1692

References CmdBuffer, ImVector< T >::Data, ImDrawCmd::ElemCount, IdxBuffer, IM_ASSERT_PARANOID, ImVector< T >::shrink(), ImVector< T >::Size, and VtxBuffer.

+ Here is the call graph for this function:

◆ PrimVtx()

void ImDrawList::PrimVtx ( const ImVec2 pos,
const ImVec2 uv,
ImU32  col 
)
inline
2450{ PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index

References col().

Referenced by ImGui::ColorPicker4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrimWriteIdx()

void ImDrawList::PrimWriteIdx ( ImDrawIdx  idx)
inline
2449{ *_IdxWritePtr = idx; _IdxWritePtr++; }

Referenced by AddRectFilledMultiColor().

+ Here is the caller graph for this function:

◆ PrimWriteVtx()

void ImDrawList::PrimWriteVtx ( const ImVec2 pos,
const ImVec2 uv,
ImU32  col 
)
inline
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14

References col(), ImDrawVert::col, ImDrawVert::pos, and ImDrawVert::uv.

Referenced by AddRectFilledMultiColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushClipRect()

void ImDrawList::PushClipRect ( ImVec2  clip_rect_min,
ImVec2  clip_rect_max,
bool  intersect_with_current_clip_rect = false 
)
569{
570 ImVec4 cr(cr_min.x, cr_min.y, cr_max.x, cr_max.y);
571 if (intersect_with_current_clip_rect)
572 {
573 ImVec4 current = _CmdHeader.ClipRect;
574 if (cr.x < current.x) cr.x = current.x;
575 if (cr.y < current.y) cr.y = current.y;
576 if (cr.z > current.z) cr.z = current.z;
577 if (cr.w > current.w) cr.w = current.w;
578 }
579 cr.z = ImMax(cr.x, cr.z);
580 cr.w = ImMax(cr.y, cr.w);
581
583 _CmdHeader.ClipRect = cr;
585}

References _ClipRectStack, _CmdHeader, _OnChangedClipRect(), ImDrawCmdHeader::ClipRect, ImMax(), ImVector< T >::push_back(), ImVec4::w, ImVec2::x, ImVec4::x, ImVec2::y, ImVec4::y, and ImVec4::z.

Referenced by ImGui::AcceptDragDropPayload(), GetViewportDrawList(), ImGui::PushClipRect(), PushClipRectFullScreen(), ImGui::RenderNavHighlight(), ShowDemoWindowLayout(), ShowExampleAppCustomRendering(), ImGui::TableDrawBorders(), and ImGui::TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushClipRectFullScreen()

void ImDrawList::PushClipRectFullScreen ( )
588{
590}
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
Definition imgui_draw.cpp:568

References _Data, ImDrawListSharedData::ClipRectFullscreen, PushClipRect(), ImVec4::w, ImVec4::x, ImVec4::y, and ImVec4::z.

+ Here is the call graph for this function:

◆ PushTextureID()

void ImDrawList::PushTextureID ( ImTextureID  texture_id)
600{
601 _TextureIdStack.push_back(texture_id);
602 _CmdHeader.TextureId = texture_id;
604}

References _CmdHeader, _OnChangedTextureID(), _TextureIdStack, ImVector< T >::push_back(), and ImDrawCmdHeader::TextureId.

Referenced by AddImage(), AddImageQuad(), AddImageRounded(), ImGui::Begin(), GetViewportDrawList(), ImGui::PushFont(), and ImGui::RenderMouseCursor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _ClipRectStack

◆ _CmdHeader

◆ _Data

◆ _FringeScale

float ImDrawList::_FringeScale

◆ _IdxWritePtr

◆ _OwnerName

const char* ImDrawList::_OwnerName

◆ _Path

◆ _Splitter

ImDrawListSplitter ImDrawList::_Splitter

◆ _TextureIdStack

ImVector<ImTextureID> ImDrawList::_TextureIdStack

◆ _VtxCurrentIdx

◆ _VtxWritePtr

◆ CmdBuffer

◆ Flags

◆ IdxBuffer

◆ VtxBuffer


The documentation for this struct was generated from the following files: