Commit 16bbbaec authored by Daniel Egger's avatar Daniel Egger Committed by Daniel Egger
Browse files

app/paint-funcs/paint-funcs.c Split generic (read: C) code for

2001-11-19  Daniel Egger  <degger@fhm.edu>

	* app/paint-funcs/paint-funcs.c
	* app/paint-funcs/paint-funcs-generic.h: Split generic (read: C)
	code for pixelmanipulation and most of the code that belongs to it
	into new file.
	(apply_layer_funcs): Gone. The correct layer function is now
	dispatched from the layer_mode_funcs table and the table is
	per default initialised with the generic functions. Arguments
	will be passed by a struct apply_layer_mode_struct instead
	of directly per stack to avoid parameter typying madness.

	It's now cleanly possible to check for availabilty of
	MMX/AltiVec/(insert your favourite brew here) in
	paint_funcs_setup () and change the table to use faster routines.
	The old MMX cruft which is temporaribly in paint-funcs-generic.h
	will soon be gone but I'm to tired now.

	* app/paint-funcs/paint-funcs.c: Braind dead code for temporary
	buffer (which never shrunk only grew) gone and replaced by
	straightforward code.

	* app/paint-funcs/paint-funcs-generic.h: Applied a bunch of obvious
	optimisations to reduce code size and avoid parameter madness.

	* paint-funcs-[gray|graya|indexed|rga|rgba].[c|h]: Gone. I lost
	several days of work on these files and came to the conclusion
	that there has to be an easier way anyway. :)

	Everything well tested on PPC and producing exactly the same results
	as the code before so this has good odds to be the first major
	change that won't break GIMP. :)
parent b2409679
2001-11-19 Daniel Egger <degger@fhm.edu>
* app/paint-funcs/paint-funcs.c
* app/paint-funcs/paint-funcs-generic.h: Split generic (read: C)
code for pixelmanipulation and most of the code that belongs to it
into new file.
(apply_layer_funcs): Gone. The correct layer function is now
dispatched from the layer_mode_funcs table and the table is
per default initialised with the generic functions. Arguments
will be passed by a struct apply_layer_mode_struct instead
of directly per stack to avoid parameter typying madness.
It's now cleanly possible to check for availabilty of
MMX/AltiVec/(insert your favourite brew here) in
paint_funcs_setup () and change the table to use faster routines.
The old MMX cruft which is temporaribly in paint-funcs-generic.h
will soon be gone but I'm to tired now.
* app/paint-funcs/paint-funcs.c: Braind dead code for temporary
buffer (which never shrunk only grew) gone and replaced by
straightforward code.
* app/paint-funcs/paint-funcs-generic.h: Applied a bunch of obvious
optimisations to reduce code size and avoid parameter madness.
* paint-funcs-[gray|graya|indexed|rga|rgba].[c|h]: Gone. I lost
several days of work on these files and came to the conclusion
that there has to be an easier way anyway. :)
Everything well tested on PPC and producing exactly the same results
as the code before so this has good odds to be the first major
change that won't break GIMP. :)
2001-11-18 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplay-foreach.c: fixed a comment.
......
This diff is collapsed.
This diff is collapsed.
/* 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.
*/
/*
* gaussian_blur_region no longer does combination; arguments changed
* -- scott@poverty.bloomington.in.us, 16Oct97
*/
#ifndef __PAINT_FUNCS_GRAY_H__
#define __PAINT_FUNCS_GRAY_H__
#include "paint_funcsP.h"
void update_tile_rowhints_gray (Tile *tile,
guint ymin,
guint ymax);
/* Paint functions */
void color_pixels_gray (guchar *dest, const guchar *color,
guint w);
void blend_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest,
guint blend, guint w);
void shade_pixels_gray (const guchar *src, guchar *dest,
const guchar *color,
guint blend, guint w);
void extract_alpha_pixels_gray (guchar *src,
const guchar *mask,
guchar *dest,
guint w);
void darken_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha1);
void lighten_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void hsv_only_pixels_gray_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint mode, guint length);
void color_only_pixels_gray_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint mode, guint length);
void multiply_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void divide_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void screen_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void overlay_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void add_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void subtract_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void difference_pixels_gray(const guchar *src1,
const guchar *src2,
guchar *dest, guint length,
guint bytes2, guint has_alpha2);
void dissolve_pixels_gray (const guchar *src,
guchar *dest, guint x, guint y,
guint opacity, guint length);
void flatten_pixels_gray (const guchar *src, guchar *dest,
const guchar *bg, guint length);
/* apply the mask data to the alpha channel of the pixel data */
void apply_mask_to_alpha_channel_gray (guchar *src,
const guchar *mask,
guint opacity, guint length);
/* combine the mask data with the alpha channel of the pixel data */
void combine_mask_and_alpha_channel_gray (guchar *src,
const guchar *mask,
guint opacity, guint length);
/* lay down the initial pixels in the case of only one
* channel being visible and no layers...In this singular
* case, we want to display a grayscale image w/o transparency
*/
void initial_channel_pixels_gray (const guchar *src,
guchar *dest,
guint length);
/* lay down the initial pixels for the base layer.
* This process obviously requires no composition.
*/
void initial_pixels_gray (const guchar *src,
guchar *dest,
const guchar *mask,
guint opacity, const gint *affect,
guint length);
/* combine an RGB or GRAY image with an GRAY or GRAYA image
* destination is intensity-alpha...
*/
void combine_pixels_gray_rgb (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
guint opacity, const gint *affect,
guint mode_affect, guint length);
/* combine an GRAY or GRAYA image with an GRAY or GRAYA image
* destination is of course intensity-alpha...
*/
void combine_pixels_gray_gray (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
guint opacity,
const gboolean *affect,
guint length);
/* combine a channel with intensity-alpha pixels based
* on some opacity, and a channel color...
* destination is intensity-alpha
*/
void combine_pixels_gray_channel_mask (const guchar *src,
const guchar *channel,
guchar *dest,
const guchar *col,
guint opacity,
guint length);
void combine_pixels_gray_channel_selection (const guchar *src,
const guchar *channel,
guchar *dest,
const guchar *col,
guint opacity,
guint length);
/* paint "behind" the existing pixel row.
* This is similar in appearance to painting on a layer below
* the existing pixels.
*/
void behind_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
guint opacity,
const gint *affect,
guint length,
guint bytes2,
guint has_alpha2);
/* replace the contents of one pixel row with the other
* The operation is still bounded by mask/opacity constraints
*/
void replace_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
guint opacity,
const gint *affect,
guint length,
guint bytes2,
guint has_alpha2);
/* apply source 2 to source 1, but in a non-additive way,
* multiplying alpha channels (works for intensity)
*/
void erase_pixels_gray (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
guint opacity,
const gint *affect,
guint length);
/* extract information from intensity pixels based on
* a mask.
*/
void extract_from_pixels_gray (guchar *src,
guchar *dest,
const guchar *mask,
const guchar *bg,
gboolean cut,
guint length);
void apply_layer_mode_gray_gray (apply_combine_layer_info *info);
void apply_layer_mode_gray_graya (apply_combine_layer_info *info);
/* Opacities */
#define TRANSPARENT_OPACITY 0
#define OPAQUE_OPACITY 255
#endif /* __PAINT_FUNCS_GRAY_H__ */
This diff is collapsed.
/* 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.
*/
/*
* gaussian_blur_region no longer does combination; arguments changed
* -- scott@poverty.bloomington.in.us, 16Oct97
*/
#ifndef __PAINT_FUNCS_GRAYA_H__
#define __PAINT_FUNCS_GRAYA_H__
#include "paint_funcsP.h"
void update_tile_rowhints_graya (Tile *tile,
gint ymin,
gint ymax);
/* Paint functions */
void color_pixels_graya (guchar *dest, const guchar *color,
guint w);
void blend_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest,
gint blend, gint w);
void shade_pixels_graya (const guchar *src, guchar *dest,
const guchar *color,
gint blend, gint w);
void extract_alpha_pixels_graya (const guchar *src,
const guchar *mask,
guchar *dest,
gint w);
void darken_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha1);
void lighten_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void hsv_only_pixels_graya_graya (const guchar *src1,
const guchar *src2,
guchar *dest, guint mode, guint length);
void color_only_pixels_graya_graya (const guchar *src1,
const guchar *src2,
guchar *dest, guint mode, guint length);
void multiply_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void divide_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void screen_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void overlay_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void add_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void subtract_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void difference_pixels_graya(const guchar *src1,
const guchar *src2,
guchar *dest, gint length,
gint bytes2, gint has_alpha2);
void dissolve_pixels_graya (const guchar *src,
guchar *dest, guint x, guint y,
guint opacity, guint length);
void flatten_pixels_graya (const guchar *src, guchar *dest,
const guchar *bg, guint length);
/* apply the mask data to the alpha channel of the pixel data */
void apply_mask_to_alpha_channel_graya (guchar *src,
const guchar *mask,
gint opacity, gint length);
/* combine the mask data with the alpha channel of the pixel data */
void combine_mask_and_alpha_channel_graya (guchar *src,
const guchar *mask,
gint opacity, gint length);
/* lay down the initial pixels in the case of only one
* channel being visible and no layers...In this singular
* case, we want to display a grayscale image w/o transparency
*/
void initial_channel_pixels_graya (const guchar *src,
guchar *dest,
gint length);
/* lay down the initial pixels for the base layer.
* This process obviously requires no composition.
*/
void initial_pixels_graya (const guchar *src,
guchar *dest,
const guchar *mask,
gint opacity, const gint *affect,
gint length);
/* combine an RGB or GRAY image with an GRAYA or GRAYA image
* destination is intensity-alpha...
*/
void combine_pixels_graya_rgb (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint opacity, const gint *affect,
gint mode_affect, gint length);
/* combine an GRAYA or GRAYA image with an GRAYA or GRAYA image
* destination is of course intensity-alpha...
*/
void combine_pixels_graya_graya (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint opacity,
const gint *affect,
gint mode_affect,
gint length);
/* combine a channel with intensity-alpha pixels based
* on some opacity, and a channel color...
* destination is intensity-alpha
*/
void combine_graya_and_indexeda_pixels (apply_combine_layer_info *info);
void combine_graya_and_channel_mask_pixels (apply_combine_layer_info *info);
void combine_graya_and_channel_selection_pixels (apply_combine_layer_info *info);
/* paint "behind" the existing pixel row.
* This is similar in appearance to painting on a layer below
* the existing pixels.
*/
void behind_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint opacity,
const gint *affect,
gint length,
gint bytes2,
gint has_alpha2);
/* replace the contents of one pixel row with the other
* The operation is still bounded by mask/opacity constraints
*/
void replace_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint opacity,
const gint *affect,
gint length,
gint bytes2,
gint has_alpha2);
/* apply source 2 to source 1, but in a non-additive way,
* multiplying alpha channels (works for intensity)
*/
void erase_pixels_graya (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint opacity,
const gint *affect,
gint length);
/* extract information from intensity pixels based on
* a mask.
*/
void extract_from_pixels_graya (guchar *src,
guchar *dest,
const guchar *mask,
const guchar *bg,
gint cut,
gint length);
void apply_layer_mode_graya_gray (apply_combine_layer_info *info);
void apply_layer_mode_graya_graya (apply_combine_layer_info *info);
/* Opacities */
#define TRANSPARENT_OPACITY 0
#define OPAQUE_OPACITY 255
#endif /* __PAINT_FUNCS_GRAYA_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -16,11 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* gaussian_blur_region no longer does combination; arguments changed
* -- scott@poverty.bloomington.in.us, 16Oct97
*/
#ifndef __PAINT_FUNCS_H__
#define __PAINT_FUNCS_H__
......@@ -49,77 +44,6 @@ void extract_alpha_pixels (const unsigned char *src,
unsigned char *dest,
int w, int bytes);
void darken_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void lighten_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void hsv_only_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int mode, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void color_only_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int mode, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void multiply_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void divide_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void screen_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void overlay_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void add_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);
void subtract_pixels (const unsigned char *src1,
const unsigned char *src2,
unsigned char *dest, int length,
int bytes1, int bytes2,
int has_alpha1, int has_alpha2);