gimp/app/composite/gimp-composite.h

172 lines
5.7 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
2003-07-09 07:15:16 +08:00
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Gimp Image Compositing
* Copyright (C) 2003 Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
2003-07-09 07:15:16 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
2003-07-09 07:15:16 +08:00
* (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, see <http://www.gnu.org/licenses/>.
2003-07-09 07:15:16 +08:00
*/
#ifndef __GIMP_COMPOSITE_H__
#define __GIMP_COMPOSITE_H__
2003-07-09 07:15:16 +08:00
typedef enum
{
2003-07-09 07:15:16 +08:00
GIMP_PIXELFORMAT_V8,
GIMP_PIXELFORMAT_VA8,
GIMP_PIXELFORMAT_RGB8,
GIMP_PIXELFORMAT_RGBA8,
GIMP_PIXELFORMAT_ANY,
GIMP_PIXELFORMAT_N
} GimpPixelFormat;
/*
* gtk-doc is unhappy with these #ifdef's inside the enumeration.
*
#ifdef GIMP_COMPOSITE_16BIT
2003-07-09 07:15:16 +08:00
GIMP_PIXELFORMAT_V16,
GIMP_PIXELFORMAT_VA16,
GIMP_PIXELFORMAT_RGB16,
GIMP_PIXELFORMAT_RGBA16,
#endif
#ifdef GIMP_COMPOSITE_32BIT
GIMP_PIXELFORMAT_V32,
GIMP_PIXELFORMAT_VA32,
GIMP_PIXELFORMAT_RGB32,
GIMP_PIXELFORMAT_RGBA32,
2003-07-09 07:15:16 +08:00
#endif
*
*/
2003-07-09 07:15:16 +08:00
/* bytes per-pixel for each of the pixel formats */
extern const guchar gimp_composite_pixel_bpp[];
/* does pixel format have alpha? */
extern const guchar gimp_composite_pixel_alphap[];
/* converter between alpha and non-alpha pixel formats */
extern const GimpPixelFormat gimp_composite_pixel_alpha[];
2003-07-09 07:15:16 +08:00
#define GIMP_COMPOSITE_ALPHA_OPAQUE (-1)
2003-07-09 07:15:16 +08:00
#define GIMP_COMPOSITE_ALPHA_TRANSPARENT (0)
2003-07-09 07:15:16 +08:00
/*
* This is the enumeration of all the supported compositing
* operations. Many of them are taken from the GimpLayerModeEffect
* enumeration, but there are (possibly more) implemented. Here is
* where they are all enumerated.
*
* Nota Bene: Unfortunately, the order here is important!
*/
typedef enum
{
2003-07-09 07:15:16 +08:00
GIMP_COMPOSITE_NORMAL = GIMP_NORMAL_MODE,
GIMP_COMPOSITE_DISSOLVE = GIMP_DISSOLVE_MODE,
GIMP_COMPOSITE_BEHIND = GIMP_BEHIND_MODE,
GIMP_COMPOSITE_MULTIPLY = GIMP_MULTIPLY_MODE,
GIMP_COMPOSITE_SCREEN = GIMP_SCREEN_MODE,
GIMP_COMPOSITE_OVERLAY = GIMP_OVERLAY_MODE,
GIMP_COMPOSITE_DIFFERENCE = GIMP_DIFFERENCE_MODE,
GIMP_COMPOSITE_ADDITION = GIMP_ADDITION_MODE,
GIMP_COMPOSITE_SUBTRACT = GIMP_SUBTRACT_MODE,
GIMP_COMPOSITE_DARKEN = GIMP_DARKEN_ONLY_MODE,
GIMP_COMPOSITE_LIGHTEN = GIMP_LIGHTEN_ONLY_MODE,
GIMP_COMPOSITE_HUE = GIMP_HUE_MODE,
GIMP_COMPOSITE_SATURATION = GIMP_SATURATION_MODE,
GIMP_COMPOSITE_COLOR_ONLY = GIMP_COLOR_MODE,
GIMP_COMPOSITE_VALUE = GIMP_VALUE_MODE,
GIMP_COMPOSITE_DIVIDE = GIMP_DIVIDE_MODE,
GIMP_COMPOSITE_DODGE = GIMP_DODGE_MODE,
GIMP_COMPOSITE_BURN = GIMP_BURN_MODE,
GIMP_COMPOSITE_HARDLIGHT = GIMP_HARDLIGHT_MODE,
GIMP_COMPOSITE_SOFTLIGHT = GIMP_SOFTLIGHT_MODE,
GIMP_COMPOSITE_GRAIN_EXTRACT = GIMP_GRAIN_EXTRACT_MODE,
GIMP_COMPOSITE_GRAIN_MERGE = GIMP_GRAIN_MERGE_MODE,
GIMP_COMPOSITE_COLOR_ERASE = GIMP_COLOR_ERASE_MODE,
GIMP_COMPOSITE_ERASE = GIMP_ERASE_MODE,
GIMP_COMPOSITE_REPLACE = GIMP_REPLACE_MODE,
GIMP_COMPOSITE_ANTI_ERASE = GIMP_ANTI_ERASE_MODE,
GIMP_COMPOSITE_BLEND,
GIMP_COMPOSITE_SHADE,
GIMP_COMPOSITE_SWAP,
GIMP_COMPOSITE_SCALE,
GIMP_COMPOSITE_CONVERT,
GIMP_COMPOSITE_XOR,
2003-07-09 07:15:16 +08:00
GIMP_COMPOSITE_N
} GimpCompositeOperation;
struct GimpCompositeOperationEffects
{
guchar affect_opacity;
guchar increase_opacity;
guchar decrease_opacity;
2003-07-09 07:15:16 +08:00
};
extern struct GimpCompositeOperationEffects gimp_composite_operation_effects[];
/*
2003-07-09 07:15:16 +08:00
* This is structure for communicating all that is necessary to a
* compositing operation.
*/
typedef struct
{
guchar *A; /* Source A */
guchar *B; /* Source B */
guchar *D; /* Destination */
const guchar *M; /* Mask */
gulong n_pixels;
GimpPixelFormat pixelformat_A;
GimpPixelFormat pixelformat_B;
GimpPixelFormat pixelformat_D;
GimpPixelFormat pixelformat_M;
2003-07-09 07:15:16 +08:00
struct { gint opacity; gchar affect; } replace;
struct { gint scale; } scale;
struct { gint blend; } blend;
struct { gint x; gint y; gint opacity; } dissolve;
2003-07-09 07:15:16 +08:00
CombinationMode combine;
2003-07-09 07:15:16 +08:00
GimpCompositeOperation op;
} GimpCompositeContext;
struct GimpCompositeOptions
{
gulong bits;
};
#define GIMP_COMPOSITE_OPTION_USE 0x1
#define GIMP_COMPOSITE_OPTION_NOEXTENSIONS 0x2
#define GIMP_COMPOSITE_OPTION_VERBOSE 0x4
composite/ modularisation of the automatic compositing function "wiring" * composite/ modularisation of the automatic compositing function "wiring" to construct the table of compositing functions at run-time instead of compile time. The environment variable GIMP_COMPOSITE is a hexadecimal number representing a bit-field used to set/reset options in the gimp-composite code. * gimp-composite-altivec.[ch]: added * gimp-composite-altivec-installer.[ch]: added * gimp-composite-vis.[ch]: added * gimp-composite-vis-installer.[ch]: added * gimp-composite-mmx-installer.[ch]: added * gimp-composite-sse-installer.[ch]: added * gimp-composite-altivec-test.[ch]: added * gimp-composite-vis-test.[ch]: added * gimp-composite-mmx-test.[ch]: added * gimp-composite-sse-test.[ch]: added * make-installer.py: Added meta programme for generating code to 1) construct a table of compositing functions indexed by operation, and the pixel formats of the sources and destination, and 2) generating code for regression testing of these compositing functions against the same functions in gimp-composite-generic.c * gimp-composite-mmx.c (xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx): removing from the current set of optimisations because it appears to be broken. * Makefile.am: modified regression testing targets to now build gimp-composite-*-test where * is any of generic, mmx, sse, altivec, and vis. * gimp-composite.c: moved in initialisation code gimp_composite_init() from gimp-composite-dispatch.c * gimp-composite.c: removed gimp_composite_unsupported(). * gimp-composite.c: use cpu_accel() to determine at run-time which set of optimisations are to be used. * gimp-composite.c: conditionally compile code for ARCH_X86. * make-gimp-composite-dispatch.c: retired. See make-installer.py * gimp-composite-mmx.c (op_overlay): namespace cleanup, op_overlay() and all of the constant values are now static * gimp-composite-mmx.c, gimp-composite-sse.c: fixed bug with the alpha mask being the address of the alpha mask, not the mask itself. * app/paint-funcs/paint-funcs.c: Check gimp_composite_options.use to see if we should use the new code or the old code.
2003-08-14 15:43:34 +08:00
extern struct GimpCompositeOptions gimp_composite_options;
void gimp_composite_init (gboolean be_verbose,
gboolean use_cpu_accel);
gboolean gimp_composite_use_cpu_accel (void);
composite/ modularisation of the automatic compositing function "wiring" * composite/ modularisation of the automatic compositing function "wiring" to construct the table of compositing functions at run-time instead of compile time. The environment variable GIMP_COMPOSITE is a hexadecimal number representing a bit-field used to set/reset options in the gimp-composite code. * gimp-composite-altivec.[ch]: added * gimp-composite-altivec-installer.[ch]: added * gimp-composite-vis.[ch]: added * gimp-composite-vis-installer.[ch]: added * gimp-composite-mmx-installer.[ch]: added * gimp-composite-sse-installer.[ch]: added * gimp-composite-altivec-test.[ch]: added * gimp-composite-vis-test.[ch]: added * gimp-composite-mmx-test.[ch]: added * gimp-composite-sse-test.[ch]: added * make-installer.py: Added meta programme for generating code to 1) construct a table of compositing functions indexed by operation, and the pixel formats of the sources and destination, and 2) generating code for regression testing of these compositing functions against the same functions in gimp-composite-generic.c * gimp-composite-mmx.c (xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx): removing from the current set of optimisations because it appears to be broken. * Makefile.am: modified regression testing targets to now build gimp-composite-*-test where * is any of generic, mmx, sse, altivec, and vis. * gimp-composite.c: moved in initialisation code gimp_composite_init() from gimp-composite-dispatch.c * gimp-composite.c: removed gimp_composite_unsupported(). * gimp-composite.c: use cpu_accel() to determine at run-time which set of optimisations are to be used. * gimp-composite.c: conditionally compile code for ARCH_X86. * make-gimp-composite-dispatch.c: retired. See make-installer.py * gimp-composite-mmx.c (op_overlay): namespace cleanup, op_overlay() and all of the constant values are now static * gimp-composite-mmx.c, gimp-composite-sse.c: fixed bug with the alpha mask being the address of the alpha mask, not the mask itself. * app/paint-funcs/paint-funcs.c: Check gimp_composite_options.use to see if we should use the new code or the old code.
2003-08-14 15:43:34 +08:00
void gimp_composite_dispatch (GimpCompositeContext *ctx);
void gimp_composite_context_print (GimpCompositeContext *ctx);
const gchar * gimp_composite_mode_astext (GimpCompositeOperation op);
const gchar * gimp_composite_pixelformat_astext (GimpPixelFormat format);
composite/ modularisation of the automatic compositing function "wiring" * composite/ modularisation of the automatic compositing function "wiring" to construct the table of compositing functions at run-time instead of compile time. The environment variable GIMP_COMPOSITE is a hexadecimal number representing a bit-field used to set/reset options in the gimp-composite code. * gimp-composite-altivec.[ch]: added * gimp-composite-altivec-installer.[ch]: added * gimp-composite-vis.[ch]: added * gimp-composite-vis-installer.[ch]: added * gimp-composite-mmx-installer.[ch]: added * gimp-composite-sse-installer.[ch]: added * gimp-composite-altivec-test.[ch]: added * gimp-composite-vis-test.[ch]: added * gimp-composite-mmx-test.[ch]: added * gimp-composite-sse-test.[ch]: added * make-installer.py: Added meta programme for generating code to 1) construct a table of compositing functions indexed by operation, and the pixel formats of the sources and destination, and 2) generating code for regression testing of these compositing functions against the same functions in gimp-composite-generic.c * gimp-composite-mmx.c (xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx): removing from the current set of optimisations because it appears to be broken. * Makefile.am: modified regression testing targets to now build gimp-composite-*-test where * is any of generic, mmx, sse, altivec, and vis. * gimp-composite.c: moved in initialisation code gimp_composite_init() from gimp-composite-dispatch.c * gimp-composite.c: removed gimp_composite_unsupported(). * gimp-composite.c: use cpu_accel() to determine at run-time which set of optimisations are to be used. * gimp-composite.c: conditionally compile code for ARCH_X86. * make-gimp-composite-dispatch.c: retired. See make-installer.py * gimp-composite-mmx.c (op_overlay): namespace cleanup, op_overlay() and all of the constant values are now static * gimp-composite-mmx.c, gimp-composite-sse.c: fixed bug with the alpha mask being the address of the alpha mask, not the mask itself. * app/paint-funcs/paint-funcs.c: Check gimp_composite_options.use to see if we should use the new code or the old code.
2003-08-14 15:43:34 +08:00
extern const gchar *gimp_composite_function_name[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N];
composite/ modularisation of the automatic compositing function "wiring" * composite/ modularisation of the automatic compositing function "wiring" to construct the table of compositing functions at run-time instead of compile time. The environment variable GIMP_COMPOSITE is a hexadecimal number representing a bit-field used to set/reset options in the gimp-composite code. * gimp-composite-altivec.[ch]: added * gimp-composite-altivec-installer.[ch]: added * gimp-composite-vis.[ch]: added * gimp-composite-vis-installer.[ch]: added * gimp-composite-mmx-installer.[ch]: added * gimp-composite-sse-installer.[ch]: added * gimp-composite-altivec-test.[ch]: added * gimp-composite-vis-test.[ch]: added * gimp-composite-mmx-test.[ch]: added * gimp-composite-sse-test.[ch]: added * make-installer.py: Added meta programme for generating code to 1) construct a table of compositing functions indexed by operation, and the pixel formats of the sources and destination, and 2) generating code for regression testing of these compositing functions against the same functions in gimp-composite-generic.c * gimp-composite-mmx.c (xxxgimp_composite_overlay_rgba8_rgba8_rgba8_mmx): removing from the current set of optimisations because it appears to be broken. * Makefile.am: modified regression testing targets to now build gimp-composite-*-test where * is any of generic, mmx, sse, altivec, and vis. * gimp-composite.c: moved in initialisation code gimp_composite_init() from gimp-composite-dispatch.c * gimp-composite.c: removed gimp_composite_unsupported(). * gimp-composite.c: use cpu_accel() to determine at run-time which set of optimisations are to be used. * gimp-composite.c: conditionally compile code for ARCH_X86. * make-gimp-composite-dispatch.c: retired. See make-installer.py * gimp-composite-mmx.c (op_overlay): namespace cleanup, op_overlay() and all of the constant values are now static * gimp-composite-mmx.c, gimp-composite-sse.c: fixed bug with the alpha mask being the address of the alpha mask, not the mask itself. * app/paint-funcs/paint-funcs.c: Check gimp_composite_options.use to see if we should use the new code or the old code.
2003-08-14 15:43:34 +08:00
extern void (*gimp_composite_function[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N])(GimpCompositeContext *);
#endif /* __GIMP_COMPOSITE_H__ */