Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

oimageeffect.h

Go to the documentation of this file.
00001 //FIXME: Revise for Opie - do we really need such fancy stuff on PDA's?
00002 //FIXME: Maybe not on SL5xxx, but surely on C700 :))
00003 //FIXME: I think we don#t need that -zecke
00004 
00005 /* This file is part of the KDE libraries
00006  Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com>
00007  (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
00008  (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org>
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions
00012 are met:
00013 
00014 1. Redistributions of source code must retain the above copyright
00015    notice, this list of conditions and the following disclaimer.
00016 2. Redistributions in binary form must reproduce the above copyright
00017    notice, this list of conditions and the following disclaimer in the
00018    documentation and/or other materials provided with the distribution.
00019 
00020 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00021 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00022 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00023 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00024 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00026 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00027 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00029 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 
00031 */
00032 
00033 // $Id: oimageeffect.h,v 1.4 2004/10/07 19:36:35 clem Exp $
00034 
00035 #ifndef OIMAGEEFFECT_H
00036 #define OIMAGEEFFECT_H
00037 
00038 class QImage;
00039 class QSize;
00040 class QColor;
00041 
00042 namespace Opie {
00043 namespace Ui   {
00053 class OImageEffect
00054 {
00055 public:
00056     enum GradientType { VerticalGradient, HorizontalGradient,
00057                         DiagonalGradient, CrossDiagonalGradient,
00058                         PyramidGradient, RectangleGradient,
00059                         PipeCrossGradient, EllipticGradient };
00060     enum RGBComponent { Red, Green, Blue, Gray, All };
00061 
00062     enum Lighting {NorthLite, NWLite, WestLite, SWLite,
00063                    SouthLite, SELite, EastLite, NELite};
00064 
00065     enum ModulationType { Intensity, Saturation, HueShift, Contrast };
00066 
00067     enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise,
00068                      ImpulseNoise, LaplacianNoise, PoissonNoise};
00069 
00070     enum RotateDirection{ Rotate90, Rotate180, Rotate270 };
00071 
00083     static QImage gradient(const QSize &size, const QColor &ca,
00084                            const QColor &cb, GradientType type, int ncols=3);
00085 
00100     static QImage unbalancedGradient(const QSize &size, const QColor &ca,
00101             const QColor &cb, GradientType type, int xfactor = 100,
00102             int yfactor = 100, int ncols = 3);
00103 
00116     static QImage& blend(const QColor& clr, QImage& dst, float opacity);
00117 
00130     static QImage& blend(QImage& src, QImage& dst, float opacity);
00131 
00146     static QImage& blend(QImage &image, float initial_intensity,
00147                       const QColor &bgnd, GradientType eff,
00148                       bool anti_dir=false);
00149 
00160     static QImage& blend(QImage &image1,QImage &image2,
00161                          GradientType gt, int xf=100, int yf=100);
00162 
00175     static QImage& blend(QImage &image1, QImage &image2,
00176                          QImage &blendImage, RGBComponent channel);
00177 
00182     static bool blend(const QImage & upper, const QImage & lower, QImage & output);
00183 // Not yet...    static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect);
00184 
00196     static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output);
00203     static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower);
00204 
00214     static QImage& channelIntensity(QImage &image, float percent,
00215                                     RGBComponent channel);
00216 
00227     static QImage& fade(QImage &img, float val, const QColor &color);
00228 
00229 
00238     static QImage& flatten(QImage &image, const QColor &ca,
00239            const QColor &cb, int ncols=0);
00240 
00249     static QImage& hash(QImage &image, Lighting lite=NorthLite,
00250                         unsigned int spacing=0);
00251 
00261     static QImage& intensity(QImage &image, float percent);
00262 
00274     static QImage& modulate(QImage &image, QImage &modImage, bool reverse,
00275                 ModulationType type, int factor, RGBComponent channel);
00276 
00286     static QImage& toGray(QImage &image, bool fast = false);
00287 
00295     static QImage& desaturate(QImage &image, float desat = 0.3);
00296 
00305     static QImage& contrast(QImage &image, int c);
00306 
00316     static QImage& dither(QImage &img, const QColor *palette, int size);
00317 
00324     static QImage& selectedImage( QImage &img, const QColor &col );
00325 
00337     static void contrastHSV(QImage &img, bool sharpen=true);
00338 
00344     static void normalize(QImage &img);
00345 
00351     static void equalize(QImage &img);
00352 
00362     static void threshold(QImage &img, unsigned int value=128);
00363 
00372     static void solarize(QImage &img, double factor=50.0);
00373 
00383     static QImage emboss(QImage &src);
00384 
00393     static QImage despeckle(QImage &src);
00394 
00403     static QImage charcoal(QImage &src, double factor=50.0);
00404 
00413     static QImage rotate(QImage &src, RotateDirection r);
00414 
00426     static QImage sample(QImage &src, int w, int h);
00427 
00436     static QImage addNoise(QImage &src, NoiseType type = GaussianNoise);
00437 
00446     static QImage blur(QImage &src, double factor=50.0);
00447 
00457     static QImage edge(QImage &src, double factor=50.0);
00458 
00469     static QImage implode(QImage &src, double factor=30.0,
00470                    unsigned int background = 0xFFFFFFFF);
00480     static QImage oilPaint(QImage &src, int radius=3);
00481 
00490     static QImage sharpen(QImage &src, double factor=30.0);
00491 
00500     static QImage spread(QImage &src, unsigned int amount=3);
00501 
00512     static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0,
00513                         double elevation=30.0);
00524      static QImage swirl(QImage &src, double degrees=50.0, unsigned int background =
00525                          0xFFFFFFFF);
00526 
00536      static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0,
00537                         unsigned int background = 0xFFFFFFFF);
00538 
00539 private:
00540 
00545     static unsigned int lHash(unsigned int c);
00546     static unsigned int uHash(unsigned int c);
00547 
00551     static int nearestColor( int r, int g, int b, const QColor *pal, int size );
00552 
00553     static void hull(const int x_offset, const int y_offset, const int polarity,
00554                      const int width, const int height,
00555                      unsigned int *f, unsigned int *g);
00556     static unsigned int generateNoise(unsigned int pixel, NoiseType type);
00557     static unsigned int interpolateColor(QImage *image, double x, double y,
00558                                          unsigned int background);
00559 };
00560 
00561 }
00562 }
00563 
00564 #endif

Generated on Sat Nov 5 16:16:26 2005 for OPIE by  doxygen 1.4.2