summaryrefslogtreecommitdiff
path: root/noncore/styles/theme/ogfxeffect.cpp
Unidiff
Diffstat (limited to 'noncore/styles/theme/ogfxeffect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/ogfxeffect.cpp72
1 files changed, 38 insertions, 34 deletions
diff --git a/noncore/styles/theme/ogfxeffect.cpp b/noncore/styles/theme/ogfxeffect.cpp
index 90b45fe..ab63c98 100644
--- a/noncore/styles/theme/ogfxeffect.cpp
+++ b/noncore/styles/theme/ogfxeffect.cpp
@@ -7,13 +7,17 @@
7 7
8// $Id$ 8// $Id$
9 9
10#include <qimage.h> 10#include "ogfxeffect.h"
11#include <qpainter.h>
12 11
12/* OPIE */
13#include <opie2/odebug.h>
13#include <qpe/qmath.h> 14#include <qpe/qmath.h>
14 15
15#include "ogfxeffect.h" 16/* QT */
17#include <qimage.h>
18#include <qpainter.h>
16 19
20/* STD */
17#include <cstdlib> 21#include <cstdlib>
18#include <cmath> 22#include <cmath>
19 23
@@ -25,27 +29,27 @@
25 29
26 30
27QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca, 31QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca,
28 const QColor &cb, GradientType eff, int ncols) 32 const QColor &cb, GradientType eff, int ncols)
29{ 33{
30 if ( !pixmap. isNull ( )) { 34 if ( !pixmap. isNull ( )) {
31 QImage image = gradient(pixmap.size(), ca, cb, eff, ncols); 35 QImage image = gradient(pixmap.size(), ca, cb, eff, ncols);
32 pixmap.convertFromImage(image); 36 pixmap.convertFromImage(image);
33 } 37 }
34 return pixmap; 38 return pixmap;
35} 39}
36 40
37QImage OGfxEffect::gradient(const QSize &size, const QColor &ca, 41QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
38 const QColor &cb, GradientType eff, int /*ncols*/) 42 const QColor &cb, GradientType eff, int /*ncols*/)
39{ 43{
40 int rDiff, gDiff, bDiff; 44 int rDiff, gDiff, bDiff;
41 int rca, gca, bca, rcb, gcb, bcb; 45 int rca, gca, bca, rcb, gcb, bcb;
42
43 QImage image(size, 32);
44 46
45 if (size.width() == 0 || size.height() == 0) { 47 QImage image(size, 32);
46 qDebug ( "WARNING: OGfxEffect::gradient: invalid image" ); 48
47 return image; 49 if (size.width() == 0 || size.height() == 0) {
48 } 50 odebug << "WARNING: OGfxEffect::gradient: invalid image" << oendl;
51 return image;
52 }
49 53
50 register int x, y; 54 register int x, y;
51 55
@@ -278,19 +282,19 @@ QImage OGfxEffect::gradient(const QSize &size, const QColor &ca,
278 282
279 283
280QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity, 284QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity,
281 const QColor &bgnd, GradientType eff, 285 const QColor &bgnd, GradientType eff,
282 bool anti_dir, int /*ncols*/) 286 bool anti_dir, int /*ncols*/)
283{ 287{
284 if ( !pixmap. isNull ( )) { 288 if ( !pixmap. isNull ( )) {
285 QImage image = pixmap.convertToImage(); 289 QImage image = pixmap.convertToImage();
286 OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir); 290 OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir);
287 291
288 if ( pixmap. depth ( ) <= 8 ) 292 if ( pixmap. depth ( ) <= 8 )
289 image. convertDepth ( pixmap. depth ( )); 293 image. convertDepth ( pixmap. depth ( ));
290 294
291 pixmap.convertFromImage(image); 295 pixmap.convertFromImage(image);
292 } 296 }
293 return pixmap; 297 return pixmap;
294} 298}
295 299
296 300
@@ -299,7 +303,7 @@ QImage& OGfxEffect::blend(QImage &image, float initial_intensity,
299 bool anti_dir) 303 bool anti_dir)
300{ 304{
301 if (image.width() == 0 || image.height() == 0) { 305 if (image.width() == 0 || image.height() == 0) {
302 qDebug ( "Invalid image\n" ); 306 odebug << "Invalid image" << oendl;
303 return image; 307 return image;
304 } 308 }
305 309
@@ -484,8 +488,8 @@ QImage& OGfxEffect::blend(QImage &image, float initial_intensity,
484 } 488 }
485 } 489 }
486 490
487 else 491 else
488 qDebug ( "not implemented\n" ); 492 odebug << "not implemented" << oendl;
489 493
490 return image; 494 return image;
491} 495}
@@ -494,7 +498,7 @@ QImage& OGfxEffect::blend(QImage &image, float initial_intensity,
494// Not very efficient as we create a third big image... 498// Not very efficient as we create a third big image...
495// 499//
496QImage& KQGfxEffect::blend(QImage &image1, QImage &image2, 500QImage& KQGfxEffect::blend(QImage &image1, QImage &image2,
497 GradientType gt, int xf, int yf) 501 GradientType gt, int xf, int yf)
498{ 502{
499 if (image1.width() == 0 || image1.height() == 0 || 503 if (image1.width() == 0 || image1.height() == 0 ||
500 image2.width() == 0 || image2.height() == 0) 504 image2.width() == 0 || image2.height() == 0)
@@ -503,8 +507,8 @@ QImage& KQGfxEffect::blend(QImage &image1, QImage &image2,
503 QImage image3; 507 QImage image3;
504 508
505 image3 = KQGfxEffect::unbalancedGradient(image1.size(), 509 image3 = KQGfxEffect::unbalancedGradient(image1.size(),
506 QColor(0,0,0), QColor(255,255,255), 510 QColor(0,0,0), QColor(255,255,255),
507 gt, xf, yf, 0); 511 gt, xf, yf, 0);
508 512
509 return blend(image1,image2,image3, Red); // Channel to use is arbitrary 513 return blend(image1,image2,image3, Red); // Channel to use is arbitrary
510} 514}