00001 /* 00002 * This file is part of liberscribble. 00003 * 00004 * liberscribble 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 * liberscribble 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, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00023 #ifndef SCBCOLOR_H_ 00024 #define SCBCOLOR_H_ 00025 00027 // scribble library color definition 00029 00030 #ifdef __cplusplus 00031 extern "C" 00032 { 00033 #endif 00034 00035 // color used in iLiad device. serves as input paramter 00036 typedef enum _ScbDevColor 00037 { 00038 SCB_DEV_COLOR_WHITE = 0, 00039 SCB_DEV_COLOR_LIGHT_GRAY = 1, 00040 SCB_DEV_COLOR_DARK_GRAY = 2, 00041 SCB_DEV_COLOR_BLACK = 3, 00042 SCB_DEV_COLOR_UNKNOWN = 0xffffffff 00043 }ScbDevColor; 00044 00045 // color struct here is similar to color used in X11 and GDK 00046 // ScbColor is a output parameter 00047 typedef struct _ScbColor 00048 { 00049 unsigned long pixel; 00050 unsigned short red; 00051 unsigned short green; 00052 unsigned short blue; 00053 char flags; /* DoRed, DoGreen, DoBlue */ 00054 char pad; 00055 }ScbColor; 00056 typedef ScbColor * ScbColorPtr; 00057 00058 // generic color 00059 void scb_color_set_white(ScbColorPtr ptr); 00060 void scb_color_set_black(ScbColorPtr ptr); 00061 void scb_color_set_light_gray(ScbColorPtr ptr); 00062 void scb_color_set_dark_gray(ScbColorPtr ptr); 00063 00064 // convert color to html color and dev color 00065 const char * scb_color_to_html_color(const ScbColorPtr ptr); 00066 ScbDevColor scb_color_to_dev_color(ScbColorPtr ptr); 00067 00068 // convert html color to color and dev color 00069 int scb_html_color_to_color(const char * buf, const int length, ScbColorPtr ptr); 00070 ScbDevColor scb_html_color_to_dev_color(const char *buf, const int length); 00071 00072 // convert dev color to color and html color 00073 void scb_dev_color_to_color(ScbColorPtr ptr, const ScbDevColor color); 00074 const char * scb_dev_color_to_html_color(const ScbDevColor color); 00075 00076 #ifdef __cplusplus 00077 } 00078 #endif 00079 00080 #endif
1.5.6