| 3682 | } |
| 3683 | |
| 3684 | ImVec2 PlotToPixels(double x, double y, ImAxis x_idx, ImAxis y_idx) { |
| 3685 | ImPlotContext& gp = *GImPlot; |
| 3686 | IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr, "PlotToPixels() needs to be called between BeginPlot() and EndPlot()!"); |
| 3687 | IM_ASSERT_USER_ERROR(x_idx == IMPLOT_AUTO || (x_idx >= ImAxis_X1 && x_idx < ImAxis_Y1), "X-Axis index out of bounds!"); |
| 3688 | IM_ASSERT_USER_ERROR(y_idx == IMPLOT_AUTO || (y_idx >= ImAxis_Y1 && y_idx < ImAxis_COUNT), "Y-Axis index out of bounds!"); |
| 3689 | SetupLock(); |
| 3690 | ImPlotPlot& plot = *gp.CurrentPlot; |
| 3691 | ImPlotAxis& x_axis = x_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentX] : plot.Axes[x_idx]; |
| 3692 | ImPlotAxis& y_axis = y_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentY] : plot.Axes[y_idx]; |
| 3693 | return ImVec2( x_axis.PlotToPixels(x), y_axis.PlotToPixels(y) ); |
| 3694 | } |
| 3695 | |
| 3696 | ImVec2 PlotToPixels(const ImPlotPoint& plt, ImAxis x_idx, ImAxis y_idx) { |
| 3697 | return PlotToPixels(plt.x, plt.y, x_idx, y_idx); |
no test coverage detected