Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_color_picker.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <allegro5/allegro_primitives.h>
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include "nilorea/n_gui.h"
#include "nilorea/n_gui_color.h"
Include dependency graph for ex_gui_color_picker.c:

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static void click_middle (N_GUI_CTX *gui, int window_id, int widget_id)
 click the middle of a widget, in display coordinates
static void expect_true (const char *what, int ok)
 record one check
int main (int argc, char **argv)
static void on_change (const float rgba[4], void *user_data)
 the picker's callback
static int process_args (int argc, char **argv)
 read -V LOGLEVEL
static ALLEGRO_COLOR swatch_centre (const float rgba[4])
 draw a swatch into a memory bitmap and read the pixel at its centre

Variables

static float changed [4] = {0.0f, 0.0f, 0.0f, 0.0f}
static int changes = 0
 how many times the picker called back, and with what
static int failures = 0
static int log_level = 3

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 15 of file ex_gui_color_picker.c.

Function Documentation

◆ click_middle()

void click_middle ( N_GUI_CTX * gui,
int window_id,
int widget_id )
static

click the middle of a widget, in display coordinates

Examples
ex_gui_color_picker.c.

Definition at line 70 of file ex_gui_color_picker.c.

References gui, N_GUI_WIDGET::h, n_gui_get_widget(), n_gui_get_window(), n_gui_process_event(), N_GUI_WINDOW::titlebar_h, N_GUI_WIDGET::w, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expect_true()

void expect_true ( const char * what,
int ok )
static

record one check

Definition at line 37 of file ex_gui_color_picker.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ main()

◆ on_change()

void on_change ( const float rgba[4],
void * user_data )
static

◆ process_args()

int process_args ( int argc,
char ** argv )
static

read -V LOGLEVEL

Definition at line 47 of file ex_gui_color_picker.c.

References log_level.

◆ swatch_centre()

ALLEGRO_COLOR swatch_centre ( const float rgba[4])
static

draw a swatch into a memory bitmap and read the pixel at its centre

Examples
ex_gui_color_picker.c.

Definition at line 89 of file ex_gui_color_picker.c.

References n_gui_draw_color_swatch().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ changed

float changed[4] = {0.0f, 0.0f, 0.0f, 0.0f}
static

◆ changes

int changes = 0
static

how many times the picker called back, and with what

Examples
ex_gui_color_picker.c, ex_gui_colorwheel.c, ex_gui_curve.c, and ex_gui_slider_default.c.

Definition at line 33 of file ex_gui_color_picker.c.

Referenced by main(), main(), on_change(), on_change(), on_change(), and on_change().

◆ failures

int failures = 0
static

Definition at line 30 of file ex_gui_color_picker.c.

◆ log_level

int log_level = 3
static

Definition at line 29 of file ex_gui_color_picker.c.