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

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static int corner_is_colour (ALLEGRO_BITMAP *bmp, int x0, int y0, int x1, int y1, unsigned char r, unsigned char g, unsigned char b)
 whether the top-left corner of a colour's bounding box (searched in a region) is that colour: 1 square, 0 rounded, -1 colour absent
static void expect_true (const char *what, int ok)
 record one check
static N_GUI_THEME flat (unsigned char r, unsigned char g, unsigned char b)
 a flat theme in one colour: fill and border alike, so a shape is one colour and its bounding box is the shape
static int is_rgb (ALLEGRO_BITMAP *bmp, int x, int y, unsigned char r, unsigned char g, unsigned char b)
 is pixel (x, y) exactly this colour?
int main (int argc, char **argv)
static int process_args (int argc, char **argv)
 parse -V LOG_LEVEL
static void run (ALLEGRO_FONT *font, int mode, const char *name)
 draw one frameless window holding a text area and a checkbox, in the given shape mode, and check each shape's corner

Variables

static int failures = 0
static int log_level = 3

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 23 of file ex_gui_round.c.

Function Documentation

◆ corner_is_colour()

int corner_is_colour ( ALLEGRO_BITMAP * bmp,
int x0,
int y0,
int x1,
int y1,
unsigned char r,
unsigned char g,
unsigned char b )
static

whether the top-left corner of a colour's bounding box (searched in a region) is that colour: 1 square, 0 rounded, -1 colour absent

Examples
ex_gui_round.c.

Definition at line 79 of file ex_gui_round.c.

References is_rgb().

Referenced by run().

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 40 of file ex_gui_round.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ flat()

N_GUI_THEME flat ( unsigned char r,
unsigned char g,
unsigned char b )
static

a flat theme in one colour: fill and border alike, so a shape is one colour and its bounding box is the shape

Definition at line 65 of file ex_gui_round.c.

References n_gui_make_theme().

Here is the call graph for this function:

◆ is_rgb()

int is_rgb ( ALLEGRO_BITMAP * bmp,
int x,
int y,
unsigned char r,
unsigned char g,
unsigned char b )
static

is pixel (x, y) exactly this colour?

Examples
ex_gui_round.c.

Definition at line 71 of file ex_gui_round.c.

Referenced by corner_is_colour().

Here is the caller graph for this function:

◆ main()

int main ( int argc,
char ** argv )

Definition at line 149 of file ex_gui_round.c.

References failures, font, LOG_ERR, log_level, N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, n_log, process_args(), run, and set_log_level().

Here is the call graph for this function:

◆ process_args()

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

parse -V LOG_LEVEL

Definition at line 50 of file ex_gui_round.c.

References log_level.

◆ run()

void run ( ALLEGRO_FONT * font,
int mode,
const char * name )
static

draw one frameless window holding a text area and a checkbox, in the given shape mode, and check each shape's corner

Definition at line 97 of file ex_gui_round.c.

References corner_is_colour(), expect_true(), flat(), font, gui, mode, n_gui_add_checkbox(), n_gui_add_textarea(), n_gui_add_window(), n_gui_destroy_ctx(), n_gui_draw(), n_gui_new_ctx(), n_gui_set_default_theme(), n_gui_set_display_size(), n_gui_set_shape_mode(), n_gui_set_widget_theme(), N_GUI_SHAPE_ROUNDED, N_GUI_WIN_FIXED_POSITION, N_GUI_WIN_FRAMELESS, and n_gui_window_set_flags().

Here is the call graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Definition at line 37 of file ex_gui_round.c.

◆ log_level

int log_level = 3
static

Definition at line 36 of file ex_gui_round.c.