Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_gui_colorwheel.h
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 */
19
43
44#ifndef __NILOREA_GUI_COLORWHEEL__
45#define __NILOREA_GUI_COLORWHEEL__
46
47/* Allegro only: the wheel is an N_GUI widget drawn with allegro_primitives. */
48#ifdef HAVE_ALLEGRO
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
58
59#include "nilorea/n_gui.h"
60
65typedef void (*N_GUI_COLORWHEEL_CHANGE)(int widget_id, int dragging, void* user_data);
66
72typedef ALLEGRO_COLOR (*N_GUI_COLORWHEEL_COLOUR)(float u, float v, void* user_data);
73
84int n_gui_colorwheel_new(N_GUI_CTX* ctx, int window_id, float x, float y, float w, float h, N_GUI_COLORWHEEL_CHANGE on_change, void* user_data);
85
92int n_gui_colorwheel_set(N_GUI_CTX* ctx, int widget_id, float u, float v);
93
100int n_gui_colorwheel_get(N_GUI_CTX* ctx, int widget_id, float* u, float* v);
101
107void n_gui_colorwheel_set_colour(N_GUI_CTX* ctx, int widget_id, N_GUI_COLORWHEEL_COLOUR colour, void* user_data);
108
116ALLEGRO_COLOR n_gui_colorwheel_hue(float u, float v, void* user_data);
117
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* HAVE_ALLEGRO */
127
128#endif /* __NILOREA_GUI_COLORWHEEL__ */
static void on_change(const float rgba[4], void *user_data)
the picker's callback
The top-level GUI context that holds all windows.
Definition n_gui.h:1669
ALLEGRO_COLOR(* N_GUI_COLORWHEEL_COLOUR)(float u, float v, void *user_data)
The colour the disc shows for a point.
ALLEGRO_COLOR n_gui_colorwheel_hue(float u, float v, void *user_data)
The default disc colour: HSV, hue by angle with red to the right and going counter clockwise,...
int n_gui_colorwheel_get(N_GUI_CTX *ctx, int widget_id, float *u, float *v)
Read the point.
int n_gui_colorwheel_new(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, N_GUI_COLORWHEEL_CHANGE on_change, void *user_data)
Add a colour wheel, its point in the centre.
void(* N_GUI_COLORWHEEL_CHANGE)(int widget_id, int dragging, void *user_data)
Called when the point moves.
void n_gui_colorwheel_set_colour(N_GUI_CTX *ctx, int widget_id, N_GUI_COLORWHEEL_COLOUR colour, void *user_data)
Paint the disc with the caller's colours.
int n_gui_colorwheel_set(N_GUI_CTX *ctx, int widget_id, float u, float v)
Set the point.
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.