1
/* -*- mode: c tab-width: 2; c-basic-indent: 2; indent-tabs-mode: nil -*-
2
* The GIMP -- an image manipulation program
1
/* GIMP - The GNU Image Manipulation Program
3
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
6
4
* Gimp image compositing
7
5
* Copyright (C) 2003 Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
33
30
#include "gimp-composite.h"
35
32
#include "gimp-composite-generic.h"
37
35
#include "gimp-composite-mmx.h"
38
36
#include "gimp-composite-sse.h"
42
41
* Details about pixel formats, bits-per-pixel alpha and non alpha
43
42
* versions of pixel formats.
66
65
0, /* GIMP_PIXELFORMAT_ANY */
69
const gchar *gimp_composite_pixel_name[] =
71
"GIMP_PIXELFORMAT_V8",
72
"GIMP_PIXELFORMAT_VA8",
73
"GIMP_PIXELFORMAT_RGB8",
74
"GIMP_PIXELFORMAT_RGBA8",
75
#if GIMP_COMPOSITE_16BIT
76
"GIMP_PIXELFORMAT_V16",
77
"GIMP_PIXELFORMAT_VA16",
78
"GIMP_PIXELFORMAT_RGB16 ",
79
"GIMP_PIXELFORMAT_RGBA16 ",
81
#if GIMP_COMPOSITE_32BIT
82
"GIMP_PIXELFORMAT_V32",
83
"GIMP_PIXELFORMAT_VA32",
84
"GIMP_PIXELFORMAT_RGB32 ",
85
"GIMP_PIXELFORMAT_RGBA32 ",
87
"GIMP_PIXELFORMAT_ANY",
91
69
* Report true (non-zero) if a pixel format has alpha.
174
152
{ FALSE, FALSE, FALSE }, /* GIMP_CONVERT */
179
gchar announce_function;
180
} gimp_composite_debug;
182
155
struct GimpCompositeOptions gimp_composite_options =
184
157
GIMP_COMPOSITE_OPTION_USE
187
160
const gchar * gimp_composite_function_name[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N];
188
void (*gimp_composite_function[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N])(GimpCompositeContext *);
162
void (* gimp_composite_function[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N])(GimpCompositeContext *);
191
165
* gimp_composite_dispatch:
199
173
gimp_composite_dispatch (GimpCompositeContext *ctx)
201
void (*function) (GimpCompositeContext *);
175
void (* function) (GimpCompositeContext *);
203
177
function = gimp_composite_function[ctx->op][ctx->pixelformat_A][ctx->pixelformat_B][ctx->pixelformat_D];
207
181
if (gimp_composite_options.bits & GIMP_COMPOSITE_OPTION_VERBOSE)
209
printf ("%s %s %s %s = %p\n",
210
gimp_composite_mode_astext (ctx->op),
211
gimp_composite_pixelformat_astext (ctx->pixelformat_A),
212
gimp_composite_pixelformat_astext (ctx->pixelformat_B),
213
gimp_composite_pixelformat_astext (ctx->pixelformat_D),
183
g_print ("%s %s %s %s = %p\n",
184
gimp_composite_mode_astext (ctx->op),
185
gimp_composite_pixelformat_astext (ctx->pixelformat_A),
186
gimp_composite_pixelformat_astext (ctx->pixelformat_B),
187
gimp_composite_pixelformat_astext (ctx->pixelformat_D),
221
printf ("gimp_composite: unsupported operation: %s %s %s %s\n",
195
g_print ("gimp_composite: unsupported operation: %s %s %s %s\n",
222
196
gimp_composite_mode_astext (ctx->op),
223
197
gimp_composite_pixelformat_astext (ctx->pixelformat_A),
224
198
gimp_composite_pixelformat_astext (ctx->pixelformat_B),
236
210
gimp_composite_context_print (GimpCompositeContext *ctx)
238
printf ("%p: op=%s\n A=%s(%d):%p\n B=%s(%d):%p\n D=%s(%d):%p\n M=%s(%d):%p\n n_pixels=%lu\n",
240
gimp_composite_mode_astext (ctx->op),
241
gimp_composite_pixelformat_astext (ctx->pixelformat_A),
242
ctx->pixelformat_A, ctx->A,
243
gimp_composite_pixelformat_astext (ctx->pixelformat_B),
244
ctx->pixelformat_B, ctx->B,
245
gimp_composite_pixelformat_astext (ctx->pixelformat_D),
246
ctx->pixelformat_D, ctx->D,
247
gimp_composite_pixelformat_astext (ctx->pixelformat_M),
248
ctx->pixelformat_M, ctx->M,
212
g_print ("%p: op=%s\n A=%s(%d):%p\n B=%s(%d):%p\n D=%s(%d):%p\n M=%s(%d):%p\n n_pixels=%lu\n",
214
gimp_composite_mode_astext (ctx->op),
215
gimp_composite_pixelformat_astext (ctx->pixelformat_A),
216
ctx->pixelformat_A, ctx->A,
217
gimp_composite_pixelformat_astext (ctx->pixelformat_B),
218
ctx->pixelformat_B, ctx->B,
219
gimp_composite_pixelformat_astext (ctx->pixelformat_D),
220
ctx->pixelformat_D, ctx->D,
221
gimp_composite_pixelformat_astext (ctx->pixelformat_M),
222
ctx->pixelformat_M, ctx->M,
361
335
gimp_composite_options.bits = strtoul(p, NULL, 16);
365
gimp_composite_options.bits |= GIMP_COMPOSITE_OPTION_NOEXTENSIONS;
339
gimp_composite_options.bits |= GIMP_COMPOSITE_OPTION_NOEXTENSIONS;
368
342
g_printerr ("gimp_composite: use=%s, verbose=%s\n",