krita

kis_color_conversions.h

00001 /*
00002  *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef _KIS_CONVERSIONS_H_
00020 #define _KIS_CONVERSIONS_H_
00021 
00022 #include <qglobal.h>
00023 
00028 // 8-bit integer versions. RGBSL are 0-255, H is 0-360.
00029  void rgb_to_hsv(int R, int G, int B, int *H, int *S, int *V);
00030  void hsv_to_rgb(int H, int S, int V, int *R, int *G, int *B);
00031 
00032 // Floating point versions. RGBSL are 0-1, H is 0-360.
00033  void RGBToHSV(float r, float g, float b, float *h, float *s, float *v);
00034  void HSVToRGB(float h, float s, float v, float *r, float *g, float *b);
00035 
00036  void RGBToHSL(float r, float g, float b, float *h, float *s, float *l);
00037  void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b);
00038 
00039  void rgb_to_hls(Q_UINT8 r, Q_UINT8 g, Q_UINT8 b, float * h, float * l, float * s);
00040 
00041  float hue_value(float n1, float n2, float hue);
00042 
00043  void hls_to_rgb(float h, float l, float s, Q_UINT8 * r, Q_UINT8 * g, Q_UINT8 * b);
00044 
00045  void rgb_to_hls(Q_UINT8 r, Q_UINT8 g, Q_UINT8 b, int * h, int * l, int * s);
00046  void hls_to_rgb(int h, int l, int s, Q_UINT8 * r, Q_UINT8 * g, Q_UINT8 * b);
00047 
00048 #endif // _KIS_CONVERSIONS_H_
00049 
KDE Home | KDE Accessibility Home | Description of Access Keys