| 3751 | } |
| 3752 | |
| 3753 | ImVec2 PlotToPixels(double x, double y, ImAxis x_idx, ImAxis y_idx) { |
| 3754 | ImPlotContext& gp = *GImPlot; |
| 3755 | IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr, "PlotToPixels() needs to be called between BeginPlot() and EndPlot()!"); |
| 3756 | IM_ASSERT_USER_ERROR(x_idx == IMPLOT_AUTO || (x_idx >= ImAxis_X1 && x_idx < ImAxis_Y1), "X-Axis index out of bounds!"); |
| 3757 | IM_ASSERT_USER_ERROR(y_idx == IMPLOT_AUTO || (y_idx >= ImAxis_Y1 && y_idx < ImAxis_COUNT), "Y-Axis index out of bounds!"); |
| 3758 | SetupLock(); |
| 3759 | ImPlotPlot& plot = *gp.CurrentPlot; |
| 3760 | ImPlotAxis& x_axis = x_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentX] : plot.Axes[x_idx]; |
| 3761 | ImPlotAxis& y_axis = y_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentY] : plot.Axes[y_idx]; |
| 3762 | return ImVec2( x_axis.PlotToPixels(x), y_axis.PlotToPixels(y) ); |
| 3763 | } |
| 3764 | |
| 3765 | ImVec2 PlotToPixels(const ImPlotPoint& plt, ImAxis x_idx, ImAxis y_idx) { |
| 3766 | return PlotToPixels(plt.x, plt.y, x_idx, y_idx); |
no test coverage detected