-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathgetcolor.h
More file actions
62 lines (45 loc) · 1.8 KB
/
getcolor.h
File metadata and controls
62 lines (45 loc) · 1.8 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* GNUPLOT - getcolor.h */
/* Routines + constants for mapping interval [0,1] into another [0,1] to be
* used to get RGB triplets from gray (palette of smooth colours).
*
* Note: The code in getcolor.h,.c cannot be inside color.h,.c since gplt_x11.c
* compiles with getcolor.o, so it cannot load the other huge staff.
*
*/
/*[
*
* Petr Mikulik, since December 1998
* Copyright: open source as much as possible
*
]*/
#ifndef GETCOLOR_H
#define GETCOLOR_H
#include "syscfg.h"
#include "color.h"
enum color_models_id {
C_MODEL_RGB = 'r',
C_MODEL_HSV = 'h',
C_MODEL_CMY = 'c'
};
/* main gray --> rgb color mapping */
void rgb1_from_gray( double gray, rgb_color *color );
void rgb255_from_rgb1( rgb_color rgb1, rgb255_color *rgb255 );
/* main gray --> rgb color mapping as above, with take care of palette maxcolors */
void rgb1maxcolors_from_gray( double gray, rgb_color *color );
void rgb255maxcolors_from_gray( double gray, rgb255_color *rgb255 );
double quantize_gray( double gray );
/* HSV --> RGB user-visible function hsv2rgb(h,s,v) */
unsigned int hsv2rgb( rgb_color *color );
/* used to (de-)serialize color/gradient information */
char *gradient_entry_to_str( gradient_struct *gs );
void str_to_gradient_entry( char *s, gradient_struct *gs );
/* check if two palettes p1 and p2 differ */
int palettes_differ( t_sm_palette *p1, t_sm_palette *p2 );
/* construct minimal gradient to approximate palette */
gradient_struct *approximate_palette( t_sm_palette *palette, int maxsamples, double allowed_deviation, int *gradient_num );
double GetColorValueFromFormula(int formula, double x);
extern const char *ps_math_color_formulae[];
/* use gray value to find index of corresponding segment in discrete gradient palette */
int index_from_gray (double gray);
#endif /* GETCOLOR_H */
/* eof getcolor.h */