gimp/app/colormaps.c
Manish Singh 7cb07a90bf add sample_colorize and curve_bend defs
* plug-ins/common/plugin-defs.pl: add sample_colorize and
curve_bend defs

* libgimp/color_selector.h: minor consistency cleanup

* libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros

* libgimp/gimpfileselection.c
* libgimp/gimpmatrix.h: minor cleanup

* libgimp/gimpintl.h: resync with gnome-i18n.h


* libgimp/color_display.h
* app/gimp.sym
* app/gdisplay_color.[ch]
* app/app_procs.c
* app/gdisplay.h
* app/image_render.c: color display transformation code. Still
unfinished, so it's not activated yet.

* app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION)

* app/colormaps.[ch]
* app/image_render.c: remove vestigal dithering stuff

* app/convolve.h
* app/gimpdrawable.h
* app/gimpimage.h
* app/lut_funcs.h
* app/paint_funcs.h
* app/plug_in.h: enum nick changes from Marc

* app/channel_ops.c
* app/crop.c
* app/gdisplay.c
* app/gimpimage.[ch]
* app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/

* app/flip_tool.[ch]
* app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own

* app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines

* app/general.h: enumified TOKEN_* symbols

* app/lc_dialog.c
* app/paint_funcs.c: remove unused variables

* tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished)

* tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove
layer_mode shortcut since we've skipped it in app/

* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/gimage.pdb
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace
cleanups

* tools/pdbgen/enums.pl
* app/brush_select_cmds.c
* app/brushes_cmds.c
* app/color_cmds.c
* app/drawable_cmds.c
* app/gimage_cmds.c
* app/layer_cmds.c
* app/procedural_db_cmds.c
* app/tools_cmds.c: reflect pdb and enum nick changes above

-Yosh
1999-07-28 23:00:08 +00:00

145 lines
3.3 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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.
*/
#include <stdlib.h>
#include <math.h>
#include "appenv.h"
#include "app_procs.h"
#include "gimpbrushlist.h"
#include "colormaps.h"
#include "errors.h"
#include "general.h"
#include "gimprc.h"
#include "gradient.h"
#include "palette.h"
#include "patterns.h"
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_swap.h"
GdkVisual *g_visual = NULL;
GdkColormap *g_cmap = NULL;
gulong g_black_pixel;
gulong g_gray_pixel;
gulong g_white_pixel;
gulong g_color_pixel;
gulong g_normal_guide_pixel;
gulong g_active_guide_pixel;
gulong foreground_pixel;
gulong background_pixel;
gulong old_color_pixel;
gulong new_color_pixel;
gulong marching_ants_pixels[8];
static void make_color (gulong *pixel_ptr,
int red,
int green,
int blue,
int readwrite);
static void
set_app_colors (void)
{
cycled_marching_ants = FALSE;
make_color (&g_black_pixel, 0, 0, 0, FALSE);
make_color (&g_gray_pixel, 127, 127, 127, FALSE);
make_color (&g_white_pixel, 255, 255, 255, FALSE);
make_color (&g_color_pixel, 255, 255, 0, FALSE);
make_color (&g_normal_guide_pixel, 0, 127, 255, FALSE);
make_color (&g_active_guide_pixel, 255, 0, 0, FALSE);
store_color (&foreground_pixel, 0, 0, 0);
store_color (&background_pixel, 255, 255, 255);
store_color (&old_color_pixel, 0, 0, 0);
store_color (&new_color_pixel, 255, 255, 255);
}
/* This probably doesn't belong here - RLL*/
/* static unsigned int
gamma_correct (int intensity, double gamma)
{
unsigned int val;
double ind;
double one_over_gamma;
if (gamma != 0.0)
one_over_gamma = 1.0 / gamma;
else
one_over_gamma = 1.0;
ind = (double) intensity / 256.0;
val = (int) (256 * pow (ind, one_over_gamma));
return val;
} */
/*************************************************************************/
gulong
get_color (int red,
int green,
int blue)
{
return gdk_rgb_xpixel_from_rgb ((red << 16) | (green << 8) | blue);
}
static void
make_color (gulong *pixel_ptr,
int red,
int green,
int blue,
int readwrite)
{
*pixel_ptr = get_color (red, green, blue);
}
void
store_color (gulong *pixel_ptr,
int red,
int green,
int blue)
{
*pixel_ptr = get_color (red, green, blue);
}
void
get_standard_colormaps ()
{
GtkPreviewInfo *info;
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;
g_cmap = info->cmap;
set_app_colors ();
}