MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / plot_export_image

Function plot_export_image

plot/plot.c:825–857  ·  view source on GitHub ↗

* @brief Render the plot to an offscreen surface and export as PNG. * * Performs a complete one-shot render of the plot to disk without * presenting a visible window: * 1. Configures raylib to suppress log output and to keep the * window hidden (FLAG_WINDOW_HIDDEN). A window must still be * created so raylib can establish a GL context. * 2. Allocates a RenderTexture2D matching

Source from the content-addressed store, hash-verified

823 * @param legendText New legend label text colour.
824 *
825 * @code
826 * // Solarised-ish manual theme:
827 * plot_set_colors(plot,
828 * plot_color_hex(0xFDF6E3), // bg
829 * plot_color_hex(0xEEE8D5), // grid
830 * plot_color_hex(0x657B83), // axis
831 * plot_color_hex(0xEEE8D5), // legend bg
832 * plot_color_hex(0x586E75)); // legend text
833 * @endcode
834 */
835void plot_set_colors(Plot* plot, PlotColor bg, PlotColor grid, PlotColor axis, PlotColor legendBg, PlotColor legendText) {
836 PLOT_LOG("[plot_set_colors]: enter (plot=%p)", (void*)plot);
837 if (!plot) {
838 PLOT_LOG("[plot_set_colors]: NULL plot -> noop");
839 return;
840 }
841
842 plot->bgColor = bg;
843 plot->gridColor = grid;
844 plot->axisColor = axis;
845 plot->legendBgColor = legendBg;
846 plot->legendTextColor = legendText;
847 PLOT_LOG("[plot_set_colors]: exit");
848}
849
850
851/**
852 * @brief Open a window and render the plot until the user closes it.
853 *
854 * Initialises a raylib window sized to the plot's current width/height,
855 * sets the frame rate to 60 FPS, loads the default font, and enters a
856 * blocking render loop that re-renders the plot every frame using the
857 * shared internal `render_plot()` helper. The loop exits when the user
858 * closes the window (or presses ESC, per raylib defaults), after which
859 * the window is destroyed before returning.
860 *

Callers

nothing calls this directly

Calls 1

render_plotFunction · 0.85

Tested by

no test coverage detected