Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-stub/colors.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
colors.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "mem.h"
20
21/* common */
22#include "rgbcolor.h"
23
24/* gui main header */
25#include "gui_stub.h"
26
27#include "colors.h"
28
29/************************************************************************/
33 struct color *gui_color_alloc(int r, int g, int b)
34{
35 struct color *color = fc_malloc(sizeof(*color));
36
37 /* PORTME */
38 color->r = r;
39 color->g = g;
40 color->b = b;
41
42 return color;
43}
44
45/************************************************************************/
48 void gui_color_free(struct color *color)
49{
50 /* PORTME */
51 free(color);
52}
53
54/************************************************************************/
58 int color_brightness_score(struct color *pcolor)
59{
60 /* PORTME */
61 /* Can use GUI-specific colorspace functions here. This is a fallback
62 * using platform-independent code */
63 struct rgbcolor *prgb = rgbcolor_new(pcolor->r, pcolor->g, pcolor->b);
64 int score = rgbcolor_brightness_score(prgb);
65
66 rgbcolor_destroy(prgb);
67 return score;
68}
pcolor
struct canvas int int int int struct sprite *sprite struct canvas struct color * pcolor
Definition canvas_g.h:56
incite_cost
char * incite_cost
Definition comments.c:74
color_brightness_score
int color_brightness_score(struct color *pcolor)
Definition colors.c:62
gui_color_alloc
struct color * gui_color_alloc(int r, int g, int b)
Definition colors.c:33
gui_color_free
void gui_color_free(struct color *color)
Definition colors.c:48
colors.h
gui_stub.h
mem.h
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
rgbcolor_destroy
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
Definition rgbcolor.c:74
rgbcolor_new
struct rgbcolor * rgbcolor_new(int r, int g, int b)
Definition rgbcolor.c:34
rgbcolor_brightness_score
int rgbcolor_brightness_score(struct rgbcolor *prgbcolor)
Definition rgbcolor.c:196
rgbcolor.h
color
Definition colors.h:21
color::g
int g
Definition colors.h:21
color::color
GdkRGBA color
Definition colors.h:22
color::r
int r
Definition colors.h:21
color::b
int b
Definition colors.h:21
rgbcolor
Definition rgbcolor.h:33