-rw-r--r-- | libopie2/opieui/oimageeffect.cpp | 76 |
1 files changed, 25 insertions, 51 deletions
diff --git a/libopie2/opieui/oimageeffect.cpp b/libopie2/opieui/oimageeffect.cpp index 3c28bbe..2855da6 100644 --- a/libopie2/opieui/oimageeffect.cpp +++ b/libopie2/opieui/oimageeffect.cpp @@ -63,11 +63,9 @@ QImage OImageEffect::gradient(const QSize &size, const QColor &ca, QImage image(size, 32); if (size.width() == 0 || size.height() == 0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::gradient: invalid image" << endl; -#endif + qDebug( "WARNING: OImageEffect::gradient: invalid image" ); return image; } register int x, y; @@ -351,11 +349,9 @@ QImage OImageEffect::unbalancedGradient(const QSize &size, const QColor &ca, QImage image(size, 32); if (size.width() == 0 || size.height() == 0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::unbalancedGradient : invalid image\n"; -#endif + qDebug( "WARNING: OImageEffect::unbalancedGradient : invalid image" ); return image; } register int x, y; @@ -572,11 +568,9 @@ QImage OImageEffect::unbalancedGradient(const QSize &size, const QColor &ca, QImage& OImageEffect::intensity(QImage &image, float percent) { if (image.width() == 0 || image.height() == 0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::intensity : invalid image\n"; -#endif + qDebug( "WARNING: OImageEffect::intensity : invalid image" ); return image; } int segColors = image.depth() > 8 ? 256 : image.numColors(); @@ -639,11 +633,9 @@ QImage& OImageEffect::intensity(QImage &image, float percent) QImage& OImageEffect::channelIntensity(QImage &image, float percent, RGBComponent channel) { if (image.width() == 0 || image.height() == 0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::channelIntensity : invalid image\n"; -#endif + qDebug( "WARNING: OImageEffect::channelIntensity : invalid image" ); return image; } int segColors = image.depth() > 8 ? 256 : image.numColors(); @@ -731,12 +723,10 @@ QImage& OImageEffect::modulate(QImage &image, QImage &modImage, bool reverse, ModulationType type, int factor, RGBComponent channel) { if (image.width() == 0 || image.height() == 0 || modImage.width() == 0 || modImage.height() == 0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::modulate : invalid image\n"; -#endif - return image; + qDebug( "WARNING: OImageEffect::modulate : invalid image" ); + return image; } int r, g, b, h, s, v, a; QColor clr; @@ -859,20 +849,18 @@ QImage& OImageEffect::modulate(QImage &image, QImage &modImage, bool reverse, // Nice and fast direct pixel manipulation QImage& OImageEffect::blend(const QColor& clr, QImage& dst, float opacity) { if (dst.width() <= 0 || dst.height() <= 0) - return dst; + return dst; if (opacity < 0.0 || opacity > 1.0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1]\n"; -#endif - return dst; + qDebug( "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1] "); + return dst; } int depth = dst.depth(); if (depth != 32) - dst = dst.convertDepth(32); + dst = dst.convertDepth(32); int pixels = dst.width() * dst.height(); int rcol, gcol, bcol; clr.rgb(&rcol, &gcol, &bcol); @@ -902,24 +890,20 @@ QImage& OImageEffect::blend(const QColor& clr, QImage& dst, float opacity) // Nice and fast direct pixel manipulation QImage& OImageEffect::blend(QImage& src, QImage& dst, float opacity) { if (src.width() <= 0 || src.height() <= 0) - return dst; + return dst; if (dst.width() <= 0 || dst.height() <= 0) - return dst; + return dst; if (src.width() != dst.width() || src.height() != dst.height()) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::blend : src and destination images are not the same size\n"; -#endif - return dst; + qDebug( "WARNING: OImageEffect::blend : src and destination images are not the same size" ); + return dst; } if (opacity < 0.0 || opacity > 1.0) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1]\n"; -#endif - return dst; + qDebug( "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1]" ); + return dst; } if (src.depth() != 32) src = src.convertDepth(32); if (dst.depth() != 32) dst = dst.convertDepth(32); @@ -956,12 +940,10 @@ QImage& OImageEffect::blend(QImage &image, float initial_intensity, const QColor &bgnd, GradientType eff, bool anti_dir) { if (image.width() == 0 || image.height() == 0 || image.depth()!=32 ) { -#ifndef NDEBUG - cerr << "WARNING: OImageEffect::blend : invalid image\n"; -#endif - return image; + qDebug( "WARNING: OImageEffect::blend : invalid image" ); + return image; } int r_bgnd = bgnd.red(), g_bgnd = bgnd.green(), b_bgnd = bgnd.blue(); int r, g, b; @@ -1151,11 +1133,9 @@ QImage& OImageEffect::blend(QImage &image, float initial_intensity, data[ind] = qRgba(r, g, b, a); } } } -#ifndef NDEBUG - else cerr << "OImageEffect::blend effect not implemented" << endl; -#endif + else qDebug( "OImageEffect::blend effect not implemented" ); return image; } // Not very efficient as we create a third big image... @@ -1183,12 +1163,10 @@ QImage& OImageEffect::blend(QImage &image1, QImage &image2, { if (image1.width() == 0 || image1.height() == 0 || image2.width() == 0 || image2.height() == 0 || blendImage.width() == 0 || blendImage.height() == 0) { -#ifndef NDEBUG - cerr << "OImageEffect::blend effect invalid image" << endl; -#endif - return image1; + qDebug( "OImageEffect::blend effect invalid image" ); + return image1; } int r, g, b; int ind1, ind2, ind3; @@ -1283,12 +1261,10 @@ unsigned int OImageEffect::uHash(unsigned int c) QImage& OImageEffect::hash(QImage &image, Lighting lite, unsigned int spacing) { if (image.width() == 0 || image.height() == 0) { -#ifndef NDEBUG - cerr << "OImageEffect::hash effect invalid image" << endl; -#endif - return image; + qDebug( "OImageEffect::hash effect invalid image" ); + return image; } register int x, y; unsigned int *data = (unsigned int *)image.bits(); @@ -1793,12 +1769,10 @@ bool OImageEffect::blend( upper.depth() != 32 || lower.depth() != 32 ) { -#ifndef NDEBUG - cerr << "OImageEffect::blend : Sizes not correct\n" ; -#endif - return false; + qDebug( "OImageEffect::blend : Sizes not correct" ); + return false; } output = lower.copy(); |