mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 20:28:50 -05:00
PlotImage
This commit is contained in:
parent
04cc84ece0
commit
ec8e87561f
5
implot.h
5
implot.h
|
@ -393,9 +393,14 @@ template <typename T> IMPLOT_API void PlotHeatmap(const char* label_id, const T*
|
||||||
template <typename T> IMPLOT_API void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T));
|
template <typename T> IMPLOT_API void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, int offset=0, int stride=sizeof(T));
|
||||||
IMPLOT_API void PlotDigitalG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0);
|
IMPLOT_API void PlotDigitalG(const char* label_id, ImPlotPoint (*getter)(void* data, int idx), void* data, int count, int offset=0);
|
||||||
|
|
||||||
|
// Plots an image.
|
||||||
|
IMPLOT_API void PlotImage(const char* label_id, ImTextureID user_texture_id, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1));
|
||||||
|
|
||||||
// Plots a centered text label at point x,y with optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...).
|
// Plots a centered text label at point x,y with optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...).
|
||||||
IMPLOT_API void PlotText(const char* text, double x, double y, bool vertical=false, const ImVec2& pixel_offset=ImVec2(0,0));
|
IMPLOT_API void PlotText(const char* text, double x, double y, bool vertical=false, const ImVec2& pixel_offset=ImVec2(0,0));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Plot Utils
|
// Plot Utils
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1705,6 +1705,27 @@ void PlotRects(const char* label_id, ImPlotPoint (*getter_func)(void* data, int
|
||||||
return PlotRectsEx(label_id, getter);
|
return PlotRectsEx(label_id, getter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// PLOT IMAGE
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void PlotImage(const char* label_id, ImTextureID user_texture_id, const ImPlotPoint& bmin, const ImPlotPoint& bmax, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col) {
|
||||||
|
if (BeginItem(label_id)) {
|
||||||
|
if (FitThisFrame()) {
|
||||||
|
FitPoint(bmin);
|
||||||
|
FitPoint(bmax);
|
||||||
|
}
|
||||||
|
GetCurrentItem()->Color = tint_col;
|
||||||
|
ImDrawList& DrawList = *GetPlotDrawList();
|
||||||
|
ImVec2 p1 = PlotToPixels(bmin.x, bmax.y);
|
||||||
|
ImVec2 p2 = PlotToPixels(bmax.x, bmin.y);
|
||||||
|
PushPlotClipRect();
|
||||||
|
DrawList.AddImage(user_texture_id, p1, p2, uv0, uv1, ImGui::ColorConvertFloat4ToU32(tint_col));
|
||||||
|
PopPlotClipRect();;
|
||||||
|
EndItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// PLOT TEXT
|
// PLOT TEXT
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user