diff options
Diffstat (limited to 'tdefx/kimageeffect.cpp')
| -rw-r--r-- | tdefx/kimageeffect.cpp | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/tdefx/kimageeffect.cpp b/tdefx/kimageeffect.cpp index 277e1cc7f..8968c1b43 100644 --- a/tdefx/kimageeffect.cpp +++ b/tdefx/kimageeffect.cpp @@ -58,7 +58,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif //====================================================================== // -// Utility stuff for effects ported from ImageMagick to QImage +// Utility stuff for effects ported from ImageMagick to TQImage // //====================================================================== #define MaxRGB 255L @@ -664,7 +664,7 @@ TQImage& KImageEffect::intensity(TQImage &image, float percent) int pixels = image.depth() > 8 ? image.width()*image.height() : image.numColors(); unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() : - (unsigned int *)image.tqcolorTable(); + (unsigned int *)image.colorTable(); bool brighten = (percent >= 0); if(percent < 0) @@ -858,7 +858,7 @@ TQImage& KImageEffect::channelIntensity(TQImage &image, float percent, int pixels = image.depth() > 8 ? image.width()*image.height() : image.numColors(); unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() : - (unsigned int *)image.tqcolorTable(); + (unsigned int *)image.colorTable(); bool brighten = (percent >= 0); if(percent < 0) percent = -percent; @@ -958,7 +958,7 @@ TQImage& KImageEffect::modulate(TQImage &image, TQImage &modImage, bool reverse, if (modImage.depth()<8) modImage = modImage.convertDepth(8); unsigned int *colorTable2 = (modImage.depth()==8) ? - modImage.tqcolorTable():0; + modImage.colorTable():0; unsigned int *data1, *data2; unsigned char *data2b; unsigned int color1, color2; @@ -1079,11 +1079,6 @@ TQImage& KImageEffect::blend(const TQColor& clr, TQImage& dst, float opacity) if (dst.depth() != 32) dst = dst.convertDepth(32); -#ifdef USE_QT4 - if (dst.format() != QImage::Format_ARGB32) - dst = dst.convertToFormat(QImage::Format_ARGB32); // This is needed because Qt4 has multiple variants with a 32 bit depth, and the routines below expect one specific variant (ARGB) -#endif - int pixels = dst.width() * dst.height(); #ifdef USE_SSE2_INLINE_ASM @@ -1334,13 +1329,6 @@ TQImage& KImageEffect::blend(TQImage& src, TQImage& dst, float opacity) if (src.depth() != 32) src = src.convertDepth(32); if (dst.depth() != 32) dst = dst.convertDepth(32); -#ifdef USE_QT4 - if (src.format() != QImage::Format_ARGB32) - src = dst.convertToFormat(QImage::Format_ARGB32); // This is needed because Qt4 has multiple variants with a 32 bit depth, and the routines below expect one specific variant (ARGB) - if (dst.format() != QImage::Format_ARGB32) - dst = dst.convertToFormat(QImage::Format_ARGB32); // This is needed because Qt4 has multiple variants with a 32 bit depth, and the routines below expect one specific variant (ARGB) -#endif - int pixels = src.width() * src.height(); #ifdef USE_SSE2_INLINE_ASM @@ -1800,7 +1788,7 @@ TQImage& KImageEffect::blend(TQImage &image1, TQImage &image2, if (blendImage.depth()<8) blendImage = blendImage.convertDepth(8); unsigned int *colorTable3 = (blendImage.depth()==8) ? - blendImage.tqcolorTable():0; + blendImage.colorTable():0; unsigned int *data1 = (unsigned int *)image1.bits(); unsigned int *data2 = (unsigned int *)image2.bits(); @@ -2174,7 +2162,7 @@ TQImage& KImageEffect::toGray(TQImage &img, bool fast) int pixels = img.depth() > 8 ? img.width()*img.height() : img.numColors(); unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() : - (unsigned int *)img.tqcolorTable(); + (unsigned int *)img.colorTable(); int val, i; for(i=0; i < pixels; ++i){ val = tqGray(data[i]); @@ -2195,7 +2183,7 @@ TQImage& KImageEffect::desaturate(TQImage &img, float desat) int pixels = img.depth() > 8 ? img.width()*img.height() : img.numColors(); unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() : - (unsigned int *)img.tqcolorTable(); + (unsigned int *)img.colorTable(); int h, s, v, i; TQColor clr; // keep constructor out of loop (mosfet) for(i=0; i < pixels; ++i){ @@ -2220,7 +2208,7 @@ TQImage& KImageEffect::contrast(TQImage &img, int c) int pixels = img.depth() > 8 ? img.width()*img.height() : img.numColors(); unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() : - (unsigned int *)img.tqcolorTable(); + (unsigned int *)img.colorTable(); int i, r, g, b; for(i=0; i < pixels; ++i){ r = tqRed(data[i]); @@ -2791,7 +2779,7 @@ TQImage KImageEffect::sample(TQImage &src, int w, int h) } else if(depth == 1) { int r = src.bitOrder() == TQImage::LittleEndian; - memcpy(dest.tqcolorTable(), src.tqcolorTable(), src.numColors()*sizeof(TQRgb)); + memcpy(dest.colorTable(), src.colorTable(), src.numColors()*sizeof(TQRgb)); for(int y=0; y < h; ++y){ unsigned char *destData = dest.scanLine(y); unsigned char *srcData = src.scanLine(y_offset[y]); @@ -2806,7 +2794,7 @@ TQImage KImageEffect::sample(TQImage &src, int w, int h) } } else{ // PseudoClass source image - memcpy(dest.tqcolorTable(), src.tqcolorTable(), src.numColors()*sizeof(TQRgb)); + memcpy(dest.colorTable(), src.colorTable(), src.numColors()*sizeof(TQRgb)); for(int y=0; y < h; ++y){ unsigned char *destData = dest.scanLine(y); unsigned char *srcData = src.scanLine(y_offset[y]); @@ -2829,10 +2817,10 @@ void KImageEffect::threshold(TQImage &img, unsigned int threshold) } else{ // PsudeoClass count = img.numColors(); - data = (unsigned int *)img.tqcolorTable(); + data = (unsigned int *)img.colorTable(); } for(i=0; i < count; ++i) - data[i] = intensityValue(data[i]) < threshold ? QColor(Qt::black).rgb() : QColor(Qt::white).rgb(); + data[i] = intensityValue(data[i]) < threshold ? TQColor(TQt::black).rgb() : TQColor(TQt::white).rgb(); } void KImageEffect::hull(const int x_offset, const int y_offset, @@ -2963,7 +2951,7 @@ TQImage KImageEffect::despeckle(TQImage &src) } else{ // PsudeoClass source image unsigned char *srcData; - unsigned int *cTable = src.tqcolorTable(); + unsigned int *cTable = src.colorTable(); unsigned int pixel; for(y=0; y < src.height(); ++y){ srcData = (unsigned char *)src.scanLine(y); @@ -3142,7 +3130,7 @@ TQImage KImageEffect::addNoise(TQImage &src, NoiseType noise_type) } else{ // PsudeoClass source image unsigned char *srcData; - unsigned int *cTable = src.tqcolorTable(); + unsigned int *cTable = src.colorTable(); unsigned int pixel; for(y=0; y < src.height(); ++y){ srcData = (unsigned char *)src.scanLine(y); @@ -3204,7 +3192,7 @@ unsigned int KImageEffect::interpolateColor(TQImage *image, double x_offset, } } else{ - unsigned int *colorTable = (unsigned int *)image->tqcolorTable(); + unsigned int *colorTable = (unsigned int *)image->colorTable(); if((x >= 0) && (y >= 0) && (x < (image->width()-1)) && (y < (image->height()-1))) { unsigned char *t; t = (unsigned char *)image->scanLine(y); @@ -3304,7 +3292,7 @@ TQImage KImageEffect::implode(TQImage &src, double factor, else{ // PsudeoClass source image unsigned char *srcData; unsigned char idx; - unsigned int *cTable = src.tqcolorTable(); + unsigned int *cTable = src.colorTable(); for(y=0; y < src.height(); ++y){ srcData = (unsigned char *)src.scanLine(y); destData = (unsigned int *)dest.scanLine(y); @@ -3380,8 +3368,8 @@ TQImage KImageEffect::rotate(TQImage &img, RotateDirection r) case Rotate90: dest.create(img.height(), img.width(), img.depth()); dest.setNumColors(img.numColors()); - srcTable = (unsigned int *)img.tqcolorTable(); - destTable = (unsigned int *)dest.tqcolorTable(); + srcTable = (unsigned int *)img.colorTable(); + destTable = (unsigned int *)dest.colorTable(); for(x=0; x < img.numColors(); ++x) destTable[x] = srcTable[x]; for(y=0; y < img.height(); ++y){ @@ -3395,8 +3383,8 @@ TQImage KImageEffect::rotate(TQImage &img, RotateDirection r) case Rotate180: dest.create(img.width(), img.height(), img.depth()); dest.setNumColors(img.numColors()); - srcTable = (unsigned int *)img.tqcolorTable(); - destTable = (unsigned int *)dest.tqcolorTable(); + srcTable = (unsigned int *)img.colorTable(); + destTable = (unsigned int *)dest.colorTable(); for(x=0; x < img.numColors(); ++x) destTable[x] = srcTable[x]; for(y=0; y < img.height(); ++y){ @@ -3409,8 +3397,8 @@ TQImage KImageEffect::rotate(TQImage &img, RotateDirection r) case Rotate270: dest.create(img.height(), img.width(), img.depth()); dest.setNumColors(img.numColors()); - srcTable = (unsigned int *)img.tqcolorTable(); - destTable = (unsigned int *)dest.tqcolorTable(); + srcTable = (unsigned int *)img.colorTable(); + destTable = (unsigned int *)dest.colorTable(); for(x=0; x < img.numColors(); ++x) destTable[x] = srcTable[x]; for(y=0; y < img.height(); ++y){ @@ -3438,7 +3426,7 @@ void KImageEffect::solarize(TQImage &img, double factor) threshold = (int)(factor*(MaxRGB+1)/100.0); if(img.depth() < 32){ - data = (unsigned int *)img.tqcolorTable(); + data = (unsigned int *)img.colorTable(); count = img.numColors(); } else{ @@ -3553,7 +3541,7 @@ TQImage KImageEffect::swirl(TQImage &src, double degrees, } else{ // PsudeoClass source image unsigned char *p; - unsigned int *cTable = (unsigned int *)src.tqcolorTable(); + unsigned int *cTable = (unsigned int *)src.colorTable(); for(y=0; y < src.height(); y++){ p = (unsigned char *)src.scanLine(y); q = (unsigned int *)dest.scanLine(y); @@ -4566,7 +4554,7 @@ TQImage KImageEffect::shade(TQImage &src, bool color_shading, double azimuth, else{ // PsudeoClass source image unsigned char *p, *s0, *s1, *s2; int scanLineIdx; - unsigned int *cTable = (unsigned int *)src.tqcolorTable(); + unsigned int *cTable = (unsigned int *)src.colorTable(); for(y=0; y < src.height(); ++y){ scanLineIdx = TQMIN(TQMAX(y-1,0),src.height()-3); p = (unsigned char *)src.scanLine(scanLineIdx); @@ -4644,7 +4632,7 @@ void KImageEffect::contrastHSV(TQImage &img, bool sharpen) } else{ count = img.numColors(); - data = (unsigned int *)img.tqcolorTable(); + data = (unsigned int *)img.colorTable(); } for(i=0; i < count; ++i){ c.setRgb(data[i]); |
