Move gfxmenu color handling to video, so that gfxterm can use it
too. * grub-core/gfxmenu/named_colors.c: Move to ... * grub-core/video/colors.c: ... here. Rename grub_gui_get_named_color to grub_video_get_named_color. * grub-core/gfxmenu/gui_string_util.c (my_isxdigit): Move to ... * grub-core/video/colors.c (my_isxdigit): ... here. * grub-core/gfxmenu/gui_string_util.c (parse_hex_color_component): Move to ... * grub-core/video/colors.c (parse_hex_color_component): ... here. * grub-core/gfxmenu/gui_string_util.c (grub_gui_parse_color): Move to ... * grub-core/video/colors.c (grub_video_parse_color): ... here. * include/grub/gui.h (grub_gui_color_t): Move to ... * include/grub/video.h (grub_video_rgba_color_t): ... here. * include/grub/gui.h (grub_gui_color_rgb): Move to ... * include/grub/video.h (grub_video_rgba_color_rgb): ... here. * include/grub/gui.h (grub_gui_map_color): Move to ... * include/grub/video.h (grub_video_map_rgba_color): ... here. * include/grub/gui_string_util.h (grub_gui_get_named_color): Move to ... * include/grub/video.h (grub_video_get_named_color): ... here. * include/grub/gui_string_util.h (grub_gui_parse_color): Move to ... * include/grub/video.h (grub_video_parse_color): ... here. * grub-core/Makefile.core.def (kernel) [videoinkernel]: Add video/colors.c. (gfxmenu): Remove gfxmenu/named_colors.c. (video_colors) [videomodules]: New module, containing video/colors.c.
This commit is contained in:
parent
5367ecd305
commit
52832c554c
13 changed files with 240 additions and 198 deletions
|
@ -48,7 +48,7 @@ struct grub_gui_label
|
|||
char *text;
|
||||
char *template;
|
||||
grub_font_t font;
|
||||
grub_gui_color_t color;
|
||||
grub_video_rgba_color_t color;
|
||||
int value;
|
||||
enum align_mode align;
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ label_paint (void *vself, const grub_video_rect_t *region)
|
|||
grub_gui_set_viewport (&self->bounds, &vpsave);
|
||||
grub_font_draw_string (self->text,
|
||||
self->font,
|
||||
grub_gui_map_color (self->color),
|
||||
grub_video_map_rgba_color (self->color),
|
||||
left_x,
|
||||
grub_font_get_ascent (self->font));
|
||||
grub_gui_restore_viewport (&vpsave);
|
||||
|
@ -186,7 +186,7 @@ label_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->color);
|
||||
grub_video_parse_color (value, &self->color);
|
||||
}
|
||||
else if (grub_strcmp (name, "align") == 0)
|
||||
{
|
||||
|
|
|
@ -41,9 +41,9 @@ struct grub_gui_list_impl
|
|||
int item_spacing;
|
||||
grub_font_t item_font;
|
||||
grub_font_t selected_item_font;
|
||||
grub_gui_color_t item_color;
|
||||
grub_video_rgba_color_t item_color;
|
||||
int selected_item_color_set;
|
||||
grub_gui_color_t selected_item_color;
|
||||
grub_video_rgba_color_t selected_item_color;
|
||||
|
||||
int draw_scrollbar;
|
||||
int need_to_recreate_scrollbar;
|
||||
|
@ -267,13 +267,13 @@ draw_menu (list_impl_t self, int num_shown_items)
|
|||
(is_selected && self->selected_item_font
|
||||
? self->selected_item_font
|
||||
: self->item_font);
|
||||
grub_gui_color_t text_color =
|
||||
grub_video_rgba_color_t text_color =
|
||||
((is_selected && self->selected_item_color_set)
|
||||
? self->selected_item_color
|
||||
: self->item_color);
|
||||
grub_font_draw_string (item_title,
|
||||
font,
|
||||
grub_gui_map_color (text_color),
|
||||
grub_video_map_rgba_color (text_color),
|
||||
sel_leftpad + self->icon_width + icon_text_space,
|
||||
(item_top + (item_height - (ascent + descent))
|
||||
/ 2 + ascent));
|
||||
|
@ -429,7 +429,7 @@ list_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "item_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->item_color);
|
||||
grub_video_parse_color (value, &self->item_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "selected_item_color") == 0)
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ list_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (grub_gui_parse_color (value, &self->selected_item_color)
|
||||
if (grub_video_parse_color (value, &self->selected_item_color)
|
||||
== GRUB_ERR_NONE)
|
||||
self->selected_item_color_set = 1;
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ grub_gui_list_new (void)
|
|||
{
|
||||
list_impl_t self;
|
||||
grub_font_t default_font;
|
||||
grub_gui_color_t default_fg_color;
|
||||
grub_video_rgba_color_t default_fg_color;
|
||||
|
||||
self = grub_zalloc (sizeof (*self));
|
||||
if (! self)
|
||||
|
@ -574,7 +574,7 @@ grub_gui_list_new (void)
|
|||
self->visible = 1;
|
||||
|
||||
default_font = grub_font_get ("Unknown Regular 16");
|
||||
default_fg_color = grub_gui_color_rgb (0, 0, 0);
|
||||
default_fg_color = grub_video_rgba_color_rgb (0, 0, 0);
|
||||
|
||||
self->icon_width = 32;
|
||||
self->icon_height = 32;
|
||||
|
|
|
@ -40,10 +40,10 @@ struct grub_gui_progress_bar
|
|||
int show_text;
|
||||
char *template;
|
||||
grub_font_t font;
|
||||
grub_gui_color_t text_color;
|
||||
grub_gui_color_t border_color;
|
||||
grub_gui_color_t bg_color;
|
||||
grub_gui_color_t fg_color;
|
||||
grub_video_rgba_color_t text_color;
|
||||
grub_video_rgba_color_t border_color;
|
||||
grub_video_rgba_color_t bg_color;
|
||||
grub_video_rgba_color_t fg_color;
|
||||
|
||||
char *theme_dir;
|
||||
int need_to_recreate_pixmaps;
|
||||
|
@ -109,7 +109,7 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self)
|
|||
f.height = self->bounds.height - 2;
|
||||
|
||||
/* Border. */
|
||||
grub_video_fill_rect (grub_gui_map_color (self->border_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->border_color),
|
||||
f.x - 1, f.y - 1,
|
||||
f.width + 2, f.height + 2);
|
||||
|
||||
|
@ -117,12 +117,12 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self)
|
|||
int barwidth = (f.width
|
||||
* (self->value - self->start)
|
||||
/ (self->end - self->start));
|
||||
grub_video_fill_rect (grub_gui_map_color (self->bg_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->bg_color),
|
||||
f.x + barwidth, f.y,
|
||||
f.width - barwidth, f.height);
|
||||
|
||||
/* Bar foreground. */
|
||||
grub_video_fill_rect (grub_gui_map_color (self->fg_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->fg_color),
|
||||
f.x, f.y,
|
||||
barwidth, f.height);
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ draw_text (grub_gui_progress_bar_t self)
|
|||
if (self->template)
|
||||
{
|
||||
grub_font_t font = self->font;
|
||||
grub_video_color_t text_color = grub_gui_map_color (self->text_color);
|
||||
grub_video_color_t text_color =
|
||||
grub_video_map_rgba_color (self->text_color);
|
||||
int width = self->bounds.width;
|
||||
int height = self->bounds.height;
|
||||
char *text;
|
||||
|
@ -298,19 +299,19 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "text_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->text_color);
|
||||
grub_video_parse_color (value, &self->text_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "border_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->border_color);
|
||||
grub_video_parse_color (value, &self->border_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "bg_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->bg_color);
|
||||
grub_video_parse_color (value, &self->bg_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "fg_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->fg_color);
|
||||
grub_video_parse_color (value, &self->fg_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "bar_style") == 0)
|
||||
{
|
||||
|
@ -379,9 +380,9 @@ grub_gui_progress_bar_new (void)
|
|||
self->progress.component.ops = &progress_bar_ops;
|
||||
self->visible = 1;
|
||||
self->font = grub_font_get ("Unknown Regular 16");
|
||||
grub_gui_color_t black = { .red = 0, .green = 0, .blue = 0, .alpha = 255 };
|
||||
grub_gui_color_t gray = { .red = 128, .green = 128, .blue = 128, .alpha = 255 };
|
||||
grub_gui_color_t lightgray = { .red = 200, .green = 200, .blue = 200, .alpha = 255 };
|
||||
grub_video_rgba_color_t black = { .red = 0, .green = 0, .blue = 0, .alpha = 255 };
|
||||
grub_video_rgba_color_t gray = { .red = 128, .green = 128, .blue = 128, .alpha = 255 };
|
||||
grub_video_rgba_color_t lightgray = { .red = 200, .green = 200, .blue = 200, .alpha = 255 };
|
||||
self->text_color = black;
|
||||
self->border_color = black;
|
||||
self->bg_color = gray;
|
||||
|
|
|
@ -204,124 +204,3 @@ grub_get_dirname (const char *file_path)
|
|||
|
||||
return grub_new_substring (file_path, 0, last_slash + 1);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
my_isxdigit (char c)
|
||||
{
|
||||
return ((c >= '0' && c <= '9')
|
||||
|| (c >= 'a' && c <= 'f')
|
||||
|| (c >= 'A' && c <= 'F'));
|
||||
}
|
||||
|
||||
static int
|
||||
parse_hex_color_component (const char *s, unsigned start, unsigned end)
|
||||
{
|
||||
unsigned len;
|
||||
char buf[3];
|
||||
|
||||
len = end - start;
|
||||
/* Check the limits so we don't overrun the buffer. */
|
||||
if (len < 1 || len > 2)
|
||||
return 0;
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
buf[0] = s[start]; /* Get the first and only hex digit. */
|
||||
buf[1] = buf[0]; /* Duplicate the hex digit. */
|
||||
}
|
||||
else if (len == 2)
|
||||
{
|
||||
buf[0] = s[start];
|
||||
buf[1] = s[start + 1];
|
||||
}
|
||||
|
||||
buf[2] = '\0';
|
||||
|
||||
return grub_strtoul (buf, 0, 16);
|
||||
}
|
||||
|
||||
/* Parse a color string of the form "r, g, b", "#RGB", "#RGBA",
|
||||
"#RRGGBB", or "#RRGGBBAA". */
|
||||
grub_err_t
|
||||
grub_gui_parse_color (const char *s, grub_gui_color_t *color)
|
||||
{
|
||||
grub_gui_color_t c;
|
||||
|
||||
/* Skip whitespace. */
|
||||
while (*s && grub_isspace (*s))
|
||||
s++;
|
||||
|
||||
if (*s == '#')
|
||||
{
|
||||
/* HTML-style. Number if hex digits:
|
||||
[6] #RRGGBB [3] #RGB
|
||||
[8] #RRGGBBAA [4] #RGBA */
|
||||
|
||||
s++; /* Skip the '#'. */
|
||||
/* Count the hexits to determine the format. */
|
||||
int hexits = 0;
|
||||
const char *end = s;
|
||||
while (my_isxdigit (*end))
|
||||
{
|
||||
end++;
|
||||
hexits++;
|
||||
}
|
||||
|
||||
/* Parse the color components based on the format. */
|
||||
if (hexits == 3 || hexits == 4)
|
||||
{
|
||||
c.red = parse_hex_color_component (s, 0, 1);
|
||||
c.green = parse_hex_color_component (s, 1, 2);
|
||||
c.blue = parse_hex_color_component (s, 2, 3);
|
||||
if (hexits == 4)
|
||||
c.alpha = parse_hex_color_component (s, 3, 4);
|
||||
else
|
||||
c.alpha = 255;
|
||||
}
|
||||
else if (hexits == 6 || hexits == 8)
|
||||
{
|
||||
c.red = parse_hex_color_component (s, 0, 2);
|
||||
c.green = parse_hex_color_component (s, 2, 4);
|
||||
c.blue = parse_hex_color_component (s, 4, 6);
|
||||
if (hexits == 8)
|
||||
c.alpha = parse_hex_color_component (s, 6, 8);
|
||||
else
|
||||
c.alpha = 255;
|
||||
}
|
||||
else
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"invalid HTML-type color string `%s'", s);
|
||||
}
|
||||
else if (grub_isdigit (*s))
|
||||
{
|
||||
/* Comma separated decimal values. */
|
||||
c.red = grub_strtoul (s, 0, 0);
|
||||
if ((s = grub_strchr (s, ',')) == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"missing 1st comma separator in color `%s'", s);
|
||||
s++;
|
||||
c.green = grub_strtoul (s, 0, 0);
|
||||
if ((s = grub_strchr (s, ',')) == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"missing 2nd comma separator in color `%s'", s);
|
||||
s++;
|
||||
c.blue = grub_strtoul (s, 0, 0);
|
||||
if ((s = grub_strchr (s, ',')) == 0)
|
||||
c.alpha = 255;
|
||||
else
|
||||
{
|
||||
s++;
|
||||
c.alpha = grub_strtoul (s, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! grub_gui_get_named_color (s, &c))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"invalid named color `%s'", s);
|
||||
}
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
*color = c;
|
||||
return grub_errno;
|
||||
}
|
||||
|
|
|
@ -1,209 +0,0 @@
|
|||
/* named_colors.c - Named color values. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/gui.h>
|
||||
#include <grub/gui_string_util.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
struct named_color
|
||||
{
|
||||
const char *name;
|
||||
grub_gui_color_t color;
|
||||
};
|
||||
|
||||
/*
|
||||
Named color list generated from the list of SVG color keywords from
|
||||
<http://www.w3.org/TR/css3-color/#svg-color>,
|
||||
processed through the following Perl command:
|
||||
perl -ne 'chomp;split;print "{ \"$_[0]\", RGB_COLOR($_[2]) },\n"'
|
||||
*/
|
||||
|
||||
#define RGB_COLOR(r,g,b) {.red = r, .green = g, .blue = b, .alpha = 255}
|
||||
|
||||
static struct named_color named_colors[] =
|
||||
{
|
||||
{ "aliceblue", RGB_COLOR(240,248,255) },
|
||||
{ "antiquewhite", RGB_COLOR(250,235,215) },
|
||||
{ "aqua", RGB_COLOR(0,255,255) },
|
||||
{ "aquamarine", RGB_COLOR(127,255,212) },
|
||||
{ "azure", RGB_COLOR(240,255,255) },
|
||||
{ "beige", RGB_COLOR(245,245,220) },
|
||||
{ "bisque", RGB_COLOR(255,228,196) },
|
||||
{ "black", RGB_COLOR(0,0,0) },
|
||||
{ "blanchedalmond", RGB_COLOR(255,235,205) },
|
||||
{ "blue", RGB_COLOR(0,0,255) },
|
||||
{ "blueviolet", RGB_COLOR(138,43,226) },
|
||||
{ "brown", RGB_COLOR(165,42,42) },
|
||||
{ "burlywood", RGB_COLOR(222,184,135) },
|
||||
{ "cadetblue", RGB_COLOR(95,158,160) },
|
||||
{ "chartreuse", RGB_COLOR(127,255,0) },
|
||||
{ "chocolate", RGB_COLOR(210,105,30) },
|
||||
{ "coral", RGB_COLOR(255,127,80) },
|
||||
{ "cornflowerblue", RGB_COLOR(100,149,237) },
|
||||
{ "cornsilk", RGB_COLOR(255,248,220) },
|
||||
{ "crimson", RGB_COLOR(220,20,60) },
|
||||
{ "cyan", RGB_COLOR(0,255,255) },
|
||||
{ "darkblue", RGB_COLOR(0,0,139) },
|
||||
{ "darkcyan", RGB_COLOR(0,139,139) },
|
||||
{ "darkgoldenrod", RGB_COLOR(184,134,11) },
|
||||
{ "darkgray", RGB_COLOR(169,169,169) },
|
||||
{ "darkgreen", RGB_COLOR(0,100,0) },
|
||||
{ "darkgrey", RGB_COLOR(169,169,169) },
|
||||
{ "darkkhaki", RGB_COLOR(189,183,107) },
|
||||
{ "darkmagenta", RGB_COLOR(139,0,139) },
|
||||
{ "darkolivegreen", RGB_COLOR(85,107,47) },
|
||||
{ "darkorange", RGB_COLOR(255,140,0) },
|
||||
{ "darkorchid", RGB_COLOR(153,50,204) },
|
||||
{ "darkred", RGB_COLOR(139,0,0) },
|
||||
{ "darksalmon", RGB_COLOR(233,150,122) },
|
||||
{ "darkseagreen", RGB_COLOR(143,188,143) },
|
||||
{ "darkslateblue", RGB_COLOR(72,61,139) },
|
||||
{ "darkslategray", RGB_COLOR(47,79,79) },
|
||||
{ "darkslategrey", RGB_COLOR(47,79,79) },
|
||||
{ "darkturquoise", RGB_COLOR(0,206,209) },
|
||||
{ "darkviolet", RGB_COLOR(148,0,211) },
|
||||
{ "deeppink", RGB_COLOR(255,20,147) },
|
||||
{ "deepskyblue", RGB_COLOR(0,191,255) },
|
||||
{ "dimgray", RGB_COLOR(105,105,105) },
|
||||
{ "dimgrey", RGB_COLOR(105,105,105) },
|
||||
{ "dodgerblue", RGB_COLOR(30,144,255) },
|
||||
{ "firebrick", RGB_COLOR(178,34,34) },
|
||||
{ "floralwhite", RGB_COLOR(255,250,240) },
|
||||
{ "forestgreen", RGB_COLOR(34,139,34) },
|
||||
{ "fuchsia", RGB_COLOR(255,0,255) },
|
||||
{ "gainsboro", RGB_COLOR(220,220,220) },
|
||||
{ "ghostwhite", RGB_COLOR(248,248,255) },
|
||||
{ "gold", RGB_COLOR(255,215,0) },
|
||||
{ "goldenrod", RGB_COLOR(218,165,32) },
|
||||
{ "gray", RGB_COLOR(128,128,128) },
|
||||
{ "green", RGB_COLOR(0,128,0) },
|
||||
{ "greenyellow", RGB_COLOR(173,255,47) },
|
||||
{ "grey", RGB_COLOR(128,128,128) },
|
||||
{ "honeydew", RGB_COLOR(240,255,240) },
|
||||
{ "hotpink", RGB_COLOR(255,105,180) },
|
||||
{ "indianred", RGB_COLOR(205,92,92) },
|
||||
{ "indigo", RGB_COLOR(75,0,130) },
|
||||
{ "ivory", RGB_COLOR(255,255,240) },
|
||||
{ "khaki", RGB_COLOR(240,230,140) },
|
||||
{ "lavender", RGB_COLOR(230,230,250) },
|
||||
{ "lavenderblush", RGB_COLOR(255,240,245) },
|
||||
{ "lawngreen", RGB_COLOR(124,252,0) },
|
||||
{ "lemonchiffon", RGB_COLOR(255,250,205) },
|
||||
{ "lightblue", RGB_COLOR(173,216,230) },
|
||||
{ "lightcoral", RGB_COLOR(240,128,128) },
|
||||
{ "lightcyan", RGB_COLOR(224,255,255) },
|
||||
{ "lightgoldenrodyellow", RGB_COLOR(250,250,210) },
|
||||
{ "lightgray", RGB_COLOR(211,211,211) },
|
||||
{ "lightgreen", RGB_COLOR(144,238,144) },
|
||||
{ "lightgrey", RGB_COLOR(211,211,211) },
|
||||
{ "lightpink", RGB_COLOR(255,182,193) },
|
||||
{ "lightsalmon", RGB_COLOR(255,160,122) },
|
||||
{ "lightseagreen", RGB_COLOR(32,178,170) },
|
||||
{ "lightskyblue", RGB_COLOR(135,206,250) },
|
||||
{ "lightslategray", RGB_COLOR(119,136,153) },
|
||||
{ "lightslategrey", RGB_COLOR(119,136,153) },
|
||||
{ "lightsteelblue", RGB_COLOR(176,196,222) },
|
||||
{ "lightyellow", RGB_COLOR(255,255,224) },
|
||||
{ "lime", RGB_COLOR(0,255,0) },
|
||||
{ "limegreen", RGB_COLOR(50,205,50) },
|
||||
{ "linen", RGB_COLOR(250,240,230) },
|
||||
{ "magenta", RGB_COLOR(255,0,255) },
|
||||
{ "maroon", RGB_COLOR(128,0,0) },
|
||||
{ "mediumaquamarine", RGB_COLOR(102,205,170) },
|
||||
{ "mediumblue", RGB_COLOR(0,0,205) },
|
||||
{ "mediumorchid", RGB_COLOR(186,85,211) },
|
||||
{ "mediumpurple", RGB_COLOR(147,112,219) },
|
||||
{ "mediumseagreen", RGB_COLOR(60,179,113) },
|
||||
{ "mediumslateblue", RGB_COLOR(123,104,238) },
|
||||
{ "mediumspringgreen", RGB_COLOR(0,250,154) },
|
||||
{ "mediumturquoise", RGB_COLOR(72,209,204) },
|
||||
{ "mediumvioletred", RGB_COLOR(199,21,133) },
|
||||
{ "midnightblue", RGB_COLOR(25,25,112) },
|
||||
{ "mintcream", RGB_COLOR(245,255,250) },
|
||||
{ "mistyrose", RGB_COLOR(255,228,225) },
|
||||
{ "moccasin", RGB_COLOR(255,228,181) },
|
||||
{ "navajowhite", RGB_COLOR(255,222,173) },
|
||||
{ "navy", RGB_COLOR(0,0,128) },
|
||||
{ "oldlace", RGB_COLOR(253,245,230) },
|
||||
{ "olive", RGB_COLOR(128,128,0) },
|
||||
{ "olivedrab", RGB_COLOR(107,142,35) },
|
||||
{ "orange", RGB_COLOR(255,165,0) },
|
||||
{ "orangered", RGB_COLOR(255,69,0) },
|
||||
{ "orchid", RGB_COLOR(218,112,214) },
|
||||
{ "palegoldenrod", RGB_COLOR(238,232,170) },
|
||||
{ "palegreen", RGB_COLOR(152,251,152) },
|
||||
{ "paleturquoise", RGB_COLOR(175,238,238) },
|
||||
{ "palevioletred", RGB_COLOR(219,112,147) },
|
||||
{ "papayawhip", RGB_COLOR(255,239,213) },
|
||||
{ "peachpuff", RGB_COLOR(255,218,185) },
|
||||
{ "peru", RGB_COLOR(205,133,63) },
|
||||
{ "pink", RGB_COLOR(255,192,203) },
|
||||
{ "plum", RGB_COLOR(221,160,221) },
|
||||
{ "powderblue", RGB_COLOR(176,224,230) },
|
||||
{ "purple", RGB_COLOR(128,0,128) },
|
||||
{ "red", RGB_COLOR(255,0,0) },
|
||||
{ "rosybrown", RGB_COLOR(188,143,143) },
|
||||
{ "royalblue", RGB_COLOR(65,105,225) },
|
||||
{ "saddlebrown", RGB_COLOR(139,69,19) },
|
||||
{ "salmon", RGB_COLOR(250,128,114) },
|
||||
{ "sandybrown", RGB_COLOR(244,164,96) },
|
||||
{ "seagreen", RGB_COLOR(46,139,87) },
|
||||
{ "seashell", RGB_COLOR(255,245,238) },
|
||||
{ "sienna", RGB_COLOR(160,82,45) },
|
||||
{ "silver", RGB_COLOR(192,192,192) },
|
||||
{ "skyblue", RGB_COLOR(135,206,235) },
|
||||
{ "slateblue", RGB_COLOR(106,90,205) },
|
||||
{ "slategray", RGB_COLOR(112,128,144) },
|
||||
{ "slategrey", RGB_COLOR(112,128,144) },
|
||||
{ "snow", RGB_COLOR(255,250,250) },
|
||||
{ "springgreen", RGB_COLOR(0,255,127) },
|
||||
{ "steelblue", RGB_COLOR(70,130,180) },
|
||||
{ "tan", RGB_COLOR(210,180,140) },
|
||||
{ "teal", RGB_COLOR(0,128,128) },
|
||||
{ "thistle", RGB_COLOR(216,191,216) },
|
||||
{ "tomato", RGB_COLOR(255,99,71) },
|
||||
{ "turquoise", RGB_COLOR(64,224,208) },
|
||||
{ "violet", RGB_COLOR(238,130,238) },
|
||||
{ "wheat", RGB_COLOR(245,222,179) },
|
||||
{ "white", RGB_COLOR(255,255,255) },
|
||||
{ "whitesmoke", RGB_COLOR(245,245,245) },
|
||||
{ "yellow", RGB_COLOR(255,255,0) },
|
||||
{ "yellowgreen", RGB_COLOR(154,205,50) },
|
||||
{ 0, { 0, 0, 0, 0 } } /* Terminator. */
|
||||
};
|
||||
|
||||
/* Get the color named NAME. If the color was found, returns 1 and
|
||||
stores the color into *COLOR. If the color was not found, returns 0 and
|
||||
does not modify *COLOR. */
|
||||
int
|
||||
grub_gui_get_named_color (const char *name,
|
||||
grub_gui_color_t *color)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; named_colors[i].name; i++)
|
||||
{
|
||||
if (grub_strcmp (named_colors[i].name, name) == 0)
|
||||
{
|
||||
*color = named_colors[i].color;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -135,11 +135,11 @@ theme_set_string (grub_gfxmenu_view_t view,
|
|||
return grub_errno;
|
||||
}
|
||||
else if (! grub_strcmp ("title-color", name))
|
||||
grub_gui_parse_color (value, &view->title_color);
|
||||
grub_video_parse_color (value, &view->title_color);
|
||||
else if (! grub_strcmp ("message-color", name))
|
||||
grub_gui_parse_color (value, &view->message_color);
|
||||
grub_video_parse_color (value, &view->message_color);
|
||||
else if (! grub_strcmp ("message-bg-color", name))
|
||||
grub_gui_parse_color (value, &view->message_bg_color);
|
||||
grub_video_parse_color (value, &view->message_bg_color);
|
||||
else if (! grub_strcmp ("desktop-image", name))
|
||||
{
|
||||
struct grub_video_bitmap *raw_bitmap;
|
||||
|
@ -170,7 +170,7 @@ theme_set_string (grub_gfxmenu_view_t view,
|
|||
view->desktop_image = scaled_bitmap;
|
||||
}
|
||||
else if (! grub_strcmp ("desktop-color", name))
|
||||
grub_gui_parse_color (value, &view->desktop_color);
|
||||
grub_video_parse_color (value, &view->desktop_color);
|
||||
else if (! grub_strcmp ("terminal-box", name))
|
||||
{
|
||||
grub_err_t err;
|
||||
|
|
|
@ -50,8 +50,8 @@ grub_gfxmenu_view_new (const char *theme_path,
|
|||
{
|
||||
grub_gfxmenu_view_t view;
|
||||
grub_font_t default_font;
|
||||
grub_gui_color_t default_fg_color;
|
||||
grub_gui_color_t default_bg_color;
|
||||
grub_video_rgba_color_t default_fg_color;
|
||||
grub_video_rgba_color_t default_bg_color;
|
||||
|
||||
view = grub_malloc (sizeof (*view));
|
||||
if (! view)
|
||||
|
@ -63,8 +63,8 @@ grub_gfxmenu_view_new (const char *theme_path,
|
|||
view->screen.height = height;
|
||||
|
||||
default_font = grub_font_get ("Unknown Regular 16");
|
||||
default_fg_color = grub_gui_color_rgb (0, 0, 0);
|
||||
default_bg_color = grub_gui_color_rgb (255, 255, 255);
|
||||
default_fg_color = grub_video_rgba_color_rgb (0, 0, 0);
|
||||
default_bg_color = grub_video_rgba_color_rgb (255, 255, 255);
|
||||
|
||||
view->canvas = 0;
|
||||
|
||||
|
@ -131,7 +131,7 @@ redraw_background (grub_gfxmenu_view_t view,
|
|||
}
|
||||
else
|
||||
{
|
||||
grub_video_fill_rect (grub_gui_map_color (view->desktop_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (view->desktop_color),
|
||||
bounds->x, bounds->y,
|
||||
bounds->width, bounds->height);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ draw_title (grub_gfxmenu_view_t view)
|
|||
int y = 40 + grub_font_get_ascent (view->title_font);
|
||||
grub_font_draw_string (view->title_text,
|
||||
view->title_font,
|
||||
grub_gui_map_color (view->title_color),
|
||||
grub_video_map_rgba_color (view->title_color),
|
||||
x, y);
|
||||
}
|
||||
|
||||
|
@ -244,13 +244,13 @@ draw_message (grub_gfxmenu_view_t view)
|
|||
return;
|
||||
|
||||
grub_font_t font = view->message_font;
|
||||
grub_video_color_t color = grub_gui_map_color (view->message_color);
|
||||
grub_video_color_t color = grub_video_map_rgba_color (view->message_color);
|
||||
|
||||
/* Border. */
|
||||
grub_video_fill_rect (color,
|
||||
f.x-1, f.y-1, f.width+2, f.height+2);
|
||||
/* Fill. */
|
||||
grub_video_fill_rect (grub_gui_map_color (view->message_bg_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (view->message_bg_color),
|
||||
f.x, f.y, f.width, f.height);
|
||||
|
||||
/* Center the text. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue