source: roaraudio/include/libroarlight/colors.h @ 4708:c9d40761088a

Last change on this file since 4708:c9d40761088a was 4708:c9d40761088a, checked in by phi, 13 years ago

updated copyright statements

File size: 4.9 KB
Line 
1//colors.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2011
5 *
6 *  This file is part of libroar a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  libroar is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 *  NOTE for everyone want's to change something and send patches:
25 *  read README and HACKING! There a addition information on
26 *  the license of this document you need to read before you send
27 *  any patches.
28 *
29 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
30 *  or libpulse*:
31 *  The libs libroaresd, libroararts and libroarpulse link this lib
32 *  and are therefore GPL. Because of this it may be illigal to use
33 *  them with any software that uses libesd, libartsc or libpulse*.
34 */
35
36#ifndef _LIBROARLIGHT_COLORS_H_
37#define _LIBROARLIGHT_COLORS_H_
38
39#include "libroarlight.h"
40
41#define ROAR_COLOR_TYPE_NONE           0x00000000
42#define ROAR_COLOR_TYPE_GRAY           0x00000001 /* ???         */
43#define ROAR_COLOR_TYPE_ALPHA          0x00000002 /* Alpha       */
44#define ROAR_COLOR_TYPE_DOUBLE         0x00000004 /* use 16 bit per channel */
45#define ROAR_COLOR_TYPE_A              ROAR_COLOR_TYPE_ALPHA
46#define ROAR_COLOR_TYPE_K              0x00000010 /* black (Key) */
47#define ROAR_COLOR_TYPE_R              0x00000020 /* red         */
48#define ROAR_COLOR_TYPE_G              0x00000040 /* green       */
49#define ROAR_COLOR_TYPE_B              0x00000080 /* blue or ??? */
50#define ROAR_COLOR_TYPE_H              0x00000100
51#define ROAR_COLOR_TYPE_S              0x00000200
52#define ROAR_COLOR_TYPE_V              0x00000400
53//#define ROAR_COLOR_TYPE_B              0x00000800
54#define ROAR_COLOR_TYPE_L              0x00001000
55#define ROAR_COLOR_TYPE_I              0x00002000
56#define ROAR_COLOR_TYPE_C              0x00004000 /* Cyan          */
57#define ROAR_COLOR_TYPE_M              0x00008000 /* Magenta       */
58#define ROAR_COLOR_TYPE_Y              0x00010000 /* Yellow or ??? */
59#define ROAR_COLOR_TYPE_U              0x00020000
60//#define ROAR_COLOR_TYPE_              0x0100
61
62#define ROAR_COLORSYSTEM_NONE          (ROAR_COLOR_TYPE_NONE)
63#define ROAR_COLORSYSTEM_GRAY          (ROAR_COLOR_TYPE_K)
64#define ROAR_COLORSYSTEM_RGB           (ROAR_COLOR_TYPE_R|ROAR_COLOR_TYPE_G|ROAR_COLOR_TYPE_B)
65#define ROAR_COLORSYSTEM_RGBA          (ROAR_COLOR_TYPE_R|ROAR_COLOR_TYPE_G|ROAR_COLOR_TYPE_B|ROAR_COLOR_TYPE_ALPHA)
66#define ROAR_COLORSYSTEM_YUV           (ROAR_COLOR_TYPE_Y|ROAR_COLOR_TYPE_U|ROAR_COLOR_TYPE_V)
67#define ROAR_COLORSYSTEM_HSV           (ROAR_COLOR_TYPE_H|ROAR_COLOR_TYPE_S|ROAR_COLOR_TYPE_V)
68#define ROAR_COLORSYSTEM_HSL           (ROAR_COLOR_TYPE_H|ROAR_COLOR_TYPE_S|ROAR_COLOR_TYPE_L)
69#define ROAR_COLORSYSTEM_HSB           (ROAR_COLOR_TYPE_H|ROAR_COLOR_TYPE_S|ROAR_COLOR_TYPE_B)
70#define ROAR_COLORSYSTEM_HSI           (ROAR_COLOR_TYPE_H|ROAR_COLOR_TYPE_S|ROAR_COLOR_TYPE_I)
71#define ROAR_COLORSYSTEM_CMYK          (ROAR_COLOR_TYPE_C|ROAR_COLOR_TYPE_M|ROAR_COLOR_TYPE_Y|ROAR_COLOR_TYPE_K)
72
73struct roar_color_gray {
74 unsigned char k;
75};
76
77struct roar_color_rgb {
78 unsigned char r, g, b;
79};
80
81struct roar_color_rgba {
82 unsigned char r, g, b, a;
83};
84
85struct roar_color_yuv {
86 unsigned char y, u, v;
87};
88
89struct roar_color_cmyk {
90 unsigned char c, m, y, k;
91};
92
93struct roar_color {
94 uint32_t system;
95 union {
96  struct roar_color_gray   gray;
97  struct roar_color_rgb    rgb;
98  struct roar_color_rgba   rgba;
99  struct roar_color_yuv    yuv;
100  struct roar_color_cmyk   cmyk;
101 } color;
102};
103
104//#define roar_color_new_rgb(color,r,g,b) (color)->system = ROAR_COLORSYSTEM_RGB; (color)->color.rgb.r = (r); (color)->color.rgb.b = (g); (color)->color.rgb.b = (b)
105
106int roar_color_new        (struct roar_color * c);
107int roar_color_new_gray   (struct roar_color * c, unsigned char k);
108int roar_color_new_rgb    (struct roar_color * c, unsigned char r, unsigned char g, unsigned char b);
109
110int roar_color_copy       (struct roar_color * dst, struct roar_color * src);
111int roar_color_conv       (struct roar_color * c, uint32_t system);
112
113int roar_color_conv_gray  (struct roar_color * c, uint32_t system);
114int roar_color_conv_rgb   (struct roar_color * c, uint32_t system);
115
116int roar_color_to_string  (struct roar_color * c, char * str, size_t len);
117
118int roar_color_to_blob    (struct roar_color * c, char * blob, size_t len);
119int roar_color_from_blob  (struct roar_color * c, char * blob, size_t len);
120
121#endif
122
123//ll
Note: See TracBrowser for help on using the repository browser.