mirror of https://github.com/GNOME/gimp.git
fix for 8 bit displays
Wed Mar 31 01:17:38 EST 1999 Matt Wilson <msw@gimp.org> * app/colormaps.c: fix for 8 bit displays
This commit is contained in:
parent
77843e9caf
commit
712e006464
|
@ -1,6 +1,10 @@
|
|||
Wed Mar 31 01:17:38 EST 1999 Matt Wilson <msw@gimp.org>
|
||||
|
||||
* app/colormaps.c: fix for 8 bit displays
|
||||
|
||||
Wed Mar 31 00:33:28 EST 1999 Matt Wilson <msw@gimp.org>
|
||||
|
||||
* commands.[ch]: changed callbacks invoked by ItemFactories to
|
||||
* app/commands.[ch]: changed callbacks invoked by ItemFactories to
|
||||
the the correct parameters. This fixes the following problems:
|
||||
- tool election via hotkeys and right click menu selection
|
||||
- reshow last filter repeating last filter
|
||||
|
|
105
app/colormaps.c
105
app/colormaps.c
|
@ -65,9 +65,6 @@ gulong *g_lookup_blue;
|
|||
gulong *color_pixel_vals;
|
||||
gulong *gray_pixel_vals;
|
||||
|
||||
static int reserved_entries = 4; /* extra colors aside from color cube */
|
||||
static gulong *reserved_pixels;
|
||||
|
||||
static void make_color (gulong *pixel_ptr,
|
||||
int red,
|
||||
int green,
|
||||
|
@ -75,22 +72,9 @@ static void make_color (gulong *pixel_ptr,
|
|||
int readwrite);
|
||||
|
||||
static void
|
||||
set_app_colors ()
|
||||
set_app_colors (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ((g_visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(g_visual->type == GDK_VISUAL_GRAYSCALE))
|
||||
{
|
||||
foreground_pixel = reserved_pixels[0];
|
||||
background_pixel = reserved_pixels[1];
|
||||
old_color_pixel = reserved_pixels[2];
|
||||
new_color_pixel = reserved_pixels[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
cycled_marching_ants = FALSE;
|
||||
}
|
||||
cycled_marching_ants = FALSE;
|
||||
|
||||
make_color (&g_black_pixel, 0, 0, 0, FALSE);
|
||||
make_color (&g_gray_pixel, 127, 127, 127, FALSE);
|
||||
|
@ -104,19 +88,8 @@ set_app_colors ()
|
|||
store_color (&old_color_pixel, 0, 0, 0);
|
||||
store_color (&new_color_pixel, 255, 255, 255);
|
||||
|
||||
/* marching ants pixels--if enabled */
|
||||
if (cycled_marching_ants)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
marching_ants_pixels[i] = reserved_pixels[i + reserved_entries - 8];
|
||||
if (i < 4)
|
||||
store_color (&marching_ants_pixels[i], 0, 0, 0);
|
||||
else
|
||||
store_color (&marching_ants_pixels[i], 255, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* poof - can't use this anymore
|
||||
static unsigned int
|
||||
gamma_correct (int intensity, double gamma)
|
||||
{
|
||||
|
@ -134,7 +107,7 @@ gamma_correct (int intensity, double gamma)
|
|||
|
||||
return val;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
@ -144,17 +117,7 @@ get_color (int red,
|
|||
int green,
|
||||
int blue)
|
||||
{
|
||||
gulong pixel;
|
||||
|
||||
if ((g_visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(g_visual->type == GDK_VISUAL_GRAYSCALE))
|
||||
pixel = color_pixel_vals [(red_ordered_dither[red].s[1] +
|
||||
green_ordered_dither[green].s[1] +
|
||||
blue_ordered_dither[blue].s[1])];
|
||||
else
|
||||
store_color (&pixel, red, green, blue);
|
||||
|
||||
return pixel;
|
||||
return gdk_rgb_xpixel_from_rgb ((red << 16) | (green << 8) | blue);
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,24 +128,7 @@ make_color (gulong *pixel_ptr,
|
|||
int blue,
|
||||
int readwrite)
|
||||
{
|
||||
GdkColor col;
|
||||
|
||||
red = gamma_correct (red, gamma_val);
|
||||
green = gamma_correct (green, gamma_val);
|
||||
blue = gamma_correct (blue, gamma_val);
|
||||
|
||||
col.red = red * (65535 / 255);
|
||||
col.green = green * (65535 / 255);
|
||||
col.blue = blue * (65535 / 255);
|
||||
col.pixel = *pixel_ptr;
|
||||
|
||||
if (readwrite && ((g_visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(g_visual->type == GDK_VISUAL_GRAYSCALE)))
|
||||
gdk_color_change (g_cmap, &col);
|
||||
else
|
||||
gdk_color_alloc (g_cmap, &col);
|
||||
|
||||
*pixel_ptr = col.pixel;
|
||||
*pixel_ptr = get_color (red, green, blue);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -191,55 +137,20 @@ store_color (gulong *pixel_ptr,
|
|||
int green,
|
||||
int blue)
|
||||
{
|
||||
make_color (pixel_ptr, red, green, blue, TRUE);
|
||||
*pixel_ptr = get_color (red, green, blue);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_standard_colormaps ()
|
||||
{
|
||||
GtkPreviewInfo *info;
|
||||
|
||||
if (cycled_marching_ants)
|
||||
reserved_entries += 8;
|
||||
|
||||
gtk_preview_set_gamma (gamma_val);
|
||||
gtk_preview_set_color_cube (color_cube_shades[0], color_cube_shades[1],
|
||||
color_cube_shades[2], color_cube_shades[3]);
|
||||
gtk_preview_set_install_cmap (install_cmap);
|
||||
gtk_preview_set_reserved (reserved_entries);
|
||||
|
||||
/* so we can reinit the colormaps */
|
||||
gtk_preview_reset ();
|
||||
|
||||
gtk_widget_set_default_visual (gtk_preview_get_visual ());
|
||||
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
|
||||
|
||||
info = gtk_preview_get_info ();
|
||||
g_visual = info->visual;
|
||||
|
||||
/*
|
||||
if (((g_visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(g_visual->type == GDK_VISUAL_GRAYSCALE)) &&
|
||||
info->reserved_pixels == NULL) {
|
||||
*/ /* XXXXXXXXXX fix me */
|
||||
if (((g_visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(g_visual->type == GDK_VISUAL_GRAYSCALE))) {
|
||||
g_print("GIMP cannot get enough colormaps to boot.\n");
|
||||
g_print("Try exiting other color intensive applications.\n");
|
||||
g_print("Also try enabling the (install-colormap) option in gimprc.\n");
|
||||
swapping_free ();
|
||||
brushes_free ();
|
||||
patterns_free ();
|
||||
palettes_free ();
|
||||
gradients_free ();
|
||||
palette_free ();
|
||||
procedural_db_free ();
|
||||
plug_in_kill ();
|
||||
tile_swap_exit ();
|
||||
gtk_exit(0);
|
||||
}
|
||||
|
||||
g_cmap = info->cmap;
|
||||
#if 0
|
||||
color_pixel_vals = info->color_pixels;
|
||||
|
@ -257,6 +168,6 @@ get_standard_colormaps ()
|
|||
g_lookup_green = info->lookup_green;
|
||||
g_lookup_blue = info->lookup_blue;
|
||||
#endif
|
||||
|
||||
|
||||
set_app_colors ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue