46#ifndef __NILOREA_GUI_COLOR__
47#define __NILOREA_GUI_COLOR__
static void on_change(const float rgba[4], void *user_data)
the picker's callback
The top-level GUI context that holds all windows.
int n_gui_color_picker_get(const N_GUI_COLOR_PICKER *picker, float rgba[4])
The colour the picker holds now.
void(* N_GUI_COLOR_FN)(const float rgba[4], void *user_data)
called each time the picked colour changes.
void n_gui_color_picker_open(N_GUI_COLOR_PICKER *picker, const char *what, const float rgba[4], N_GUI_COLOR_FN on_change, void *user_data)
Open the picker on a colour, centred on the display.
void n_gui_color_to_hex(const float rgba[4], char *out, size_t len)
Write a colour as #RRGGBBAA, each channel clamped to 0..1 and rounded to the nearest of 255 steps.
int n_gui_color_picker_window(const N_GUI_COLOR_PICKER *picker)
The picker's window id, for a caller that walks its windows or sets their flags.
int n_gui_color_picker_slider(const N_GUI_COLOR_PICKER *picker, int channel)
The slider for one channel, for a caller or a test that drives it.
N_GUI_COLOR_PICKER * n_gui_color_picker_new(N_GUI_CTX *ctx, const char *title, float scale)
Build a colour picker window in ctx, closed.
void n_gui_color_picker_close(N_GUI_COLOR_PICKER *picker)
Close the picker.
void n_gui_draw_color_swatch(float x, float y, float w, float h, const float rgba[4])
Draw a colour as a swatch, over a checkerboard so its alpha shows, with a thin dark border.
void n_gui_color_picker_free(N_GUI_COLOR_PICKER **picker)
Close the picker's window and free the handle.
int n_gui_color_picker_is_open(const N_GUI_COLOR_PICKER *picker)
Whether the picker is open.
ALLEGRO_MOUSE_CURSOR * n_gui_eyedropper_cursor(float scale)
Make a pipette mouse cursor, for a tool that picks a colour from an image.
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.
float rgba[4]
the colour being edited
void * user_data
handed back to on_change
N_GUI_CTX * ctx
the context the widgets live in
a colour picker: the ids of its widgets and the colour being edited