1 /* Libvisual - The audio visualisation framework. 2 * 3 * Copyright (C) 2004, 2005 Dennis Smit <ds@nerds-incorporated.org> 4 * 5 * Authors: Dennis Smit <ds@nerds-incorporated.org> 6 * 7 * $Id: 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation; either version 2.1 12 * of the License, or (at your option) any later version. 13 * 14 * This program 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 Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #ifndef _LV_PALETTE_H 25 #define _LV_PALETTE_H 26 27 #include <libvisual/lv_common.h> 28 #include <libvisual/lv_color.h> 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif /* __cplusplus */ 33 34 #define VISUAL_PALETTE(obj) (VISUAL_CHECK_CAST ((obj), 0, VisPalette)) 35 36 typedef struct _VisPalette VisPalette; 37 38 /** 39 * Data type to describe the palette for an 8 bits screen depth. 40 * 41 * To access the RGB value of a certain indexed color simply do: 42 * pal->colors[index].(r,g,b) 43 * 44 * @see visual_palette_new 45 */ 46 struct _VisPalette { 47 VisObject object; /**< The VisObject data. */ 48 int ncolors; /**< Number of color entries in palette. */ 49 VisColor *colors; /**< Pointer to the colors. */ 50 }; 51 52 VisPalette *visual_palette_new (int ncolors); 53 int visual_palette_copy (VisPalette *dest, VisPalette *src); 54 int visual_palette_allocate_colors (VisPalette *pal, int ncolors); 55 int visual_palette_free_colors (VisPalette *pal); 56 int visual_palette_blend (VisPalette *dest, VisPalette *src1, VisPalette *src2, float rate); 57 VisColor *visual_palette_color_cycle (VisPalette *pal, float rate); 58 59 #ifdef __cplusplus 60 } 61 #endif /* __cplusplus */ 62 63 #endif /* _LV_PALETTE_H */ 64