/* -*- Objc -*- */ /* * $Id: Color.h,v 1.1 2003/08/18 01:44:11 dam Exp $ * * Copyright (C) 2003 Free Software Foundation, Inc. * * This file is part of GNU Hégémonie. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef COLOR_H #define COLOR_H typedef struct { float red, green, blue; } color_t; static inline color_t MakeColor (float red, float green, float blue) { color_t color; color.red = red; color.green = green; color.blue = blue; return color; } static inline color_t MakeGrayColor (float gray) { return MakeColor (gray, gray, gray); } #define __DEFINE_COLOR(_name,_red,_blue,_green) \ static const color_t _name##Color __attribute__((unused)) \ = {(_red), (_blue), (_green)} __DEFINE_COLOR(white, 1.0f, 1.0f, 1.0f); __DEFINE_COLOR(black, 0.0f, 0.0f, 0.0f); __DEFINE_COLOR(red, 1.0f, 0.0f, 0.0f); __DEFINE_COLOR(green, 0.0f, 1.0f, 0.0f); __DEFINE_COLOR(blue, 0.0f, 0.0f, 1.0f); __DEFINE_COLOR(yellow, 1.0f, 1.0f, 0.0f); __DEFINE_COLOR(magenta, 1.0f, 0.0f, 1.0f); __DEFINE_COLOR(cyan, 0.0f, 1.0f, 1.0f); __DEFINE_COLOR(brown, 0.6f, 0.4f, 0.2f); __DEFINE_COLOR(darkGray, 1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f); __DEFINE_COLOR(lightGray, 2.0f/3.0f, 2.0f/3.0f, 2.0f/3.0f); __DEFINE_COLOR(orange, 1.0f, 0.5f, 0.0f); __DEFINE_COLOR(purple, 0.5f, 0.0f, 0.5f); #undef __DEFINE_COLOR #endif /* COLOR_H */