~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/composite/gimp-composite-regression.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
3
 *
5
 
 *
6
4
 * Gimp image compositing
7
5
 * Copyright (C) 2003  Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
8
6
 *
68
66
void
69
67
gimp_composite_regression_print_vector (guchar vector[], GimpPixelFormat format, gulong n_pixels)
70
68
{
71
 
                switch (format)
72
 
                                {
73
 
                                case GIMP_PIXELFORMAT_V8:
74
 
                                                gimp_composite_regression_print_vector_v8 ((gimp_v8_t *) vector, n_pixels);
75
 
                                                break;
76
 
 
77
 
                                case GIMP_PIXELFORMAT_VA8:
78
 
                                                gimp_composite_regression_print_vector_va8 ((gimp_va8_t *) vector, n_pixels);
79
 
                                                break;
80
 
 
81
 
                                case GIMP_PIXELFORMAT_RGB8:
82
 
                                                gimp_composite_regression_print_vector_rgb8 ((gimp_rgb8_t *) vector, n_pixels);
83
 
                                                break;
84
 
 
85
 
                                case GIMP_PIXELFORMAT_RGBA8:
86
 
                                                gimp_composite_regression_print_vector_rgba8 ((gimp_rgba8_t *) vector, n_pixels);
87
 
                                                break;
88
 
 
89
 
                                case GIMP_PIXELFORMAT_ANY:
90
 
                                case GIMP_PIXELFORMAT_N:
91
 
                                default:
92
 
                                                break;
93
 
                                }
 
69
                switch (format)
 
70
                                {
 
71
                                case GIMP_PIXELFORMAT_V8:
 
72
                                                gimp_composite_regression_print_vector_v8 ((gimp_v8_t *) vector, n_pixels);
 
73
                                                break;
 
74
 
 
75
                                case GIMP_PIXELFORMAT_VA8:
 
76
                                                gimp_composite_regression_print_vector_va8 ((gimp_va8_t *) vector, n_pixels);
 
77
                                                break;
 
78
 
 
79
                                case GIMP_PIXELFORMAT_RGB8:
 
80
                                                gimp_composite_regression_print_vector_rgb8 ((gimp_rgb8_t *) vector, n_pixels);
 
81
                                                break;
 
82
 
 
83
                                case GIMP_PIXELFORMAT_RGBA8:
 
84
                                                gimp_composite_regression_print_vector_rgba8 ((gimp_rgba8_t *) vector, n_pixels);
 
85
                                                break;
 
86
 
 
87
                                case GIMP_PIXELFORMAT_ANY:
 
88
                                case GIMP_PIXELFORMAT_N:
 
89
                                default:
 
90
                                                break;
 
91
                                }
94
92
}
95
93
 
96
94
 
104
102
void
105
103
gimp_composite_regression_print_vector_v8 (gimp_v8_t v[], unsigned int n_pixels)
106
104
{
107
 
                unsigned int i;
 
105
                unsigned int i;
108
106
 
109
 
                for (i = 0; i < n_pixels; i++)
110
 
                                {
111
 
                                                printf ("#%02x\n", v[i].v);
112
 
                                }
 
107
                for (i = 0; i < n_pixels; i++)
 
108
                                {
 
109
                                                printf ("#%02x\n", v[i].v);
 
110
                                }
113
111
}
114
112
 
115
113
/**
122
120
void
123
121
gimp_composite_regression_print_vector_va8 (gimp_va8_t v[], unsigned int n_pixels)
124
122
{
125
 
                unsigned int i;
 
123
                unsigned int i;
126
124
 
127
 
                for (i = 0; i < n_pixels; i++)
128
 
                                {
129
 
                                                printf ("#%02x,%02X\n", v[i].v, v[i].a);
130
 
                                }
 
125
                for (i = 0; i < n_pixels; i++)
 
126
                                {
 
127
                                                printf ("#%02x,%02X\n", v[i].v, v[i].a);
 
128
                                }
131
129
}
132
130
 
133
131
/**
140
138
void
141
139
gimp_composite_regression_print_vector_rgb8 (gimp_rgb8_t v[], unsigned int n_pixels)
142
140
{
143
 
                unsigned int i;
 
141
                unsigned int i;
144
142
 
145
 
                for (i = 0; i < n_pixels; i++)
146
 
                                {
147
 
                                                printf ("#%02x%02x%02x\n", v[i].r, v[i].g, v[i].b);
148
 
                                }
 
143
                for (i = 0; i < n_pixels; i++)
 
144
                                {
 
145
                                                printf ("#%02x%02x%02x\n", v[i].r, v[i].g, v[i].b);
 
146
                                }
149
147
}
150
148
 
151
149
/**
158
156
void
159
157
gimp_composite_regression_print_vector_rgba8 (gimp_rgba8_t v[], unsigned int n_pixels)
160
158
{
161
 
                unsigned int i;
 
159
                unsigned int i;
162
160
 
163
 
                for (i = 0; i < n_pixels; i++)
164
 
                                {
165
 
                                                printf ("#%02x%02x%02x,%02X\n", v[i].r, v[i].g, v[i].b, v[i].a);
166
 
                                }
 
161
                for (i = 0; i < n_pixels; i++)
 
162
                                {
 
163
                                                printf ("#%02x%02x%02x,%02X\n", v[i].r, v[i].g, v[i].b, v[i].a);
 
164
                                }
167
165
}
168
166
 
169
167
/**
536
534
 **/
537
535
GimpCompositeContext *
538
536
gimp_composite_context_init (GimpCompositeContext *ctx,
539
 
                                                                                                                                                                                                                                        GimpCompositeOperation op,
540
 
                                                                                                                                                                                                                                        GimpPixelFormat a_format,
541
 
                                                                                                                                                                                                                                        GimpPixelFormat b_format,
542
 
                                                                                                                                                                                                                                        GimpPixelFormat d_format,
543
 
                                                                                                                                                                                                                                        GimpPixelFormat m_format,
544
 
                                                                                                                                                                                                                                        unsigned long n_pixels,
545
 
                                                                                                                                                                                                                                        unsigned char *A,
546
 
                                                                                                                                                                                                                                        unsigned char *B,
547
 
                                                                                                                                                                                                                                        unsigned char *M,
548
 
                                                                                                                                                                                                                                        unsigned char *D)
 
537
                                                                                                                                                                                                                                        GimpCompositeOperation op,
 
538
                                                                                                                                                                                                                                        GimpPixelFormat a_format,
 
539
                                                                                                                                                                                                                                        GimpPixelFormat b_format,
 
540
                                                                                                                                                                                                                                        GimpPixelFormat d_format,
 
541
                                                                                                                                                                                                                                        GimpPixelFormat m_format,
 
542
                                                                                                                                                                                                                                        unsigned long n_pixels,
 
543
                                                                                                                                                                                                                                        unsigned char *A,
 
544
                                                                                                                                                                                                                                        unsigned char *B,
 
545
                                                                                                                                                                                                                                        unsigned char *M,
 
546
                                                                                                                                                                                                                                        unsigned char *D)
549
547
{
550
 
                memset ((void *) ctx, 0, sizeof(*ctx));
551
 
                ctx->op = op;
552
 
                ctx->n_pixels = n_pixels;
553
 
                ctx->scale.scale = 2;
554
 
                ctx->pixelformat_A = a_format;
555
 
                ctx->pixelformat_B = b_format;
556
 
                ctx->pixelformat_D = d_format;
557
 
                ctx->pixelformat_M = m_format;
558
 
                ctx->A = (unsigned char *) A;
559
 
                ctx->B = (unsigned char *) B;
560
 
                ctx->M = (unsigned char *) B;
561
 
                ctx->D = (unsigned char *) D;
562
 
                memset (ctx->D, 0, ctx->n_pixels * gimp_composite_pixel_bpp[ctx->pixelformat_D]);
 
548
                memset ((void *) ctx, 0, sizeof(*ctx));
 
549
                ctx->op = op;
 
550
                ctx->n_pixels = n_pixels;
 
551
                ctx->scale.scale = 2;
 
552
                ctx->pixelformat_A = a_format;
 
553
                ctx->pixelformat_B = b_format;
 
554
                ctx->pixelformat_D = d_format;
 
555
                ctx->pixelformat_M = m_format;
 
556
                ctx->A = (unsigned char *) A;
 
557
                ctx->B = (unsigned char *) B;
 
558
                ctx->M = (unsigned char *) B;
 
559
                ctx->D = (unsigned char *) D;
 
560
                memset (ctx->D, 0, ctx->n_pixels * gimp_composite_pixel_bpp[ctx->pixelformat_D]);
563
561
 
564
 
                return (ctx);
 
562
                return (ctx);
565
563
}