author | mickeyl <mickeyl> | 2003-09-16 13:07:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-09-16 13:07:56 (UTC) |
commit | 9cd1a5708fa9f10e391bd18cbf1f5800cdc76851 (patch) (unidiff) | |
tree | 65404702ea418b9270158a941b408870d981eca4 | |
parent | 81171716bb686e709f27fbbc0931740aa9d9462a (diff) | |
download | opie-9cd1a5708fa9f10e391bd18cbf1f5800cdc76851.zip opie-9cd1a5708fa9f10e391bd18cbf1f5800cdc76851.tar.gz opie-9cd1a5708fa9f10e391bd18cbf1f5800cdc76851.tar.bz2 |
remove unneccessary #include
-rw-r--r-- | libopie2/opieui/oimageeffect.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/libopie2/opieui/oimageeffect.cpp b/libopie2/opieui/oimageeffect.cpp index 2855da6..01e7c6f 100644 --- a/libopie2/opieui/oimageeffect.cpp +++ b/libopie2/opieui/oimageeffect.cpp | |||
@@ -1,292 +1,291 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@kde.org> | 2 | Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@kde.org> |
3 | (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> | 3 | (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> |
4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> | 4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> |
5 | (C) 2000 Josef Weidendorfer <weidendo@in.tum.de> | 5 | (C) 2000 Josef Weidendorfer <weidendo@in.tum.de> |
6 | 6 | ||
7 | Redistribution and use in source and binary forms, with or without | 7 | Redistribution and use in source and binary forms, with or without |
8 | modification, are permitted provided that the following conditions | 8 | modification, are permitted provided that the following conditions |
9 | are met: | 9 | are met: |
10 | 10 | ||
11 | 1. Redistributions of source code must retain the above copyright | 11 | 1. Redistributions of source code must retain the above copyright |
12 | notice, this list of conditions and the following disclaimer. | 12 | notice, this list of conditions and the following disclaimer. |
13 | 2. Redistributions in binary form must reproduce the above copyright | 13 | 2. Redistributions in binary form must reproduce the above copyright |
14 | notice, this list of conditions and the following disclaimer in the | 14 | notice, this list of conditions and the following disclaimer in the |
15 | documentation and/or other materials provided with the distribution. | 15 | documentation and/or other materials provided with the distribution. |
16 | 16 | ||
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | // $Id$ | 30 | // $Id$ |
31 | 31 | ||
32 | #include <math.h> | 32 | #include <math.h> |
33 | 33 | ||
34 | #include <qimage.h> | 34 | #include <qimage.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | #include <iostream> | ||
37 | 36 | ||
38 | #include "oimageeffect.h" | 37 | #include "oimageeffect.h" |
39 | 38 | ||
40 | #define MaxRGB 255L | 39 | #define MaxRGB 255L |
41 | #define DegreesToRadians(x) ((x)*M_PI/180.0) | 40 | #define DegreesToRadians(x) ((x)*M_PI/180.0) |
42 | 41 | ||
43 | using namespace std; | 42 | using namespace std; |
44 | 43 | ||
45 | inline unsigned int intensityValue(unsigned int color) | 44 | inline unsigned int intensityValue(unsigned int color) |
46 | { | 45 | { |
47 | return((unsigned int)((0.299*qRed(color) + | 46 | return((unsigned int)((0.299*qRed(color) + |
48 | 0.587*qGreen(color) + | 47 | 0.587*qGreen(color) + |
49 | 0.1140000000000001*qBlue(color)))); | 48 | 0.1140000000000001*qBlue(color)))); |
50 | } | 49 | } |
51 | 50 | ||
52 | //====================================================================== | 51 | //====================================================================== |
53 | // | 52 | // |
54 | // Gradient effects | 53 | // Gradient effects |
55 | // | 54 | // |
56 | //====================================================================== | 55 | //====================================================================== |
57 | 56 | ||
58 | QImage OImageEffect::gradient(const QSize &size, const QColor &ca, | 57 | QImage OImageEffect::gradient(const QSize &size, const QColor &ca, |
59 | const QColor &cb, GradientType eff, int ncols) | 58 | const QColor &cb, GradientType eff, int ncols) |
60 | { | 59 | { |
61 | int rDiff, gDiff, bDiff; | 60 | int rDiff, gDiff, bDiff; |
62 | int rca, gca, bca, rcb, gcb, bcb; | 61 | int rca, gca, bca, rcb, gcb, bcb; |
63 | 62 | ||
64 | QImage image(size, 32); | 63 | QImage image(size, 32); |
65 | 64 | ||
66 | if (size.width() == 0 || size.height() == 0) { | 65 | if (size.width() == 0 || size.height() == 0) { |
67 | qDebug( "WARNING: OImageEffect::gradient: invalid image" ); | 66 | qDebug( "WARNING: OImageEffect::gradient: invalid image" ); |
68 | return image; | 67 | return image; |
69 | } | 68 | } |
70 | 69 | ||
71 | register int x, y; | 70 | register int x, y; |
72 | 71 | ||
73 | rDiff = (rcb = cb.red()) - (rca = ca.red()); | 72 | rDiff = (rcb = cb.red()) - (rca = ca.red()); |
74 | gDiff = (gcb = cb.green()) - (gca = ca.green()); | 73 | gDiff = (gcb = cb.green()) - (gca = ca.green()); |
75 | bDiff = (bcb = cb.blue()) - (bca = ca.blue()); | 74 | bDiff = (bcb = cb.blue()) - (bca = ca.blue()); |
76 | 75 | ||
77 | if( eff == VerticalGradient || eff == HorizontalGradient ){ | 76 | if( eff == VerticalGradient || eff == HorizontalGradient ){ |
78 | 77 | ||
79 | uint *p; | 78 | uint *p; |
80 | uint rgb; | 79 | uint rgb; |
81 | 80 | ||
82 | register int rl = rca << 16; | 81 | register int rl = rca << 16; |
83 | register int gl = gca << 16; | 82 | register int gl = gca << 16; |
84 | register int bl = bca << 16; | 83 | register int bl = bca << 16; |
85 | 84 | ||
86 | if( eff == VerticalGradient ) { | 85 | if( eff == VerticalGradient ) { |
87 | 86 | ||
88 | int rcdelta = ((1<<16) / size.height()) * rDiff; | 87 | int rcdelta = ((1<<16) / size.height()) * rDiff; |
89 | int gcdelta = ((1<<16) / size.height()) * gDiff; | 88 | int gcdelta = ((1<<16) / size.height()) * gDiff; |
90 | int bcdelta = ((1<<16) / size.height()) * bDiff; | 89 | int bcdelta = ((1<<16) / size.height()) * bDiff; |
91 | 90 | ||
92 | for ( y = 0; y < size.height(); y++ ) { | 91 | for ( y = 0; y < size.height(); y++ ) { |
93 | p = (uint *) image.scanLine(y); | 92 | p = (uint *) image.scanLine(y); |
94 | 93 | ||
95 | rl += rcdelta; | 94 | rl += rcdelta; |
96 | gl += gcdelta; | 95 | gl += gcdelta; |
97 | bl += bcdelta; | 96 | bl += bcdelta; |
98 | 97 | ||
99 | rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) ); | 98 | rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) ); |
100 | 99 | ||
101 | for( x = 0; x < size.width(); x++ ) { | 100 | for( x = 0; x < size.width(); x++ ) { |
102 | *p = rgb; | 101 | *p = rgb; |
103 | p++; | 102 | p++; |
104 | } | 103 | } |
105 | } | 104 | } |
106 | 105 | ||
107 | } | 106 | } |
108 | else { // must be HorizontalGradient | 107 | else { // must be HorizontalGradient |
109 | 108 | ||
110 | unsigned int *o_src = (unsigned int *)image.scanLine(0); | 109 | unsigned int *o_src = (unsigned int *)image.scanLine(0); |
111 | unsigned int *src = o_src; | 110 | unsigned int *src = o_src; |
112 | 111 | ||
113 | int rcdelta = ((1<<16) / size.width()) * rDiff; | 112 | int rcdelta = ((1<<16) / size.width()) * rDiff; |
114 | int gcdelta = ((1<<16) / size.width()) * gDiff; | 113 | int gcdelta = ((1<<16) / size.width()) * gDiff; |
115 | int bcdelta = ((1<<16) / size.width()) * bDiff; | 114 | int bcdelta = ((1<<16) / size.width()) * bDiff; |
116 | 115 | ||
117 | for( x = 0; x < size.width(); x++) { | 116 | for( x = 0; x < size.width(); x++) { |
118 | 117 | ||
119 | rl += rcdelta; | 118 | rl += rcdelta; |
120 | gl += gcdelta; | 119 | gl += gcdelta; |
121 | bl += bcdelta; | 120 | bl += bcdelta; |
122 | 121 | ||
123 | *src++ = qRgb( (rl>>16), (gl>>16), (bl>>16)); | 122 | *src++ = qRgb( (rl>>16), (gl>>16), (bl>>16)); |
124 | } | 123 | } |
125 | 124 | ||
126 | src = o_src; | 125 | src = o_src; |
127 | 126 | ||
128 | // Believe it or not, manually copying in a for loop is faster | 127 | // Believe it or not, manually copying in a for loop is faster |
129 | // than calling memcpy for each scanline (on the order of ms...). | 128 | // than calling memcpy for each scanline (on the order of ms...). |
130 | // I think this is due to the function call overhead (mosfet). | 129 | // I think this is due to the function call overhead (mosfet). |
131 | 130 | ||
132 | for (y = 1; y < size.height(); ++y) { | 131 | for (y = 1; y < size.height(); ++y) { |
133 | 132 | ||
134 | p = (unsigned int *)image.scanLine(y); | 133 | p = (unsigned int *)image.scanLine(y); |
135 | src = o_src; | 134 | src = o_src; |
136 | for(x=0; x < size.width(); ++x) | 135 | for(x=0; x < size.width(); ++x) |
137 | *p++ = *src++; | 136 | *p++ = *src++; |
138 | } | 137 | } |
139 | } | 138 | } |
140 | } | 139 | } |
141 | 140 | ||
142 | else { | 141 | else { |
143 | 142 | ||
144 | float rfd, gfd, bfd; | 143 | float rfd, gfd, bfd; |
145 | float rd = rca, gd = gca, bd = bca; | 144 | float rd = rca, gd = gca, bd = bca; |
146 | 145 | ||
147 | unsigned char *xtable[3]; | 146 | unsigned char *xtable[3]; |
148 | unsigned char *ytable[3]; | 147 | unsigned char *ytable[3]; |
149 | 148 | ||
150 | unsigned int w = size.width(), h = size.height(); | 149 | unsigned int w = size.width(), h = size.height(); |
151 | xtable[0] = new unsigned char[w]; | 150 | xtable[0] = new unsigned char[w]; |
152 | xtable[1] = new unsigned char[w]; | 151 | xtable[1] = new unsigned char[w]; |
153 | xtable[2] = new unsigned char[w]; | 152 | xtable[2] = new unsigned char[w]; |
154 | ytable[0] = new unsigned char[h]; | 153 | ytable[0] = new unsigned char[h]; |
155 | ytable[1] = new unsigned char[h]; | 154 | ytable[1] = new unsigned char[h]; |
156 | ytable[2] = new unsigned char[h]; | 155 | ytable[2] = new unsigned char[h]; |
157 | w*=2, h*=2; | 156 | w*=2, h*=2; |
158 | 157 | ||
159 | if ( eff == DiagonalGradient || eff == CrossDiagonalGradient) { | 158 | if ( eff == DiagonalGradient || eff == CrossDiagonalGradient) { |
160 | // Diagonal dgradient code inspired by BlackBox (mosfet) | 159 | // Diagonal dgradient code inspired by BlackBox (mosfet) |
161 | // BlackBox dgradient is (C) Brad Hughes, <bhughes@tcac.net> and | 160 | // BlackBox dgradient is (C) Brad Hughes, <bhughes@tcac.net> and |
162 | // Mike Cole <mike@mydot.com>. | 161 | // Mike Cole <mike@mydot.com>. |
163 | 162 | ||
164 | rfd = (float)rDiff/w; | 163 | rfd = (float)rDiff/w; |
165 | gfd = (float)gDiff/w; | 164 | gfd = (float)gDiff/w; |
166 | bfd = (float)bDiff/w; | 165 | bfd = (float)bDiff/w; |
167 | 166 | ||
168 | int dir; | 167 | int dir; |
169 | for (x = 0; x < size.width(); x++, rd+=rfd, gd+=gfd, bd+=bfd) { | 168 | for (x = 0; x < size.width(); x++, rd+=rfd, gd+=gfd, bd+=bfd) { |
170 | dir = eff == DiagonalGradient? x : size.width() - x - 1; | 169 | dir = eff == DiagonalGradient? x : size.width() - x - 1; |
171 | xtable[0][dir] = (unsigned char) rd; | 170 | xtable[0][dir] = (unsigned char) rd; |
172 | xtable[1][dir] = (unsigned char) gd; | 171 | xtable[1][dir] = (unsigned char) gd; |
173 | xtable[2][dir] = (unsigned char) bd; | 172 | xtable[2][dir] = (unsigned char) bd; |
174 | } | 173 | } |
175 | rfd = (float)rDiff/h; | 174 | rfd = (float)rDiff/h; |
176 | gfd = (float)gDiff/h; | 175 | gfd = (float)gDiff/h; |
177 | bfd = (float)bDiff/h; | 176 | bfd = (float)bDiff/h; |
178 | rd = gd = bd = 0; | 177 | rd = gd = bd = 0; |
179 | for (y = 0; y < size.height(); y++, rd+=rfd, gd+=gfd, bd+=bfd) { | 178 | for (y = 0; y < size.height(); y++, rd+=rfd, gd+=gfd, bd+=bfd) { |
180 | ytable[0][y] = (unsigned char) rd; | 179 | ytable[0][y] = (unsigned char) rd; |
181 | ytable[1][y] = (unsigned char) gd; | 180 | ytable[1][y] = (unsigned char) gd; |
182 | ytable[2][y] = (unsigned char) bd; | 181 | ytable[2][y] = (unsigned char) bd; |
183 | } | 182 | } |
184 | 183 | ||
185 | for (y = 0; y < size.height(); y++) { | 184 | for (y = 0; y < size.height(); y++) { |
186 | unsigned int *scanline = (unsigned int *)image.scanLine(y); | 185 | unsigned int *scanline = (unsigned int *)image.scanLine(y); |
187 | for (x = 0; x < size.width(); x++) { | 186 | for (x = 0; x < size.width(); x++) { |
188 | scanline[x] = qRgb(xtable[0][x] + ytable[0][y], | 187 | scanline[x] = qRgb(xtable[0][x] + ytable[0][y], |
189 | xtable[1][x] + ytable[1][y], | 188 | xtable[1][x] + ytable[1][y], |
190 | xtable[2][x] + ytable[2][y]); | 189 | xtable[2][x] + ytable[2][y]); |
191 | } | 190 | } |
192 | } | 191 | } |
193 | } | 192 | } |
194 | 193 | ||
195 | else if (eff == RectangleGradient || | 194 | else if (eff == RectangleGradient || |
196 | eff == PyramidGradient || | 195 | eff == PyramidGradient || |
197 | eff == PipeCrossGradient || | 196 | eff == PipeCrossGradient || |
198 | eff == EllipticGradient) | 197 | eff == EllipticGradient) |
199 | { | 198 | { |
200 | int rSign = rDiff>0? 1: -1; | 199 | int rSign = rDiff>0? 1: -1; |
201 | int gSign = gDiff>0? 1: -1; | 200 | int gSign = gDiff>0? 1: -1; |
202 | int bSign = bDiff>0? 1: -1; | 201 | int bSign = bDiff>0? 1: -1; |
203 | 202 | ||
204 | rfd = (float)rDiff / size.width(); | 203 | rfd = (float)rDiff / size.width(); |
205 | gfd = (float)gDiff / size.width(); | 204 | gfd = (float)gDiff / size.width(); |
206 | bfd = (float)bDiff / size.width(); | 205 | bfd = (float)bDiff / size.width(); |
207 | 206 | ||
208 | rd = (float)rDiff/2; | 207 | rd = (float)rDiff/2; |
209 | gd = (float)gDiff/2; | 208 | gd = (float)gDiff/2; |
210 | bd = (float)bDiff/2; | 209 | bd = (float)bDiff/2; |
211 | 210 | ||
212 | for (x = 0; x < size.width(); x++, rd-=rfd, gd-=gfd, bd-=bfd) | 211 | for (x = 0; x < size.width(); x++, rd-=rfd, gd-=gfd, bd-=bfd) |
213 | { | 212 | { |
214 | xtable[0][x] = (unsigned char) abs((int)rd); | 213 | xtable[0][x] = (unsigned char) abs((int)rd); |
215 | xtable[1][x] = (unsigned char) abs((int)gd); | 214 | xtable[1][x] = (unsigned char) abs((int)gd); |
216 | xtable[2][x] = (unsigned char) abs((int)bd); | 215 | xtable[2][x] = (unsigned char) abs((int)bd); |
217 | } | 216 | } |
218 | 217 | ||
219 | rfd = (float)rDiff/size.height(); | 218 | rfd = (float)rDiff/size.height(); |
220 | gfd = (float)gDiff/size.height(); | 219 | gfd = (float)gDiff/size.height(); |
221 | bfd = (float)bDiff/size.height(); | 220 | bfd = (float)bDiff/size.height(); |
222 | 221 | ||
223 | rd = (float)rDiff/2; | 222 | rd = (float)rDiff/2; |
224 | gd = (float)gDiff/2; | 223 | gd = (float)gDiff/2; |
225 | bd = (float)bDiff/2; | 224 | bd = (float)bDiff/2; |
226 | 225 | ||
227 | for (y = 0; y < size.height(); y++, rd-=rfd, gd-=gfd, bd-=bfd) | 226 | for (y = 0; y < size.height(); y++, rd-=rfd, gd-=gfd, bd-=bfd) |
228 | { | 227 | { |
229 | ytable[0][y] = (unsigned char) abs((int)rd); | 228 | ytable[0][y] = (unsigned char) abs((int)rd); |
230 | ytable[1][y] = (unsigned char) abs((int)gd); | 229 | ytable[1][y] = (unsigned char) abs((int)gd); |
231 | ytable[2][y] = (unsigned char) abs((int)bd); | 230 | ytable[2][y] = (unsigned char) abs((int)bd); |
232 | } | 231 | } |
233 | unsigned int rgb; | 232 | unsigned int rgb; |
234 | int h = (size.height()+1)>>1; | 233 | int h = (size.height()+1)>>1; |
235 | for (y = 0; y < h; y++) { | 234 | for (y = 0; y < h; y++) { |
236 | unsigned int *sl1 = (unsigned int *)image.scanLine(y); | 235 | unsigned int *sl1 = (unsigned int *)image.scanLine(y); |
237 | unsigned int *sl2 = (unsigned int *)image.scanLine(QMAX(size.height()-y-1, y)); | 236 | unsigned int *sl2 = (unsigned int *)image.scanLine(QMAX(size.height()-y-1, y)); |
238 | 237 | ||
239 | int w = (size.width()+1)>>1; | 238 | int w = (size.width()+1)>>1; |
240 | int x2 = size.width()-1; | 239 | int x2 = size.width()-1; |
241 | 240 | ||
242 | for (x = 0; x < w; x++, x2--) { | 241 | for (x = 0; x < w; x++, x2--) { |
243 | rgb = 0; | 242 | rgb = 0; |
244 | if (eff == PyramidGradient) { | 243 | if (eff == PyramidGradient) { |
245 | rgb = qRgb(rcb-rSign*(xtable[0][x]+ytable[0][y]), | 244 | rgb = qRgb(rcb-rSign*(xtable[0][x]+ytable[0][y]), |
246 | gcb-gSign*(xtable[1][x]+ytable[1][y]), | 245 | gcb-gSign*(xtable[1][x]+ytable[1][y]), |
247 | bcb-bSign*(xtable[2][x]+ytable[2][y])); | 246 | bcb-bSign*(xtable[2][x]+ytable[2][y])); |
248 | } | 247 | } |
249 | if (eff == RectangleGradient) { | 248 | if (eff == RectangleGradient) { |
250 | rgb = qRgb(rcb - rSign * | 249 | rgb = qRgb(rcb - rSign * |
251 | QMAX(xtable[0][x], ytable[0][y]) * 2, | 250 | QMAX(xtable[0][x], ytable[0][y]) * 2, |
252 | gcb - gSign * | 251 | gcb - gSign * |
253 | QMAX(xtable[1][x], ytable[1][y]) * 2, | 252 | QMAX(xtable[1][x], ytable[1][y]) * 2, |
254 | bcb - bSign * | 253 | bcb - bSign * |
255 | QMAX(xtable[2][x], ytable[2][y]) * 2); | 254 | QMAX(xtable[2][x], ytable[2][y]) * 2); |
256 | } | 255 | } |
257 | if (eff == PipeCrossGradient) { | 256 | if (eff == PipeCrossGradient) { |
258 | rgb = qRgb(rcb - rSign * | 257 | rgb = qRgb(rcb - rSign * |
259 | QMIN(xtable[0][x], ytable[0][y]) * 2, | 258 | QMIN(xtable[0][x], ytable[0][y]) * 2, |
260 | gcb - gSign * | 259 | gcb - gSign * |
261 | QMIN(xtable[1][x], ytable[1][y]) * 2, | 260 | QMIN(xtable[1][x], ytable[1][y]) * 2, |
262 | bcb - bSign * | 261 | bcb - bSign * |
263 | QMIN(xtable[2][x], ytable[2][y]) * 2); | 262 | QMIN(xtable[2][x], ytable[2][y]) * 2); |
264 | } | 263 | } |
265 | if (eff == EllipticGradient) { | 264 | if (eff == EllipticGradient) { |
266 | rgb = qRgb(rcb - rSign * | 265 | rgb = qRgb(rcb - rSign * |
267 | (int)sqrt((xtable[0][x]*xtable[0][x] + | 266 | (int)sqrt((xtable[0][x]*xtable[0][x] + |
268 | ytable[0][y]*ytable[0][y])*2.0), | 267 | ytable[0][y]*ytable[0][y])*2.0), |
269 | gcb - gSign * | 268 | gcb - gSign * |
270 | (int)sqrt((xtable[1][x]*xtable[1][x] + | 269 | (int)sqrt((xtable[1][x]*xtable[1][x] + |
271 | ytable[1][y]*ytable[1][y])*2.0), | 270 | ytable[1][y]*ytable[1][y])*2.0), |
272 | bcb - bSign * | 271 | bcb - bSign * |
273 | (int)sqrt((xtable[2][x]*xtable[2][x] + | 272 | (int)sqrt((xtable[2][x]*xtable[2][x] + |
274 | ytable[2][y]*ytable[2][y])*2.0)); | 273 | ytable[2][y]*ytable[2][y])*2.0)); |
275 | } | 274 | } |
276 | 275 | ||
277 | sl1[x] = sl2[x] = rgb; | 276 | sl1[x] = sl2[x] = rgb; |
278 | sl1[x2] = sl2[x2] = rgb; | 277 | sl1[x2] = sl2[x2] = rgb; |
279 | } | 278 | } |
280 | } | 279 | } |
281 | } | 280 | } |
282 | 281 | ||
283 | delete [] xtable[0]; | 282 | delete [] xtable[0]; |
284 | delete [] xtable[1]; | 283 | delete [] xtable[1]; |
285 | delete [] xtable[2]; | 284 | delete [] xtable[2]; |
286 | delete [] ytable[0]; | 285 | delete [] ytable[0]; |
287 | delete [] ytable[1]; | 286 | delete [] ytable[1]; |
288 | delete [] ytable[2]; | 287 | delete [] ytable[2]; |
289 | } | 288 | } |
290 | 289 | ||
291 | // dither if necessary | 290 | // dither if necessary |
292 | if (ncols && (QPixmap::defaultDepth() < 15 )) { | 291 | if (ncols && (QPixmap::defaultDepth() < 15 )) { |