File: ColorTable.h

package info (click to toggle)
gmsh 4.8.4%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 87,812 kB
  • sloc: cpp: 378,014; ansic: 99,669; yacc: 7,216; python: 6,680; java: 3,486; lisp: 659; lex: 621; perl: 571; makefile: 470; sh: 440; xml: 415; javascript: 113; pascal: 35; modula3: 32
file content (56 lines) | stat: -rw-r--r-- 1,749 bytes parent folder | download
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
// Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.

#ifndef COLORTABLE_H
#define COLORTABLE_H

#include <stdio.h>
#include <vector>
#include <string>

#define COLORTABLE_NBMAX_PARAM 10
#define COLORTABLE_NBMAX_COLOR 1024

typedef struct {
  unsigned int table[COLORTABLE_NBMAX_COLOR];
  int size; // must be >= 2
  int ipar[COLORTABLE_NBMAX_PARAM];
  double dpar[COLORTABLE_NBMAX_PARAM];
} GmshColorTable;

// COLORTABLE_MODE

#define COLORTABLE_RGB 1
#define COLORTABLE_HSV 2

// integer parameters indices

#define COLORTABLE_NUMBER 0 // predefined curve index
#define COLORTABLE_INVERT 1 // invert (rbg<->255-rgb)
#define COLORTABLE_SWAP 2 // swap (min<->max)
#define COLORTABLE_ROTATION 3 // rotation
#define COLORTABLE_MODE 4 // mode (rgb, hsv)

// double parameters indices

#define COLORTABLE_CURVATURE 0 // curvature
#define COLORTABLE_BIAS 1 // offset
#define COLORTABLE_ALPHA 2 // alpha channel value
#define COLORTABLE_BETA 3 // beta coeff for brighten
#define COLORTABLE_ALPHAPOW 4 // alpha channel power value

void ColorTable_InitParam(int number, GmshColorTable *ct);
void ColorTable_Recompute(GmshColorTable *ct);
void ColorTable_Copy(GmshColorTable *ct);
void ColorTable_Paste(GmshColorTable *ct);
void ColorTable_Print(GmshColorTable *ct, FILE *fp,
                      std::vector<std::string> *vec = nullptr);
int ColorTable_IsAlpha(GmshColorTable *ct);
int ColorTable_Diff(GmshColorTable *ct1, GmshColorTable *ct2);

void RGB_to_HSV(double R, double G, double B, double *H, double *S, double *V);
void HSV_to_RGB(double H, double S, double V, double *R, double *G, double *B);

#endif