1
/* $Id: rgb.c,v 1.1 2006/01/30 05:47:38 reinelt Exp $
3
* generic color handling
5
* Copyright (C) 2005 Michael Reinelt <reinelt@eunet.at>
6
* Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
8
* This file is part of LCD4Linux.
10
* LCD4Linux is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2, or (at your option)
15
* LCD4Linux is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
* Revision 1.1 2006/01/30 05:47:38 reinelt
27
* graphic subsystem changed to full-color RGBA
38
int color2RGBA(const char *color, RGBA * C)
43
if (color == NULL || *color == '\0') {
47
l = strtoul(color, &e, 16);
48
if (e != NULL && *e != '\0') {
52
if (strlen(color) == 8) {
54
C->R = (l >> 24) & 0xff;
55
C->G = (l >> 16) & 0xff;
56
C->B = (l >> 8) & 0xff;
57
C->A = (l >> 0) & 0xff;
60
C->R = (l >> 16) & 0xff;
61
C->G = (l >> 8) & 0xff;