2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
119 lines
2.8 KiB
C
119 lines
2.8 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 "config.h"
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "apptypes.h"
|
|
|
|
#include "drawable.h"
|
|
#include "gimpcontext.h"
|
|
#include "gdisplay.h"
|
|
#include "undo.h"
|
|
|
|
|
|
void
|
|
drawable_fill (GimpDrawable *drawable,
|
|
GimpFillType fill_type)
|
|
{
|
|
guchar r, g, b, a;
|
|
|
|
g_return_if_fail (drawable != NULL);
|
|
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
|
|
|
a = 255;
|
|
|
|
switch (fill_type)
|
|
{
|
|
case FOREGROUND_FILL:
|
|
gimp_context_get_foreground (NULL, &r, &g, &b);
|
|
break;
|
|
|
|
case BACKGROUND_FILL:
|
|
gimp_context_get_background (NULL, &r, &g, &b);
|
|
break;
|
|
|
|
case WHITE_FILL:
|
|
r = g = b = 255;
|
|
break;
|
|
|
|
case TRANSPARENT_FILL:
|
|
a = r = g = b = 0;
|
|
break;
|
|
|
|
case NO_FILL:
|
|
return;
|
|
|
|
default:
|
|
g_warning ("unknown fill type");
|
|
a = r = g = b = 0;
|
|
break;
|
|
}
|
|
|
|
gimp_drawable_fill (drawable, r, g, b, a);
|
|
|
|
drawable_update (drawable, 0, 0,
|
|
gimp_drawable_width (drawable),
|
|
gimp_drawable_height (drawable));
|
|
}
|
|
|
|
void
|
|
drawable_update (GimpDrawable *drawable,
|
|
gint x,
|
|
gint y,
|
|
gint w,
|
|
gint h)
|
|
{
|
|
GimpImage *gimage;
|
|
gint offset_x, offset_y;
|
|
|
|
g_return_if_fail (drawable != NULL);
|
|
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
|
|
|
gimage = gimp_drawable_gimage (drawable);
|
|
g_return_if_fail (gimage != NULL);
|
|
|
|
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
|
|
x += offset_x;
|
|
y += offset_y;
|
|
gdisplays_update_area (gimage, x, y, w, h);
|
|
|
|
/* invalidate the preview */
|
|
gimp_drawable_invalidate_preview (drawable, FALSE);
|
|
}
|
|
|
|
void
|
|
drawable_apply_image (GimpDrawable *drawable,
|
|
gint x1,
|
|
gint y1,
|
|
gint x2,
|
|
gint y2,
|
|
TileManager *tiles,
|
|
gint sparse)
|
|
{
|
|
g_return_if_fail (drawable != NULL);
|
|
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
|
|
|
if (! tiles)
|
|
undo_push_image (drawable->gimage, drawable,
|
|
x1, y1, x2, y2);
|
|
else
|
|
undo_push_image_mod (drawable->gimage, drawable,
|
|
x1, y1, x2, y2, tiles, sparse);
|
|
}
|