mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 21:17:01 +00:00
AddBezier()->AddBezierCurve(). PathBezierTo()->PathBezierCurveTo(), and reads current point back, more standard (#311)
This commit is contained in:
parent
d2e529e533
commit
90e5c97f13
4
imgui.h
4
imgui.h
@ -1101,7 +1101,7 @@ struct ImDrawList
|
||||
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
|
||||
IMGUI_API void AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness, bool anti_aliased);
|
||||
IMGUI_API void AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col, bool anti_aliased);
|
||||
inline void AddBezier(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0) { PathBezierTo(pos0, cp0, cp1, pos1, num_segments); PathStroke(col, false, thickness); }
|
||||
IMGUI_API void AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0);
|
||||
|
||||
// Stateful path API, add points then finish with PathFill() or PathStroke()
|
||||
inline void PathClear() { _Path.resize(0); }
|
||||
@ -1111,7 +1111,7 @@ struct ImDrawList
|
||||
inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness, true); PathClear(); }
|
||||
IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10);
|
||||
IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle
|
||||
IMGUI_API void PathBezierTo(const ImVec2& p0, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0);
|
||||
IMGUI_API void PathBezierCurveTo(const ImVec2& p1, 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, int rounding_corners = 0x0F);
|
||||
|
||||
// Channels
|
||||
|
@ -665,9 +665,9 @@ static void PathBezierToCasteljau(ImVector<ImVec2>* path, float x1, float y1, fl
|
||||
}
|
||||
}
|
||||
|
||||
void ImDrawList::PathBezierTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments)
|
||||
void ImDrawList::PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments)
|
||||
{
|
||||
PathLineToMergeDuplicate(p1);
|
||||
ImVec2 p1 = _Path.back();
|
||||
if (num_segments == 0)
|
||||
{
|
||||
// Auto-tessellated
|
||||
@ -793,6 +793,16 @@ void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col,
|
||||
PathFill(col);
|
||||
}
|
||||
|
||||
void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments)
|
||||
{
|
||||
if ((col >> 24) == 0)
|
||||
return;
|
||||
|
||||
PathLineTo(pos0);
|
||||
PathBezierCurveTo(cp0, cp1, pos1, num_segments);
|
||||
PathStroke(col, false, thickness);
|
||||
}
|
||||
|
||||
void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect)
|
||||
{
|
||||
if ((col >> 24) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user