chalk

kis_color_conversions.h
1/*
2 * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef _KIS_CONVERSIONS_H_
20#define _KIS_CONVERSIONS_H_
21
22#include <tqglobal.h>
23
27
28// 8-bit integer versions. RGBSL are 0-255, H is 0-360.
29 void rgb_to_hsv(int R, int G, int B, int *H, int *S, int *V);
30 void hsv_to_rgb(int H, int S, int V, int *R, int *G, int *B);
31
32// Floating point versions. RGBSL are 0-1, H is 0-360.
33 void RGBToHSV(float r, float g, float b, float *h, float *s, float *v);
34 void HSVToRGB(float h, float s, float v, float *r, float *g, float *b);
35
36 void RGBToHSL(float r, float g, float b, float *h, float *s, float *l);
37 void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b);
38
39 void rgb_to_hls(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b, float * h, float * l, float * s);
40
41 float hue_value(float n1, float n2, float hue);
42
43 void hls_to_rgb(float h, float l, float s, TQ_UINT8 * r, TQ_UINT8 * g, TQ_UINT8 * b);
44
45 void rgb_to_hls(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b, int * h, int * l, int * s);
46 void hls_to_rgb(int h, int l, int s, TQ_UINT8 * r, TQ_UINT8 * g, TQ_UINT8 * b);
47
48#endif // _KIS_CONVERSIONS_H_
49