53#ifndef __NILOREA_GUI_CURVE__
54#define __NILOREA_GUI_CURVE__
84typedef float (*
N_GUI_CURVE_EVAL)(
const float* xs,
const float* ys,
int count,
float x,
void* user_data);
static void on_change(const float rgba[4], void *user_data)
the picker's callback
static void draw(N_GUI_CTX *gui)
draw the whole context into a memory bitmap
The top-level GUI context that holds all windows.
int n_gui_curve_new(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int max_points, N_GUI_CURVE_CHANGE on_change, void *user_data)
Add a curve editor to a window.
int n_gui_curve_get_points(N_GUI_CTX *ctx, int widget_id, float *xs, float *ys, int max)
Read the points.
float(* N_GUI_CURVE_EVAL)(const float *xs, const float *ys, int count, float x, void *user_data)
the caller's curve through the points, for drawing.
float n_gui_curve_eval(N_GUI_CTX *ctx, int widget_id, float x)
The editor's curve at x, as it is drawn.
void n_gui_curve_set_point_radius(N_GUI_CTX *ctx, int widget_id, float radius)
Size of the drawn points, for a display scale.
void n_gui_curve_set_eval(N_GUI_CTX *ctx, int widget_id, N_GUI_CURVE_EVAL eval, void *user_data)
Draw the caller's own curve through the points.
void n_gui_curve_set_background(N_GUI_CTX *ctx, int widget_id, N_GUI_CURVE_BACKGROUND draw, void *user_data)
Draw something behind the grid and the curve.
void(* N_GUI_CURVE_BACKGROUND)(float x, float y, float w, float h, void *user_data)
drawn behind the grid and the curve, such as a histogram.
void(* N_GUI_CURVE_CHANGE)(int widget_id, int dragging, void *user_data)
called on every change of the points.
float n_gui_curve_eval_points(const float *xs, const float *ys, int count, float x)
A monotone cubic Hermite spline through points.
int n_gui_curve_set_points(N_GUI_CTX *ctx, int widget_id, const float *xs, const float *ys, int count)
Replace the points.
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.