forked from mypaint/libmypaint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
helpers.h
36 lines (25 loc) · 946 Bytes
/
helpers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef HELPERS_H
#define HELPERS_H
#include <stdint.h>
#include "rng-double.h"
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define ROUND(x) ((int) ((x) + 0.5))
#define SIGN(x) ((x)>0?1:(-1))
#define SQR(x) ((x)*(x))
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define MAX3(a, b, c) ((a)>(b)?MAX((a),(c)):MAX((b),(c)))
#define MIN3(a, b, c) ((a)<(b)?MIN((a),(c)):MIN((b),(c)))
void
hsl_to_rgb_float (float *h_, float *s_, float *l_);
void
rgb_to_hsl_float (float *r_, float *g_, float *b_);
void
hsv_to_rgb_float (float *h_, float *s_, float *v_);
void
rgb_to_hsv_float (float *r_ /*h*/, float *g_ /*s*/, float *b_ /*v*/);
float rand_gauss (RngDouble * rng);
float mod_arith(float a, float N);
float smallest_angular_difference(float angleA, float angleB);
float * mix_colors(float *a, float *b, float fac, float paint_mode);
#endif // HELPERS_H