color: Add named, global colors
Since EGA colors are apparently all the rage in other toolkits, Clutter should not be left out. On top of the usual CGA/EGA palette the static colors also include the Tango Icon palette, which at least is more pleasant to the eye. Static colors are accessed through an enumeration by using clutter_color_get_static(), or using the short-hand pre-processor macros. http://bugzilla.clutter-project.org/show_bug.cgi?id=2066
This commit is contained in:
parent
6735f80b4b
commit
985518c601
@ -86,6 +86,7 @@ source_h = \
|
||||
$(srcdir)/clutter-child-meta.h \
|
||||
$(srcdir)/clutter-click-action.h \
|
||||
$(srcdir)/clutter-clone.h \
|
||||
$(srcdir)/clutter-color-static.h \
|
||||
$(srcdir)/clutter-color.h \
|
||||
$(srcdir)/clutter-colorize-effect.h \
|
||||
$(srcdir)/clutter-constraint.h \
|
||||
|
77
clutter/clutter-color-static.h
Normal file
77
clutter/clutter-color-static.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_COLOR_STATIC_H__
|
||||
#define __CLUTTER_COLOR_STATIC_H__
|
||||
|
||||
#define CLUTTER_COLOR_White (clutter_color_get_static (CLUTTER_COLOR_WHITE))
|
||||
#define CLUTTER_COLOR_Black (clutter_color_get_static (CLUTTER_COLOR_BLACK))
|
||||
#define CLUTTER_COLOR_Red (clutter_color_get_static (CLUTTER_COLOR_RED))
|
||||
#define CLUTTER_COLOR_DarkRed (clutter_color_get_static (CLUTTER_COLOR_DARK_RED))
|
||||
#define CLUTTER_COLOR_Green (clutter_color_get_static (CLUTTER_COLOR_GREEN))
|
||||
#define CLUTTER_COLOR_DarkGreen (clutter_color_get_static (CLUTTER_COLOR_DARK_GREEN))
|
||||
#define CLUTTER_COLOR_Blue (clutter_color_get_static (CLUTTER_COLOR_BLUE))
|
||||
#define CLUTTER_COLOR_DarkBlue (clutter_color_get_static (CLUTTER_COLOR_DARK_BLUE))
|
||||
#define CLUTTER_COLOR_Cyan (clutter_color_get_static (CLUTTER_COLOR_CYAN))
|
||||
#define CLUTTER_COLOR_DarkCyan (clutter_color_get_static (CLUTTER_COLOR_DARK_CYAN))
|
||||
#define CLUTTER_COLOR_Magenta (clutter_color_get_static (CLUTTER_COLOR_MAGENTA))
|
||||
#define CLUTTER_COLOR_DarkMagenta (clutter_color_get_static (CLUTTER_COLOR_DARK_MAGENTA))
|
||||
#define CLUTTER_COLOR_Yellow (clutter_color_get_static (CLUTTER_COLOR_YELLOW))
|
||||
#define CLUTTER_COLOR_DarkYellow (clutter_color_get_static (CLUTTER_COLOR_DARK_YELLOW))
|
||||
#define CLUTTER_COLOR_Gray (clutter_color_get_static (CLUTTER_COLOR_GRAY))
|
||||
#define CLUTTER_COLOR_DarkGray (clutter_color_get_static (CLUTTER_COLOR_DARK_GRAY))
|
||||
#define CLUTTER_COLOR_LightGray (clutter_color_get_static (CLUTTER_COLOR_LIGHT_GRAY))
|
||||
|
||||
#define CLUTTER_COLOR_Butter (clutter_color_get_static (CLUTTER_COLOR_BUTTER))
|
||||
#define CLUTTER_COLOR_LightButter (clutter_color_get_static (CLUTTER_COLOR_BUTTER_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkButter (clutter_color_get_static (CLUTTER_COLOR_BUTTER_DARK))
|
||||
#define CLUTTER_COLOR_Orange (clutter_color_get_static (CLUTTER_COLOR_ORANGE))
|
||||
#define CLUTTER_COLOR_LightOrange (clutter_color_get_static (CLUTTER_COLOR_ORANGE_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkOrange (clutter_color_get_static (CLUTTER_COLOR_ORANGE_DARK))
|
||||
#define CLUTTER_COLOR_Chocolate (clutter_color_get_static (CLUTTER_COLOR_CHOCOLATE))
|
||||
#define CLUTTER_COLOR_LightChocolate (clutter_color_get_static (CLUTTER_COLOR_CHOCOLATE_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkChocolate (clutter_color_get_static (CLUTTER_COLOR_CHOCOLATE_DARK))
|
||||
#define CLUTTER_COLOR_Chameleon (clutter_color_get_static (CLUTTER_COLOR_CHAMELEON))
|
||||
#define CLUTTER_COLOR_LightChameleon (clutter_color_get_static (CLUTTER_COLOR_CHAMELEON_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkChameleon (clutter_color_get_static (CLUTTER_COLOR_CHAMELEON_DARK))
|
||||
#define CLUTTER_COLOR_SkyBlue (clutter_color_get_static (CLUTTER_COLOR_SKY_BLUE))
|
||||
#define CLUTTER_COLOR_LightSkyBlue (clutter_color_get_static (CLUTTER_COLOR_SKY_BLUE_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkSkyBlue (clutter_color_get_static (CLUTTER_COLOR_SKY_BLUE_DARK))
|
||||
#define CLUTTER_COLOR_Plum (clutter_color_get_static (CLUTTER_COLOR_PLUM))
|
||||
#define CLUTTER_COLOR_LightPlum (clutter_color_get_static (CLUTTER_COLOR_PLUM_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkPlum (clutter_color_get_static (CLUTTER_COLOR_PLUM_DARK))
|
||||
#define CLUTTER_COLOR_ScarletRed (clutter_color_get_static (CLUTTER_COLOR_SCARLET_RED))
|
||||
#define CLUTTER_COLOR_LightScarletRed (clutter_color_get_static (CLUTTER_COLOR_SCARLET_RED_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkScarletRed (clutter_color_get_static (CLUTTER_COLOR_SCARLET_RED_DARK))
|
||||
#define CLUTTER_COLOR_Aluminium1 (clutter_color_get_static (CLUTTER_COLOR_ALUMINIUM_1))
|
||||
#define CLUTTER_COLOR_Aluminium2 (clutter_color_get_static (CLUTTER_COLOR_ALUMINIUM_2))
|
||||
#define CLUTTER_COLOR_Aluminium3 (clutter_color_get_static (CLUTTER_COLOR_ALUMINIUM_3))
|
||||
#define CLUTTER_COLOR_Aluminium4 (clutter_color_get_static (CLUTTER_COLOR_ALUMINIUM_4))
|
||||
#define CLUTTER_COLOR_Aluminium5 (clutter_color_get_static (CLUTTER_COLOR_ALUMINIUM_5))
|
||||
#define CLUTTER_COLOR_Aluminium6 (clutter_color_get_static (CLUTTER_COLOR_ALUMINIUM_6))
|
||||
|
||||
#define CLUTTER_COLOR_Transparent (clutter_color_get_static (CLUTTER_COLOR_TRANSPARENT))
|
||||
|
||||
#endif /* __CLUTTER_COLOR_STATIC_H__ */
|
@ -47,6 +47,83 @@
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
/* XXX - keep in sync with the ClutterStaticColor enumeration order */
|
||||
static const ClutterColor const static_colors[] = {
|
||||
/* CGA/EGA color palette */
|
||||
{ 0xff, 0xff, 0xff, 0xff }, /* white */
|
||||
{ 0x00, 0x00, 0x00, 0xff }, /* black */
|
||||
{ 0xff, 0x00, 0x00, 0xff }, /* red */
|
||||
{ 0x80, 0x00, 0x00, 0xff }, /* dark red */
|
||||
{ 0x00, 0xff, 0x00, 0xff }, /* green */
|
||||
{ 0x00, 0x80, 0x00, 0xff }, /* dark green */
|
||||
{ 0x00, 0x00, 0xff, 0xff }, /* blue */
|
||||
{ 0x00, 0x00, 0x80, 0xff }, /* dark blue */
|
||||
{ 0x00, 0xff, 0xff, 0xff }, /* cyan */
|
||||
{ 0x00, 0x80, 0x80, 0xff }, /* dark cyan */
|
||||
{ 0xff, 0x00, 0xff, 0xff }, /* magenta */
|
||||
{ 0x80, 0x00, 0x80, 0xff }, /* dark magenta */
|
||||
{ 0xff, 0xff, 0x00, 0xff }, /* yellow */
|
||||
{ 0x80, 0x80, 0x00, 0xff }, /* dark yellow */
|
||||
{ 0xa0, 0xa0, 0xa4, 0xff }, /* gray */
|
||||
{ 0x80, 0x80, 0x80, 0xff }, /* dark gray */
|
||||
{ 0xc0, 0xc0, 0xc0, 0xff }, /* light gray */
|
||||
|
||||
/* Tango Icon color palette */
|
||||
{ 0xed, 0xd4, 0x00, 0xff }, /* butter */
|
||||
{ 0xfc, 0xe9, 0x4f, 0xff }, /* butter light */
|
||||
{ 0xc4, 0xa0, 0x00, 0xff }, /* butter dark */
|
||||
{ 0xf5, 0x79, 0x00, 0xff }, /* orange */
|
||||
{ 0xfc, 0xaf, 0x3e, 0xff }, /* orange light */
|
||||
{ 0xce, 0x5c, 0x00, 0xff }, /* orange dark */
|
||||
{ 0xc1, 0x7d, 0x11, 0xff }, /* chocolate */
|
||||
{ 0xe9, 0xb9, 0x6e, 0xff }, /* chocolate light */
|
||||
{ 0x8f, 0x59, 0x02, 0xff }, /* chocolate dark */
|
||||
{ 0x73, 0xd2, 0x16, 0xff }, /* chameleon */
|
||||
{ 0x8a, 0xe2, 0x34, 0xff }, /* chameleon light */
|
||||
{ 0x4e, 0x9a, 0x06, 0xff }, /* chameleon dark */
|
||||
{ 0x34, 0x65, 0xa4, 0xff }, /* sky blue */
|
||||
{ 0x72, 0x9f, 0xcf, 0xff }, /* sky blue light */
|
||||
{ 0x20, 0x4a, 0x87, 0xff }, /* sky blue dark */
|
||||
{ 0x75, 0x50, 0x7b, 0xff }, /* plum */
|
||||
{ 0xad, 0x7f, 0xa8, 0xff }, /* plum light */
|
||||
{ 0x5c, 0x35, 0x66, 0xff }, /* plum dark */
|
||||
{ 0xcc, 0x00, 0x00, 0xff }, /* scarlet red */
|
||||
{ 0xef, 0x29, 0x29, 0xff }, /* scarlet red light */
|
||||
{ 0xa4, 0x00, 0x00, 0xff }, /* scarlet red dark */
|
||||
{ 0xee, 0xee, 0xec, 0xff }, /* aluminium 1 */
|
||||
{ 0xd3, 0xd7, 0xcf, 0xff }, /* aluminium 2 */
|
||||
{ 0xba, 0xbd, 0xb6, 0xff }, /* aluminium 3 */
|
||||
{ 0x88, 0x8a, 0x85, 0xff }, /* aluminium 4 */
|
||||
{ 0x55, 0x57, 0x53, 0xff }, /* aluminium 5 */
|
||||
{ 0x2e, 0x34, 0x36, 0xff }, /* aluminium 6 */
|
||||
|
||||
/* last color */
|
||||
{ 0x00, 0x00, 0x00, 0x00 } /* transparent */
|
||||
};
|
||||
|
||||
/**
|
||||
* clutter_color_get_static:
|
||||
* @color: the named global color
|
||||
*
|
||||
* Retrieves a static color for the given @color name
|
||||
*
|
||||
* Static colors are created by Clutter and are guaranteed to always be
|
||||
* available and valid
|
||||
*
|
||||
* Return value: a pointer to a static color; the returned pointer
|
||||
* is owned by Clutter and it should never be modified or freed
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
G_CONST_RETURN ClutterColor *
|
||||
clutter_color_get_static (ClutterStaticColor color)
|
||||
{
|
||||
g_return_val_if_fail (color >= CLUTTER_COLOR_WHITE &&
|
||||
color <= CLUTTER_COLOR_TRANSPARENT, NULL);
|
||||
|
||||
return &static_colors[color];
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_add:
|
||||
* @a: a #ClutterColor
|
||||
|
@ -152,6 +152,113 @@ GParamSpec *clutter_param_spec_color (const gchar *name,
|
||||
const ClutterColor *default_value,
|
||||
GParamFlags flags);
|
||||
|
||||
/**
|
||||
* ClutterStaticColor:
|
||||
* @CLUTTER_COLOR_WHITE: White color (#ffffffff)
|
||||
* @CLUTTER_COLOR_BLACK: Black color (#000000ff)
|
||||
* @CLUTTER_COLOR_RED: Red color (#ff0000ff)
|
||||
* @CLUTTER_COLOR_DARK_RED: Dark red color (#800000ff)
|
||||
* @CLUTTER_COLOR_GREEN: Green color (#00ff00ff)
|
||||
* @CLUTTER_COLOR_DARK_GREEN: Dark green color (#008000ff)
|
||||
* @CLUTTER_COLOR_BLUE: Blue color (#0000ffff)
|
||||
* @CLUTTER_COLOR_DARK_BLUE: Dark blue color (#000080ff)
|
||||
* @CLUTTER_COLOR_CYAN: Cyan color (#00ffffff)
|
||||
* @CLUTTER_COLOR_DARK_CYAN: Dark cyan color (#008080ff)
|
||||
* @CLUTTER_COLOR_MAGENTA: Magenta color (#ff00ffff)
|
||||
* @CLUTTER_COLOR_DARK_MAGENTA: Dark magenta color (#800080ff)
|
||||
* @CLUTTER_COLOR_YELLOW: Yellow color (#ffff00ff)
|
||||
* @CLUTTER_COLOR_DARK_YELLOW: Dark yellow color (#808000ff)
|
||||
* @CLUTTER_COLOR_GRAY: Gray color (#a0a0a4ff)
|
||||
* @CLUTTER_COLOR_DARK_GRAY: Dark Gray color (#808080ff)
|
||||
* @CLUTTER_COLOR_LIGHT_GRAY: Light gray color (#c0c0c0ff)
|
||||
* @CLUTTER_COLOR_BUTTER: Butter color (#edd400)
|
||||
* @CLUTTER_COLOR_BUTTER_LIGHT: Light butter color (#fce94f)
|
||||
* @CLUTTER_COLOR_BUTTER_DARK: Dark butter color (#c4a000)
|
||||
* @CLUTTER_COLOR_ORANGE: Orange color (#f57900)
|
||||
* @CLUTTER_COLOR_ORANGE_LIGHT: Light orange color (#fcaf3f)
|
||||
* @CLUTTER_COLOR_ORANGE_DARK: Dark orange color (#ce5c00)
|
||||
* @CLUTTER_COLOR_CHOCOLATE: Chocolate color (#c17d11)
|
||||
* @CLUTTER_COLOR_CHOCOLATE_LIGHT: Light chocolate color (#e9b96e)
|
||||
* @CLUTTER_COLOR_CHOCOLATE_DARK: Dark chocolate color (#8f5902)
|
||||
* @CLUTTER_COLOR_CHAMELEON: Chameleon color (#73d216)
|
||||
* @CLUTTER_COLOR_CHAMELEON_LIGHT: Light chameleon color (#8ae234)
|
||||
* @CLUTTER_COLOR_CHAMELEON_DARK: Dark chameleon color (#4e9a06)
|
||||
* @CLUTTER_COLOR_SKY_BLUE: Sky color (#3465a4)
|
||||
* @CLUTTER_COLOR_SKY_BLUE_LIGHT: Light sky color (#729fcf)
|
||||
* @CLUTTER_COLOR_SKY_BLUE_DARK: Dark sky color (#204a87)
|
||||
* @CLUTTER_COLOR_PLUM: Plum color (#75507b)
|
||||
* @CLUTTER_COLOR_PLUM_LIGHT: Light plum color (#ad7fa8)
|
||||
* @CLUTTER_COLOR_PLUM_DARK: Dark plum color (#5c3566)
|
||||
* @CLUTTER_COLOR_SCARLET_RED: Scarlet red color (#cc0000)
|
||||
* @CLUTTER_COLOR_SCARLET_RED_LIGHT: Light scarlet red color (#ef2929)
|
||||
* @CLUTTER_COLOR_SCARLET_RED_DARK: Dark scarlet red color (#a40000)
|
||||
* @CLUTTER_COLOR_ALUMINIUM_1: Aluminium, first variant (#eeeeec)
|
||||
* @CLUTTER_COLOR_ALUMINIUM_2: Aluminium, second variant (#d3d7cf)
|
||||
* @CLUTTER_COLOR_ALUMINIUM_3: Aluminium, third variant (#babdb6)
|
||||
* @CLUTTER_COLOR_ALUMINIUM_4: Aluminium, fourth variant (#888a85)
|
||||
* @CLUTTER_COLOR_ALUMINIUM_5: Aluminium, fifth variant (#555753)
|
||||
* @CLUTTER_COLOR_ALUMINIUM_6: Aluminium, sixth variant (#2e3436)
|
||||
* @CLUTTER_COLOR_TRANSPARENT: Transparent color (#00000000)
|
||||
*
|
||||
* Named colors, for accessing global colors defined by Clutter
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef enum { /*< prefix=CLUTTER_COLOR >*/
|
||||
/* CGA/EGA-like palette */
|
||||
CLUTTER_COLOR_WHITE = 0,
|
||||
CLUTTER_COLOR_BLACK,
|
||||
CLUTTER_COLOR_RED,
|
||||
CLUTTER_COLOR_DARK_RED,
|
||||
CLUTTER_COLOR_GREEN,
|
||||
CLUTTER_COLOR_DARK_GREEN,
|
||||
CLUTTER_COLOR_BLUE,
|
||||
CLUTTER_COLOR_DARK_BLUE,
|
||||
CLUTTER_COLOR_CYAN,
|
||||
CLUTTER_COLOR_DARK_CYAN,
|
||||
CLUTTER_COLOR_MAGENTA,
|
||||
CLUTTER_COLOR_DARK_MAGENTA,
|
||||
CLUTTER_COLOR_YELLOW,
|
||||
CLUTTER_COLOR_DARK_YELLOW,
|
||||
CLUTTER_COLOR_GRAY,
|
||||
CLUTTER_COLOR_DARK_GRAY,
|
||||
CLUTTER_COLOR_LIGHT_GRAY,
|
||||
|
||||
/* Tango icon palette */
|
||||
CLUTTER_COLOR_BUTTER,
|
||||
CLUTTER_COLOR_BUTTER_LIGHT,
|
||||
CLUTTER_COLOR_BUTTER_DARK,
|
||||
CLUTTER_COLOR_ORANGE,
|
||||
CLUTTER_COLOR_ORANGE_LIGHT,
|
||||
CLUTTER_COLOR_ORANGE_DARK,
|
||||
CLUTTER_COLOR_CHOCOLATE,
|
||||
CLUTTER_COLOR_CHOCOLATE_LIGHT,
|
||||
CLUTTER_COLOR_CHOCOLATE_DARK,
|
||||
CLUTTER_COLOR_CHAMELEON,
|
||||
CLUTTER_COLOR_CHAMELEON_LIGHT,
|
||||
CLUTTER_COLOR_CHAMELEON_DARK,
|
||||
CLUTTER_COLOR_SKY_BLUE,
|
||||
CLUTTER_COLOR_SKY_BLUE_LIGHT,
|
||||
CLUTTER_COLOR_SKY_BLUE_DARK,
|
||||
CLUTTER_COLOR_PLUM,
|
||||
CLUTTER_COLOR_PLUM_LIGHT,
|
||||
CLUTTER_COLOR_PLUM_DARK,
|
||||
CLUTTER_COLOR_SCARLET_RED,
|
||||
CLUTTER_COLOR_SCARLET_RED_LIGHT,
|
||||
CLUTTER_COLOR_SCARLET_RED_DARK,
|
||||
CLUTTER_COLOR_ALUMINIUM_1,
|
||||
CLUTTER_COLOR_ALUMINIUM_2,
|
||||
CLUTTER_COLOR_ALUMINIUM_3,
|
||||
CLUTTER_COLOR_ALUMINIUM_4,
|
||||
CLUTTER_COLOR_ALUMINIUM_5,
|
||||
CLUTTER_COLOR_ALUMINIUM_6,
|
||||
|
||||
/* Fully transparent black */
|
||||
CLUTTER_COLOR_TRANSPARENT
|
||||
} ClutterStaticColor;
|
||||
|
||||
G_CONST_RETURN ClutterColor *clutter_color_get_static (ClutterStaticColor color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_COLOR_H__ */
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "clutter-click-action.h"
|
||||
#include "clutter-clone.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-color-static.h"
|
||||
#include "clutter-colorize-effect.h"
|
||||
#include "clutter-constraint.h"
|
||||
#include "clutter-container.h"
|
||||
|
@ -69,6 +69,7 @@ IGNORE_HFILES=\
|
||||
clutter-actor-private.h \
|
||||
clutter-backend-private.h \
|
||||
clutter-bezier.h \
|
||||
clutter-color-static.h \
|
||||
clutter-debug.h \
|
||||
clutter-deprecated.h \
|
||||
clutter-device-manager-private.h \
|
||||
|
@ -960,6 +960,8 @@ clutter_color_copy
|
||||
clutter_color_free
|
||||
clutter_color_equal
|
||||
clutter_color_hash
|
||||
ClutterStaticColor
|
||||
clutter_color_get_static
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_color_from_string
|
||||
|
Loading…
Reference in New Issue
Block a user