• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdefx
 

tdefx

kimageeffect.h

00001 /* This file is part of the KDE libraries
00002  Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com>
00003  (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
00004  (C) 1998, 1999 Dirk Mueller <mueller@kde.org>
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions
00008 are met:
00009 
00010 1. Redistributions of source code must retain the above copyright
00011    notice, this list of conditions and the following disclaimer.
00012 2. Redistributions in binary form must reproduce the above copyright
00013    notice, this list of conditions and the following disclaimer in the
00014    documentation and/or other materials provided with the distribution.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00017 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00018 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00019 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00020 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00021 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00022 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00023 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00025 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 */
00028 
00029 // $Id$
00030 
00031 #ifndef __KIMAGE_EFFECT_H
00032 #define __KIMAGE_EFFECT_H
00033 
00034 #include <tdelibs_export.h>
00035 
00036 class TQImage;
00037 class TQSize;
00038 class TQColor;
00039 class TQPoint;
00040 class TQRect;
00041 
00050 class TDEFX_EXPORT KImageEffect
00051 {
00052 public:
00058     enum GradientType { VerticalGradient,
00059             HorizontalGradient,
00060                         DiagonalGradient,
00061             CrossDiagonalGradient,
00062                         PyramidGradient,
00063             RectangleGradient,
00064                         PipeCrossGradient,
00065             EllipticGradient
00066     };
00067 
00073     enum RGBComponent { Red,   
00074             Green, 
00075             Blue,  
00076             Gray,  
00077             All    
00078     };
00079 
00084     enum Lighting {NorthLite, 
00085            NWLite,    
00086            WestLite,  
00087            SWLite,    
00088                    SouthLite, 
00089            SELite,    
00090            EastLite,  
00091            NELite     
00092     };
00093 
00098     enum ModulationType { Intensity,  
00099               Saturation, 
00100               HueShift,   
00101               Contrast    
00102     };
00103 
00108     enum NoiseType { UniformNoise=0,              
00109              GaussianNoise,               
00110              MultiplicativeGaussianNoise, 
00111                      ImpulseNoise,                
00112              LaplacianNoise,              
00113              PoissonNoise                 
00114     };
00115 
00120     enum RotateDirection{ Rotate90,  
00121               Rotate180, 
00122               Rotate270  
00123     };
00124 
00129     enum BumpmapType {
00130         Linear,
00131         Spherical,
00132         Sinuosidal
00133     };
00134 
00146     static TQImage gradient(const TQSize &size, const TQColor &ca,
00147                            const TQColor &cb, GradientType type, int ncols=3);
00148 
00163     static TQImage unbalancedGradient(const TQSize &size, const TQColor &ca,
00164         const TQColor &cb, GradientType type, int xfactor = 100,
00165         int yfactor = 100, int ncols = 3);
00166 
00183     static TQImage& blend(const TQColor& clr, TQImage& dst, float opacity);
00184 
00201     static TQImage& blend(TQImage& src, TQImage& dst, float opacity);
00202 
00217     static TQImage& blend(TQImage &image, float initial_intensity,
00218                       const TQColor &bgnd, GradientType eff,
00219                       bool anti_dir=false);
00220 
00231     static TQImage& blend(TQImage &image1,TQImage &image2,
00232              GradientType gt, int xf=100, int yf=100);
00233 
00246     static TQImage& blend(TQImage &image1, TQImage &image2,
00247              TQImage &blendImage, RGBComponent channel);
00248 
00256     static bool blend(const TQImage & upper, const TQImage & lower, TQImage & output);
00257 // Not yet...    static bool blend(const TQImage & image1, const TQImage & image2, TQImage & output, const TQRect & destRect);
00258 
00275     static bool blend(int &x, int &y, const TQImage & upper, const TQImage & lower, TQImage & output);
00276 
00287     static bool blendOnLower(int x, int y, const TQImage & upper, const TQImage & lower);
00288 
00301     static void blendOnLower(const TQImage &upper, const TQPoint &upperOffset,
00302                              TQImage &lower, const TQRect &lowerRect);
00303 
00318     static void blendOnLower(const TQImage &upper, const TQPoint &upperOffset,
00319                              TQImage &lower, const TQRect &lowerRect, float opacity);
00320 
00326     enum Disposition { NoImage = 0, 
00327                Centered,    
00328                Tiled,       
00329                CenterTiled, 
00330                CenteredMaxpect, 
00331                TiledMaxpect, 
00332                Scaled,      
00333                CenteredAutoFit 
00334     };
00335 
00350     static TQRect computeDestinationRect(const TQSize &lowerSize,
00351                                       Disposition disposition, TQImage &upper);
00352 
00359     static void blendOnLower(TQImage &upper, TQImage &lower,
00360                              Disposition disposition, float opacity);
00361 
00371     static TQImage& channelIntensity(TQImage &image, float percent,
00372                                     RGBComponent channel);
00373 
00384     static TQImage& fade(TQImage &image, float val, const TQColor &color);
00385 
00386 
00397     static TQImage& flatten(TQImage &image, const TQColor &ca,
00398            const TQColor &cb, int ncols=0);
00399 
00408     static TQImage& hash(TQImage &image, Lighting lite=NorthLite,
00409                         unsigned int spacing=0);
00410 
00424     static TQImage& intensity(TQImage &image, float percent);
00425 
00437     static TQImage& modulate(TQImage &image, TQImage &modImage, bool reverse,
00438         ModulationType type, int factor, RGBComponent channel);
00439 
00449     static TQImage& toGray(TQImage &image, bool fast = false);
00450 
00458     static TQImage& desaturate(TQImage &image, float desat = 0.3);
00459 
00469     static TQImage& contrast(TQImage &image, int c);
00470 
00480     static TQImage& dither(TQImage &image, const TQColor *palette, int size);
00481 
00488     static TQImage& selectedImage( TQImage &img, const TQColor &col );
00489 
00501     static void contrastHSV(TQImage &img, bool sharpen=true);
00502 
00509     static void normalize(TQImage &img);
00510 
00517     static void equalize(TQImage &img);
00518 
00528     static void threshold(TQImage &img, unsigned int value=128);
00529 
00538     static void solarize(TQImage &img, double factor=50.0);
00539 
00553     static TQImage emboss(TQImage &src, double radius, double sigma);
00554 
00558     static TQImage emboss(TQImage &src);
00559 
00568     static TQImage despeckle(TQImage &src);
00569 
00581     static TQImage charcoal(TQImage &src, double radius, double sigma);
00582 
00587      static TQImage charcoal(TQImage &src, double factor=50.0);
00588 
00597     static TQImage rotate(TQImage &src, RotateDirection r);
00598 
00610     static TQImage sample(TQImage &src, int w, int h);
00611 
00620     static TQImage addNoise(TQImage &src, NoiseType type = GaussianNoise);
00621 
00633     static TQImage blur(TQImage &src, double radius, double sigma);
00634 
00639     static TQImage blur(TQImage &src, double factor=50.0);
00640 
00651     static TQImage edge(TQImage &src, double radius);
00652 
00663     static TQImage implode(TQImage &src, double factor=30.0,
00664                    unsigned int background = 0xFFFFFFFF);
00665 
00675     static TQImage oilPaintConvolve(TQImage &src, double radius);
00676 
00681     static TQImage oilPaint(TQImage &src, int radius=3);
00682 
00694     static TQImage sharpen(TQImage &src, double radius, double sigma);
00695 
00700     static TQImage sharpen(TQImage &src, double factor=30.0);
00701 
00710     static TQImage spread(TQImage &src, unsigned int amount=3);
00711 
00722     static TQImage shade(TQImage &src, bool color_shading=true, double azimuth=30.0,
00723                         double elevation=30.0);
00734     static TQImage swirl(TQImage &src, double degrees=50.0, unsigned int background =
00735                          0xFFFFFFFF);
00736 
00748     static TQImage wave(TQImage &src, double amplitude=25.0, double frequency=150.0,
00749                         unsigned int background = 0xFFFFFFFF);
00750 
00771     static TQImage bumpmap(TQImage &img, TQImage &map, double azimuth, double elevation,
00772                           int depth, int xofs, int yofs, int waterlevel,
00773                           int ambient, bool compensate, bool invert,
00774                           BumpmapType type, bool tiled);
00775 
00784     static TQImage convertToPremultipliedAlpha(TQImage input);
00785 
00786 private:
00787 
00792     static unsigned int lHash(unsigned int c);
00793     static unsigned int uHash(unsigned int c);
00794 
00798     static int nearestColor( int r, int g, int b, const TQColor *pal, int size );
00799 
00800     static void hull(const int x_offset, const int y_offset, const int polarity,
00801                      const int width, const int height,
00802                      unsigned int *f, unsigned int *g);
00803     static unsigned int generateNoise(unsigned int pixel, NoiseType type);
00804     static unsigned int interpolateColor(TQImage *image, double x, double y,
00805                                          unsigned int background);
00806     /* Various convolve routines */
00807     static int getOptimalKernelWidth(double radius, double sigma);
00808     static bool convolveImage(TQImage *image, TQImage *dest,
00809                               const unsigned int order,
00810                               const double *kernel);
00811     static void blurScanLine(double *kernel, int width,
00812                              unsigned int *src, unsigned int *dest,
00813                              int columns);
00814     static int getBlurKernel(int width, double sigma, double **kernel);
00815 };
00816 
00817 #endif

tdefx

Skip menu "tdefx"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

tdefx

Skip menu "tdefx"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdefx by doxygen 1.6.3
This website is maintained by Timothy Pearson.