Debian Codegraph @

lib/edgepaint/lab.h

raw
1 /*************************************************************************
2 * Copyright (c) 2014 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11 #pragma once
12
13 struct rgb_struct {
14 double r, g, b;/* 0 to 255 */
15 };
16 typedef struct rgb_struct color_rgb;
17
18 struct xyz_struct {
19 double x, y, z;
20 };
21 typedef struct xyz_struct color_xyz;
22
23 struct lab_struct {
24 double l, a, b; ///< l: 0 to 100, a,b: -128 to 128
25 };
26 typedef struct lab_struct color_lab;
27
28 color_xyz RGB2XYZ(color_rgb color);
29 color_rgb XYZ2RGB(color_xyz color);
30 color_lab RGB2LAB(color_rgb color);
31 void LAB2RGB_real_01(double *color); /* convert an array[3] of LAB colors to RGB between 0 to 1, in place */
32 color_rgb LAB2RGB(color_lab color);
33 color_rgb color_rgb_init(double r, double g, double b);
34 color_xyz color_xyz_init(double x, double y, double z);
35 color_lab color_lab_init(double l, double a, double b);
36 QuadTree lab_gamut_quadtree(
37 const int *lightness,
38 int max_qtree_level); ///< construct a quadtree of the LAB gamut points
39 double *lab_gamut(const int *lightness,
40 int *n); ///< give a list of n points in the file defining
41 ///< the LAB color gamut
42
43 /** derive around maxpoints from a color list
44 *
45 * \param color_list List of the form "#ff0000,#00ff00,..."
46 * \param maxpoints Maximum number of points to return
47 * \return An array of size [maxpoints*3] of the form {{l,a,b},...}
48 */
49 double *color_blend_rgb2lab(const char *color_list, const int maxpoints);