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

tdefx

  • tdefx
kimageeffect.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com>
3  (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
4  (C) 1998, 1999 Dirk Mueller <mueller@kde.org>
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9 
10 1. Redistributions of source code must retain the above copyright
11  notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13  notice, this list of conditions and the following disclaimer in the
14  documentation and/or other materials provided with the distribution.
15 
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 */
28 
29 // $Id$
30 
31 #ifndef __KIMAGE_EFFECT_H
32 #define __KIMAGE_EFFECT_H
33 
34 #include <tdelibs_export.h>
35 
36 class TQImage;
37 class TQSize;
38 class TQColor;
39 class TQPoint;
40 class TQRect;
41 
50 class TDEFX_EXPORT KImageEffect
51 {
52 public:
58  enum GradientType { VerticalGradient,
59  HorizontalGradient,
60  DiagonalGradient,
61  CrossDiagonalGradient,
62  PyramidGradient,
63  RectangleGradient,
64  PipeCrossGradient,
65  EllipticGradient
66  };
67 
73  enum RGBComponent { Red,
74  Green,
75  Blue,
76  Gray,
77  All
78  };
79 
84  enum Lighting {NorthLite,
85  NWLite,
86  WestLite,
87  SWLite,
88  SouthLite,
89  SELite,
90  EastLite,
91  NELite
92  };
93 
98  enum ModulationType { Intensity,
99  Saturation,
100  HueShift,
101  Contrast
102  };
103 
108  enum NoiseType { UniformNoise=0,
109  GaussianNoise,
110  MultiplicativeGaussianNoise,
111  ImpulseNoise,
112  LaplacianNoise,
113  PoissonNoise
114  };
115 
120  enum RotateDirection{ Rotate90,
121  Rotate180,
122  Rotate270
123  };
124 
129  enum BumpmapType {
130  Linear,
131  Spherical,
132  Sinuosidal
133  };
134 
146  static TQImage gradient(const TQSize &size, const TQColor &ca,
147  const TQColor &cb, GradientType type, int ncols=3);
148 
163  static TQImage unbalancedGradient(const TQSize &size, const TQColor &ca,
164  const TQColor &cb, GradientType type, int xfactor = 100,
165  int yfactor = 100, int ncols = 3);
166 
183  static TQImage& blend(const TQColor& clr, TQImage& dst, float opacity);
184 
201  static TQImage& blend(TQImage& src, TQImage& dst, float opacity);
202 
217  static TQImage& blend(TQImage &image, float initial_intensity,
218  const TQColor &bgnd, GradientType eff,
219  bool anti_dir=false);
220 
231  static TQImage& blend(TQImage &image1,TQImage &image2,
232  GradientType gt, int xf=100, int yf=100);
233 
246  static TQImage& blend(TQImage &image1, TQImage &image2,
247  TQImage &blendImage, RGBComponent channel);
248 
256  static bool blend(const TQImage & upper, const TQImage & lower, TQImage & output);
257 // Not yet... static bool blend(const TQImage & image1, const TQImage & image2, TQImage & output, const TQRect & destRect);
258 
275  static bool blend(int &x, int &y, const TQImage & upper, const TQImage & lower, TQImage & output);
276 
287  static bool blendOnLower(int x, int y, const TQImage & upper, const TQImage & lower);
288 
301  static void blendOnLower(const TQImage &upper, const TQPoint &upperOffset,
302  TQImage &lower, const TQRect &lowerRect);
303 
318  static void blendOnLower(const TQImage &upper, const TQPoint &upperOffset,
319  TQImage &lower, const TQRect &lowerRect, float opacity);
320 
326  enum Disposition { NoImage = 0,
327  Centered,
328  Tiled,
329  CenterTiled,
330  CenteredMaxpect,
331  TiledMaxpect,
332  Scaled,
333  CenteredAutoFit
334  };
335 
350  static TQRect computeDestinationRect(const TQSize &lowerSize,
351  Disposition disposition, TQImage &upper);
352 
359  static void blendOnLower(TQImage &upper, TQImage &lower,
360  Disposition disposition, float opacity);
361 
371  static TQImage& channelIntensity(TQImage &image, float percent,
372  RGBComponent channel);
373 
384  static TQImage& fade(TQImage &image, float val, const TQColor &color);
385 
386 
397  static TQImage& flatten(TQImage &image, const TQColor &ca,
398  const TQColor &cb, int ncols=0);
399 
408  static TQImage& hash(TQImage &image, Lighting lite=NorthLite,
409  unsigned int spacing=0);
410 
424  static TQImage& intensity(TQImage &image, float percent);
425 
437  static TQImage& modulate(TQImage &image, TQImage &modImage, bool reverse,
438  ModulationType type, int factor, RGBComponent channel);
439 
449  static TQImage& toGray(TQImage &image, bool fast = false);
450 
458  static TQImage& desaturate(TQImage &image, float desat = 0.3);
459 
469  static TQImage& contrast(TQImage &image, int c);
470 
480  static TQImage& dither(TQImage &image, const TQColor *palette, int size);
481 
488  static TQImage& selectedImage( TQImage &img, const TQColor &col );
489 
501  static void contrastHSV(TQImage &img, bool sharpen=true);
502 
509  static void normalize(TQImage &img);
510 
517  static void equalize(TQImage &img);
518 
528  static void threshold(TQImage &img, unsigned int value=128);
529 
538  static void solarize(TQImage &img, double factor=50.0);
539 
553  static TQImage emboss(TQImage &src, double radius, double sigma);
554 
558  static TQImage emboss(TQImage &src);
559 
568  static TQImage despeckle(TQImage &src);
569 
581  static TQImage charcoal(TQImage &src, double radius, double sigma);
582 
587  static TQImage charcoal(TQImage &src, double factor=50.0);
588 
597  static TQImage rotate(TQImage &src, RotateDirection r);
598 
610  static TQImage sample(TQImage &src, int w, int h);
611 
620  static TQImage addNoise(TQImage &src, NoiseType type = GaussianNoise);
621 
633  static TQImage blur(TQImage &src, double radius, double sigma);
634 
639  static TQImage blur(TQImage &src, double factor=50.0);
640 
651  static TQImage edge(TQImage &src, double radius);
652 
663  static TQImage implode(TQImage &src, double factor=30.0,
664  unsigned int background = 0xFFFFFFFF);
665 
675  static TQImage oilPaintConvolve(TQImage &src, double radius);
676 
681  static TQImage oilPaint(TQImage &src, int radius=3);
682 
694  static TQImage sharpen(TQImage &src, double radius, double sigma);
695 
700  static TQImage sharpen(TQImage &src, double factor=30.0);
701 
710  static TQImage spread(TQImage &src, unsigned int amount=3);
711 
722  static TQImage shade(TQImage &src, bool color_shading=true, double azimuth=30.0,
723  double elevation=30.0);
734  static TQImage swirl(TQImage &src, double degrees=50.0, unsigned int background =
735  0xFFFFFFFF);
736 
748  static TQImage wave(TQImage &src, double amplitude=25.0, double frequency=150.0,
749  unsigned int background = 0xFFFFFFFF);
750 
771  static TQImage bumpmap(TQImage &img, TQImage &map, double azimuth, double elevation,
772  int depth, int xofs, int yofs, int waterlevel,
773  int ambient, bool compensate, bool invert,
774  BumpmapType type, bool tiled);
775 
784  static TQImage convertToPremultipliedAlpha(TQImage input);
785 
786 private:
787 
792  static unsigned int lHash(unsigned int c);
793  static unsigned int uHash(unsigned int c);
794 
798  static int nearestColor( int r, int g, int b, const TQColor *pal, int size );
799 
800  static void hull(const int x_offset, const int y_offset, const int polarity,
801  const int width, const int height,
802  unsigned int *f, unsigned int *g);
803  static unsigned int generateNoise(unsigned int pixel, NoiseType type);
804  static unsigned int interpolateColor(TQImage *image, double x, double y,
805  unsigned int background);
806  /* Various convolve routines */
807  static int getOptimalKernelWidth(double radius, double sigma);
808  static bool convolveImage(TQImage *image, TQImage *dest,
809  const unsigned int order,
810  const double *kernel);
811  static void blurScanLine(double *kernel, int width,
812  unsigned int *src, unsigned int *dest,
813  int columns);
814  static int getBlurKernel(int width, double sigma, double **kernel);
815 };
816 
817 #endif
KImageEffect
This class includes various TQImage based graphical effects.
Definition: kimageeffect.h:51
KImageEffect::NoiseType
NoiseType
This enum provides a noise type specification.
Definition: kimageeffect.h:108
KImageEffect::GaussianNoise
@ GaussianNoise
Gaussian distribution.
Definition: kimageeffect.h:109
KImageEffect::MultiplicativeGaussianNoise
@ MultiplicativeGaussianNoise
Multiplicative Gaussian distribution.
Definition: kimageeffect.h:110
KImageEffect::ImpulseNoise
@ ImpulseNoise
Impulse distribution.
Definition: kimageeffect.h:111
KImageEffect::LaplacianNoise
@ LaplacianNoise
Laplacian distribution.
Definition: kimageeffect.h:112
KImageEffect::ModulationType
ModulationType
This enum provides a modulation type specification.
Definition: kimageeffect.h:98
KImageEffect::Saturation
@ Saturation
Modulate image saturation.
Definition: kimageeffect.h:99
KImageEffect::HueShift
@ HueShift
Modulate image hue.
Definition: kimageeffect.h:100
KImageEffect::Intensity
@ Intensity
Modulate image intensity.
Definition: kimageeffect.h:98
KImageEffect::GradientType
GradientType
This enum provides a gradient type specification.
Definition: kimageeffect.h:58
KImageEffect::RotateDirection
RotateDirection
This enum provides a rotation specification.
Definition: kimageeffect.h:120
KImageEffect::Rotate90
@ Rotate90
Rotate 90 degrees to the right.
Definition: kimageeffect.h:120
KImageEffect::Rotate180
@ Rotate180
Rotate 180 degrees.
Definition: kimageeffect.h:121
KImageEffect::Disposition
Disposition
Disposition of a source image on top of a destination image.
Definition: kimageeffect.h:326
KImageEffect::CenterTiled
@ CenterTiled
Center and tile top image on bottom image.
Definition: kimageeffect.h:329
KImageEffect::CenteredMaxpect
@ CenteredMaxpect
Center and scale aspect.
Definition: kimageeffect.h:330
KImageEffect::Scaled
@ Scaled
Scale.
Definition: kimageeffect.h:332
KImageEffect::Centered
@ Centered
Center top image on botton image.
Definition: kimageeffect.h:327
KImageEffect::TiledMaxpect
@ TiledMaxpect
Tile and scale aspect.
Definition: kimageeffect.h:331
KImageEffect::Tiled
@ Tiled
Tile top image on bottom image.
Definition: kimageeffect.h:328
KImageEffect::Lighting
Lighting
This enum provides a lighting direction specification.
Definition: kimageeffect.h:84
KImageEffect::SWLite
@ SWLite
Lighting from the bottom left of the image.
Definition: kimageeffect.h:87
KImageEffect::NWLite
@ NWLite
Lighting from the top left of the image.
Definition: kimageeffect.h:85
KImageEffect::EastLite
@ EastLite
Lighting from the right of the image.
Definition: kimageeffect.h:90
KImageEffect::SELite
@ SELite
Lighting from the bottom right of the image.
Definition: kimageeffect.h:89
KImageEffect::WestLite
@ WestLite
Lighting from the left of the image.
Definition: kimageeffect.h:86
KImageEffect::SouthLite
@ SouthLite
Lighting from the bottom of the image.
Definition: kimageeffect.h:88
KImageEffect::BumpmapType
BumpmapType
This enum lists possible bumpmapping implementations.
Definition: kimageeffect.h:129
KImageEffect::RGBComponent
RGBComponent
This enum provides a RGB channel specification.
Definition: kimageeffect.h:73
KImageEffect::Gray
@ Gray
Grey channel.
Definition: kimageeffect.h:76
KImageEffect::Green
@ Green
Green channel.
Definition: kimageeffect.h:74
KImageEffect::Red
@ Red
Red channel.
Definition: kimageeffect.h:73
KImageEffect::Blue
@ Blue
Blue channel.
Definition: kimageeffect.h:75

tdefx

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

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.9.1
This website is maintained by Timothy Pearson.