[1935] | 1 | //colors.h: |
---|
| 2 | |
---|
| 3 | /* |
---|
[5381] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2012 |
---|
[1935] | 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 |
---|
[3517] | 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
[1935] | 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 | |
---|
[1936] | 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 */ |
---|
[1939] | 49 | #define ROAR_COLOR_TYPE_B 0x00000080 /* blue or ??? */ |
---|
[1936] | 50 | #define ROAR_COLOR_TYPE_H 0x00000100 |
---|
| 51 | #define ROAR_COLOR_TYPE_S 0x00000200 |
---|
| 52 | #define ROAR_COLOR_TYPE_V 0x00000400 |
---|
[1939] | 53 | //#define ROAR_COLOR_TYPE_B 0x00000800 |
---|
[1936] | 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 | |
---|
[1941] | 62 | #define ROAR_COLORSYSTEM_NONE (ROAR_COLOR_TYPE_NONE) |
---|
[1936] | 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 | |
---|
[1937] | 73 | struct roar_color_gray { |
---|
| 74 | unsigned char k; |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | struct roar_color_rgb { |
---|
| 78 | unsigned char r, g, b; |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | struct roar_color_rgba { |
---|
| 82 | unsigned char r, g, b, a; |
---|
| 83 | }; |
---|
| 84 | |
---|
| 85 | struct roar_color_yuv { |
---|
| 86 | unsigned char y, u, v; |
---|
| 87 | }; |
---|
| 88 | |
---|
| 89 | struct roar_color_cmyk { |
---|
| 90 | unsigned char c, m, y, k; |
---|
| 91 | }; |
---|
| 92 | |
---|
| 93 | struct 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 | |
---|
[1938] | 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 | |
---|
[1941] | 106 | int roar_color_new (struct roar_color * c); |
---|
[1938] | 107 | int roar_color_new_gray (struct roar_color * c, unsigned char k); |
---|
| 108 | int roar_color_new_rgb (struct roar_color * c, unsigned char r, unsigned char g, unsigned char b); |
---|
| 109 | |
---|
| 110 | int roar_color_copy (struct roar_color * dst, struct roar_color * src); |
---|
| 111 | int roar_color_conv (struct roar_color * c, uint32_t system); |
---|
| 112 | |
---|
| 113 | int roar_color_conv_gray (struct roar_color * c, uint32_t system); |
---|
| 114 | int roar_color_conv_rgb (struct roar_color * c, uint32_t system); |
---|
| 115 | |
---|
[2602] | 116 | int roar_color_to_string (struct roar_color * c, char * str, size_t len); |
---|
| 117 | |
---|
| 118 | int roar_color_to_blob (struct roar_color * c, char * blob, size_t len); |
---|
| 119 | int roar_color_from_blob (struct roar_color * c, char * blob, size_t len); |
---|
| 120 | |
---|
[1935] | 121 | #endif |
---|
| 122 | |
---|
| 123 | //ll |
---|