kdefx Library: KImageEffect Class Reference (kdefx Library)

| # kdefx Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KImageEffect Class Reference

This class includes various QImage based graphical effects. More...

`#include <kimageeffect.h>`

List of all members.

## Public Types
enum | GradientType { VerticalGradient, HorizontalGradient, DiagonalGradient, CrossDiagonalGradient, PyramidGradient, RectangleGradient, PipeCrossGradient, EllipticGradient }
enum | RGBComponent { Red, Green, Blue, Gray, All }
enum | Lighting { NorthLite, NWLite, WestLite, SWLite, SouthLite, SELite, EastLite, NELite }
enum | ModulationType { Intensity, Saturation, HueShift, Contrast }
enum | NoiseType { UniformNoise = 0, GaussianNoise, MultiplicativeGaussianNoise, ImpulseNoise, LaplacianNoise, PoissonNoise }
enum | RotateDirection { Rotate90, Rotate180, Rotate270 }
enum | BumpmapType { Linear, Spherical, Sinuosidal }
enum | Disposition { NoImage = 0, Centered, Tiled, CenterTiled, CenteredMaxpect, TiledMaxpect, Scaled, CenteredAutoFit }
## Static Public Member Functions
static QImage | gradient (const QSize &size, const QColor &ca, const QColor &cb, GradientType type, int ncols=3)
static QImage | unbalancedGradient (const QSize &size, const QColor &ca, const QColor &cb, GradientType type, int xfactor=100, int yfactor=100, int ncols=3)
static QImage & | blend (const QColor &clr, QImage &dst, float opacity)
static QImage & | blend (QImage &src, QImage &dst, float opacity)
static QImage & | blend (QImage &image, float initial_intensity, const QColor &bgnd, GradientType eff, bool anti_dir=false)
static QImage & | blend (QImage &image1, QImage &image2, GradientType gt, int xf=100, int yf=100)
static QImage & | blend (QImage &image1, QImage &image2, QImage &blendImage, RGBComponent channel)
static bool | blend (const QImage &upper, const QImage &lower, QImage &output)
static bool | blend (int &x, int &y, const QImage &upper, const QImage &lower, QImage &output)
static bool | blendOnLower (int x, int y, const QImage &upper, const QImage &lower)
static void | blendOnLower (const QImage &upper, const QPoint &upperOffset, QImage &lower, const QRect &lowerRect)
static void | blendOnLower (const QImage &upper, const QPoint &upperOffset, QImage &lower, const QRect &lowerRect, float opacity)
static QRect | computeDestinationRect (const QSize &lowerSize, Disposition disposition, QImage &upper)
static void | blendOnLower (QImage &upper, QImage &lower, Disposition disposition, float opacity)
static QImage & | channelIntensity (QImage &image, float percent, RGBComponent channel)
static QImage & | fade (QImage &image, float val, const QColor &color)
static QImage & | flatten (QImage &image, const QColor &ca, const QColor &cb, int ncols=0)
static QImage & | hash (QImage &image, Lighting lite=NorthLite, unsigned int spacing=0)
static QImage & | intensity (QImage &image, float percent)
static QImage & | modulate (QImage &image, QImage &modImage, bool reverse, ModulationType type, int factor, RGBComponent channel)
static QImage & | toGray (QImage &image, bool fast=false)
static QImage & | desaturate (QImage &image, float desat=0.3)
static QImage & | contrast (QImage &image, int c)
static QImage & | dither (QImage &image, const QColor *palette, int size)
static QImage & | selectedImage (QImage &img, const QColor &col)
static void | contrastHSV (QImage &img, bool sharpen=true)
static void | normalize (QImage &img)
static void | equalize (QImage &img)
static void | threshold (QImage &img, unsigned int value=128)
static void | solarize (QImage &img, double factor=50.0)
static QImage | emboss (QImage &src, double radius, double sigma)
static QImage | emboss (QImage &src)
static QImage | despeckle (QImage &src)
static QImage | charcoal (QImage &src, double radius, double sigma)
static QImage | charcoal (QImage &src, double factor=50.0)
static QImage | rotate (QImage &src, RotateDirection r)
static QImage | sample (QImage &src, int w, int h)
static QImage | addNoise (QImage &src, NoiseType type=GaussianNoise)
static QImage | blur (QImage &src, double radius, double sigma)
static QImage | blur (QImage &src, double factor=50.0)
static QImage | edge (QImage &src, double radius)
static QImage | implode (QImage &src, double factor=30.0, unsigned int background=0xFFFFFFFF)
static QImage | oilPaintConvolve (QImage &src, double radius)
static QImage | oilPaint (QImage &src, int radius=3)
static QImage | sharpen (QImage &src, double radius, double sigma)
static QImage | sharpen (QImage &src, double factor=30.0)
static QImage | spread (QImage &src, unsigned int amount=3)
static QImage | shade (QImage &src, bool color_shading=true, double azimuth=30.0, double elevation=30.0)
static QImage | swirl (QImage &src, double degrees=50.0, unsigned int background=0xFFFFFFFF)
static QImage | wave (QImage &src, double amplitude=25.0, double frequency=150.0, unsigned int background=0xFFFFFFFF)
static QImage | bumpmap (QImage &img, QImage &map, double azimuth, double elevation, int depth, int xofs, int yofs, int waterlevel, int ambient, bool compensate, bool invert, BumpmapType type, bool tiled)

## Detailed Description

This class includes various QImage based graphical effects.

Everything is static, so there is no need to create an instance of this class. You can just call the static methods. They are encapsulated here merely to provide a common namespace.

Definition at line 50 of file kimageeffect.h.

## Member Enumeration Documentation

enum KImageEffect::GradientType

| This enum provides a gradient type specification. See also: KImageEffect::blend(), KImageEffect::gradient(), KImageEffect::unbalancedGradient() Definition at line 58 of file kimageeffect.h.

enum KImageEffect::RGBComponent

  | This enum provides a RGB channel specification. See also: KImageEffect::blend(), KImageEffect::channelIntensity(), KImageEffect::modulate() Enumeration values:
  Red | Red channel.
  Green | Green channel.
  Blue | Blue channel.
  Gray | Grey channel.
  All | All channels.
Definition at line 73 of file kimageeffect.h.

enum KImageEffect::Lighting

  | This enum provides a lighting direction specification. See also: KImageEffect::hash() Enumeration values:
  NorthLite | Lighting from the top of the image.
  NWLite | Lighting from the top left of the image.
  WestLite | Lighting from the left of the image.
  SWLite | Lighting from the bottom left of the image.
  SouthLite | Lighting from the bottom of the image.
  SELite | Lighting from the bottom right of the image.
  EastLite | Lighting from the right of the image.
  NELite | Lighting from the top right of the image.
Definition at line 84 of file kimageeffect.h.

enum KImageEffect::ModulationType

  | This enum provides a modulation type specification. See also: KImageEffect::modulate() Enumeration values:
  Intensity | Modulate image intensity.
  Saturation | Modulate image saturation.
  HueShift | Modulate image hue.
  Contrast | Modulate image contrast.
Definition at line 98 of file kimageeffect.h.

enum KImageEffect::NoiseType

  | This enum provides a noise type specification. See also: KImageEffect::addNoise() Enumeration values:
  UniformNoise | Uniform distribution.
  GaussianNoise | Gaussian distribution.
  MultiplicativeGaussianNoise | Multiplicative Gaussian distribution.
  ImpulseNoise | Impulse distribution.
  LaplacianNoise | Laplacian distribution.
  PoissonNoise | Poisson distribution.
Definition at line 108 of file kimageeffect.h.

enum KImageEffect::RotateDirection

  | This enum provides a rotation specification. See also: KImageEffect::rotate() Enumeration values:
  Rotate90 | Rotate 90 degrees to the right.
  Rotate180 | Rotate 180 degrees.
  Rotate270 | Rotate 90 degrees to the left.
Definition at line 120 of file kimageeffect.h.

enum KImageEffect::BumpmapType

| This enum lists possible bumpmapping implementations. See also: KImageEffect::bumpmap() Definition at line 129 of file kimageeffect.h.

enum KImageEffect::Disposition

  | Disposition of a source image on top of a destination image. See also: KImageEffect::computeDestinationRect, KImageEffect::blendOnLower Since: 3.2 Enumeration values:
  NoImage | Don't overlay.
  Centered | Center top image on botton image.
  Tiled | Tile top image on bottom image.
  CenterTiled | Center and tile top image on bottom image.
  CenteredMaxpect | Center and scale aspect.
  TiledMaxpect | Tile and scale aspect.
  Scaled | Scale.
  CenteredAutoFit | Center and scale or scale aspect.
Definition at line 326 of file kimageeffect.h.

## Member Function Documentation

QImage KImageEffect::gradient | ( | const QSize & | size,
|  | const QColor & | ca,
|  | const QColor & | cb,
|  | GradientType | type,
|  | int | ncols = `3`
| ) | `[static]`

  | Create a gradient from color a to color b of the specified type. Parameters:
  | size | The desired size of the gradient.
  | ca | Color a
  | cb | Color b
  | type | The type of gradient.
  | ncols | The number of colors to use when not running on a truecolor display. The gradient will be dithered to this number of colors. Pass 0 to prevent dithering.
Definition at line 123 of file kimageeffect.cpp. References dither(), QImage::height(), QImage::scanLine(), QColor::setRgb(), and QImage::width(). Referenced by KPixmapEffect::gradient().

QImage KImageEffect::unbalancedGradient | ( | const QSize & | size,
|  | const QColor & | ca,
|  | const QColor & | cb,
|  | GradientType | type,
|  | int | xfactor = `100`,
|  | int | yfactor = `100`,
|  | int | ncols = `3`
| ) | `[static]`

  | Create an unbalanced gradient. An unbalanced gradient is a gradient where the transition from color a to color b is not linear, but in this case, exponential. Parameters:
  | size | The desired size of the gradient.
  | ca | Color a
  | cb | Color b
  | type | The type of gradient.
  | xfactor | The x decay length. Use a value between -200 and 200.
  | yfactor | The y decay length.
  | ncols | The number of colors. See KImageEffect:gradient.
Definition at line 387 of file kimageeffect.cpp. References dither(), QImage::height(), QColor::rgb(), QImage::scanLine(), QColor::setRgb(), and QImage::width(). Referenced by blend(), and KPixmapEffect::unbalancedGradient().

QImage & KImageEffect::blend | ( | const QColor & | clr,
|  | QImage & | dst,
|  | float | opacity
| ) | `[static]`

  | Blends a color into the destination image, using an opacity value for blending one into another. Very fast direct pixel manipulation is used. This function uses MMX and SSE2 instructions to blend the image on processors that support it. Parameters:
  | clr | source color to be blended into the destination image.
  | dst | destination image in which the source will be blended into.
  | opacity | opacity (between 0.0 and 1.0) which determines how much the source color will be blended into the destination image.
Returns: The destination image (dst) containing the result. Author: Karol Szwed (gallium@kde.org) Fredrik Höglund (fredrik@kde.org) Definition at line 1066 of file kimageeffect.cpp. References QImage::bits(), QImage::convertDepth(), QImage::height(), and QImage::width(). Referenced by KPixmapEffect::blend(), blend(), and selectedImage().

QImage & KImageEffect::blend | ( | QImage & | src,
|  | QImage & | dst,
|  | float | opacity
| ) | `[static]`

  | Blend the src image into the destination image, using an opacity value for blending one into another. Very fast direct pixel manipulation is used. This function uses MMX and SSE2 instructions to blend the images on processors that support it. Parameters:
  | src | source image to be blended into the destination image.
  | dst | destination image in which the source will be blended into.
  | opacity | opacity (between 0.0 and 1.0) which determines how much the source image will be blended into the destination image.
Returns: The destination image (dst) containing the result. Author: Karol Szwed (gallium@kde.org) Fredrik Höglund (fredrik@kde.org) Definition at line 1307 of file kimageeffect.cpp. References QImage::bits(), QImage::convertDepth(), QImage::height(), and QImage::width().

QImage & KImageEffect::blend | ( | QImage & | image,
|  | float | initial_intensity,
|  | const QColor & | bgnd,
|  | GradientType | eff,
|  | bool | anti_dir = `false`
| ) | `[static]`

  | Blend the provided image into a background of the indicated color. Parameters:
  | initial_intensity | this parameter takes values from -1 to 1: a) if positive: how much to fade the image in its less affected spot b) if negative: roughly indicates how much of the image remains unaffected
  | bgnd | indicates the color of the background to blend in
  | eff | lets you choose what kind of blending you like
  | anti_dir | blend in the opposite direction (makes no much sense with concentric blending effects)
  | image | must be 32bpp
Definition at line 1536 of file kimageeffect.cpp. References QImage::bits(), QImage::height(), intensity(), and QImage::width().

QImage & KImageEffect::blend | ( | QImage & | image1,
|  | QImage & | image2,
|  | GradientType | gt,
|  | int | xf = `100`,
|  | int | yf = `100`
| ) | `[static]`

  | Blend an image into another one, using a gradient type for blending from one to another. Parameters:
  | image1 | source1 and result of blending
  | image2 | source2 of blending
  | gt | gradient type for blending between source1 and source2
  | xf | x decay length for unbalanced gradient tpye
  | yf | y decay length for unbalanced gradient tpye
Definition at line 1744 of file kimageeffect.cpp. References blend(), Red, and unbalancedGradient().

QImage & KImageEffect::blend | ( | QImage & | image1,
|  | QImage & | image2,
|  | QImage & | blendImage,
|  | RGBComponent | channel
| ) | `[static]`

  | Blend an image into another one, using a color channel of a third image for the decision of blending from one to another. Parameters:
  | image1 | Source 1 and result of blending
  | image2 | Source 2 of blending
  | blendImage | If the gray value of of pixel is 0, the result for this pixel is that of image1; for a gray value of 1, the pixel of image2 is used; for a value in between, a corresponding blending is used.
  | channel | The RBG channel to use for the blending decision.
Definition at line 1762 of file kimageeffect.cpp. References QImage::bits(), Blue, QImage::colorTable(), QImage::convertDepth(), Green, QImage::height(), Red, and QImage::width().

bool KImageEffect::blend | ( | const QImage & | upper,
|  | const QImage & | lower,
|  | QImage & | output
| ) | `[static]`

  | Blend an image into another one, using alpha in the expected way. Parameters:
  | upper | the "upper" image
  | lower | the "lower" image
  | output | the target image
Author: Rik Hemsley (rikkus) <rik@kde.org> Definition at line 2377 of file kimageeffect.cpp. References QImage::copy(), QImage::scanLine(), and QImage::width().

bool KImageEffect::blend | ( | int & | x,
|  | int & | y,
|  | const QImage & | upper,
|  | const QImage & | lower,
|  | QImage & | output
| ) | `[static]`

  | Blend an image into another one, using alpha in the expected way and over coordinates `x` and `y` with respect to the lower image. The output is a QImage which is the `upper` image already blended with the `lower` one, so its size will be (in general) the same than `upper` instead of the same size than `lower` like the method above. In fact, the size of `output` is like upper's one only when it can be painted on lower, if there has to be some clipping, output's size will be the clipped area and x and y will be set to the correct up-left corner where the clipped rectangle begins. Parameters:
  | x | x-coordinate of lower image
  | y | y-coordinate of lower image
  | upper | the "upper" image
  | lower | the "lower" image
  | output | the target image
Definition at line 2449 of file kimageeffect.cpp. References QImage::create(), QImage::height(), and QImage::width().

bool KImageEffect::blendOnLower | ( | int | x,
|  | int | y,
|  | const QImage & | upper,
|  | const QImage & | lower
| ) | `[static]`

  | Blend an image into another one, using alpha in the expected way and over coordinates `x` and `y` with respect to the lower image. The output is painted in the own `lower` image. This is an optimization of the blend method above provided by convenience. Parameters:
  | x | x-coordinate of lower image
  | y | y-coordinate of lower image
  | upper | the "upper" image
  | lower | the "lower" image, which becomes the output image
Definition at line 2513 of file kimageeffect.cpp. References QImage::height(), QImage::scanLine(), and QImage::width(). Referenced by blendOnLower().

void KImageEffect::blendOnLower | ( | const QImage & | upper,
|  | const QPoint & | upperOffset,
|  | QImage & | lower,
|  | const QRect & | lowerRect
| ) | `[static]`

  | Blend part of an image into part of another, using the alpha channel in the expected way. Note that the destination rectangle will be correctly clipped. Parameters:
  | upper | the "upper" image
  | upperOffset | Offset for the part of the upper image to be used.
  | lower | the "lower" image
  | lowerRect | Rectangle for the part of the lower image where the blending will occur.
Since: 3.2 Definition at line 2583 of file kimageeffect.cpp. References QRect::height(), QRect::isValid(), QImage::rect(), QRect::setHeight(), QRect::setWidth(), QRect::width(), QRect::x(), and QRect::y().

void KImageEffect::blendOnLower | ( | const QImage & | upper,
|  | const QPoint & | upperOffset,
|  | QImage & | lower,
|  | const QRect & | lowerRect,
|  | float | opacity
| ) | `[static]`

  | Blend part of an image into part of another, using the opacity value and the alpha channel in the expected way. Note that the destination rectangle will be correctly clipped. Parameters:
  | upper | the "upper" image
  | upperOffset | Offset for the part of the upper image to be used.
  | lower | the "lower" image
  | lowerRect | Rectangle for the part of the lower image where the blending will occur.
  | opacity | Opacity (between 0.0 and 1.0) which determines how much the source image will be blended into the destination image.
Since: 3.2 Definition at line 2605 of file kimageeffect.cpp. References QRect::height(), QRect::isValid(), QRect::rect(), QRect::setHeight(), QRect::setWidth(), QRect::width(), QRect::x(), and QRect::y().

QRect KImageEffect::computeDestinationRect | ( | const QSize & | lowerSize,
|  | Disposition | disposition,
|  | QImage & | upper
| ) | `[static]`

  | Compute the destination rectangle where to draw the upper image on top of another image using the given disposition. For tiled disposition, the rectangle should be duplicated on the whole area to obtained the wanted effect. Parameters:
  | lowerSize | The size of the destination image.
  | disposition | The wanted disposition.
  | upper | The upper image. Note that this image may be scaled to adjust to the requested disposition.
Returns: the computed rectangle. Its size may exceed lowerSize. Since: 3.2 Definition at line 2627 of file kimageeffect.cpp. References Centered, CenteredAutoFit, CenteredMaxpect, CenterTiled, QRect::height(), NoImage, Scaled, QRect::setCoords(), QRect::setRect(), Tiled, TiledMaxpect, and QRect::width(). Referenced by blendOnLower().

void KImageEffect::blendOnLower | ( | QImage & | upper,
|  | QImage & | lower,
|  | Disposition | disposition,
|  | float | opacity
| ) | `[static]`

| Blend an image on top of another using a given disposition and a given opacity. The alpha channel of the upper image is used in the expected way. Beware the upper image may be modified. Since: 3.2 Definition at line 2692 of file kimageeffect.cpp. References blendOnLower(), QRect::bottom(), computeDestinationRect(), QRect::height(), QRect::left(), QRect::right(), QRect::top(), and QRect::width().

QImage & KImageEffect::channelIntensity | ( | QImage & | image,
|  | float | percent,
|  | RGBComponent | channel
| ) | `[static]`

  | Modifies the intensity of a pixmap's RGB channel component. Parameters:
  | image | The QImage to process.
  | percent | Percent value. Use a negative value to dim.
  | channel | Which channel(s) should be modified
Returns: The `image`, provided for convenience. Author: Daniel M. Duley (mosfet) Definition at line 845 of file kimageeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::depth(), Green, QImage::height(), QImage::numColors(), Red, and QImage::width(). Referenced by KPixmapEffect::channelIntensity().

QImage & KImageEffect::fade | ( | QImage & | image,
|  | float | val,
|  | const QColor & | color
| ) | `[static]`

  | Fade an image to a certain background color. The number of colors will not be changed. Parameters:
  | image | The QImage to process.
  | val | The strength of the effect. 0 <= val <= 1.
  | color | The background color.
Returns: Returns the image(), provided for convenience. Definition at line 2043 of file kimageeffect.cpp. References QImage::color(), QImage::scanLine(), and QImage::setColor(). Referenced by KPixmapEffect::fade().

QImage & KImageEffect::flatten | ( | QImage & | image,
|  | const QColor & | ca,
|  | const QColor & | cb,
|  | int | ncols = `0`
| ) | `[static]`

  | This recolors a pixmap. The most dark color will become color a, the most bright one color b, and in between. Parameters:
  | image | A QImage to process.
  | ca | Color a
  | cb | Color b
  | ncols | The number of colors to dither the image to. Pass 0 to prevent dithering.
Definition at line 1946 of file kimageeffect.cpp. References QImage::color(), dither(), QImage::pixel(), QImage::setColor(), and QImage::setPixel(). Referenced by KPixmapEffect::pattern().

QImage & KImageEffect::hash | ( | QImage & | image,
|  | Lighting | lite = `NorthLite`,
|  | unsigned int | spacing = `0`
| ) | `[static]`

  | Build a hash on any given QImage. Parameters:
  | image | The QImage to process
  | lite | The hash faces the indicated lighting (cardinal poles).
  | spacing | How many unmodified pixels in between hashes.
Returns: Returns the image(), provided for convenience. Definition at line 1865 of file kimageeffect.cpp. References QImage::bits(), EastLite, NELite, NorthLite, NWLite, SELite, SouthLite, SWLite, WestLite, and QImage::width(). Referenced by KPixmapEffect::hash().

QImage & KImageEffect::intensity | ( | QImage & | image,
|  | float | percent
| ) | `[static]`

  | Either brighten or dim the image by a specified percent. For example, .50 will modify the colors by 50%. This function uses MMX instructions to process the image on processors that support it. Parameters:
  | image | The QImage to process.
  | percent | The percent value. Use a negative value to dim.
Returns: Returns The image(), provided for convenience. Author: Daniel M. Duley (mosfet) Benjamin Roe (ben@benroe.com) Definition at line 653 of file kimageeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::depth(), KCPUInfo::haveExtension(), QImage::height(), QImage::numColors(), and QImage::width(). Referenced by blend(), and KPixmapEffect::intensity().

QImage & KImageEffect::modulate | ( | QImage & | image,
|  | QImage & | modImage,
|  | bool | reverse,
|  | ModulationType | type,
|  | int | factor,
|  | RGBComponent | channel
| ) | `[static]`

  | Modulate the image with a color channel of another image. Parameters:
  | image | The QImage to modulate and result.
  | modImage | The QImage to use for modulation.
  | reverse | Invert the meaning of image/modImage; result is image!
  | type | The modulation Type to use.
  | factor | The modulation amplitude; with 0 no effect [-200;200].
  | channel | The RBG channel of image2 to use for modulation.
Returns: Returns the image(), provided for convenience. Definition at line 936 of file kimageeffect.cpp. References All, Blue, QImage::colorTable(), Contrast, QImage::convertDepth(), Gray, Green, QImage::height(), HueShift, Intensity, Red, QColor::rgb(), Saturation, QImage::scanLine(), QColor::setHsv(), QColor::setRgb(), and QImage::width().

QImage & KImageEffect::toGray | ( | QImage & | image,
|  | bool | fast = `false`
| ) | `[static]`

  | Convert an image to grayscale. Parameters:
  | image | The QImage to process.
  | fast | Set to `true` in order to use a faster but non-photographic quality algorithm. Appropriate for things such as toolbar icons.
Returns: Returns the image(), provided for convenience. Author: Daniel M. Duley (mosfet) Definition at line 2125 of file kimageeffect.cpp. Referenced by charcoal(), and KPixmapEffect::toGray().

QImage & KImageEffect::desaturate | ( | QImage & | image,
|  | float | desat = `0.3`
| ) | `[static]`

  | Desaturate an image evenly. Parameters:
  | image | The QImage to process.
  | desat | A value between 0 and 1 setting the degree of desaturation
Returns: Returns the image(), provided for convenience. Definition at line 2175 of file kimageeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::depth(), QImage::height(), QImage::numColors(), QColor::rgb(), QColor::setHsv(), QColor::setRgb(), and QImage::width(). Referenced by KPixmapEffect::desaturate().

QImage & KImageEffect::contrast | ( | QImage & | image,
|  | int | c
| ) | `[static]`

  | Fast, but low quality contrast of an image. Also see contrastHSV. Parameters:
  | image | The QImage to process.
  | c | A contrast value between -255 to 255.
Returns: The image(), provided for convenience. Author: Daniel M. Duley (mosfet) ### KDE 4: remove Definition at line 2198 of file kimageeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::depth(), QImage::height(), QImage::numColors(), and QImage::width(). Referenced by KPixmapEffect::contrast().

QImage & KImageEffect::dither | ( | QImage & | image,
|  | const QColor * | palette,
|  | int | size
| ) | `[static]`

  | Dither an image using Floyd-Steinberg dithering for low-color situations. Parameters:
  | image | The QImage to process.
  | palette | The color palette to use
  | size | The size of the palette
Returns: Returns the image(), provided for convenience. Definition at line 2260 of file kimageeffect.cpp. References QImage::scanLine(), QImage::setColor(), QImage::setNumColors(), and QImage::width(). Referenced by KPixmapEffect::blend(), KPixmapEffect::dither(), flatten(), gradient(), KPixmapEffect::hash(), and unbalancedGradient().

QImage & KImageEffect::selectedImage | ( | QImage & | img,
|  | const QColor & | col
| ) | `[static]`

  | Calculate the image for a selected image, for instance a selected icon on the desktop. Parameters:
  | img | the QImage to select
  | col | the selected color, usually from QColorGroup::highlight().
Definition at line 2704 of file kimageeffect.cpp. References blend(). Referenced by KPixmapEffect::selectedPixmap().

void KImageEffect::contrastHSV | ( | QImage & | img,
|  | bool | sharpen = `true`
| ) | `[static]`

  | High quality, expensive HSV contrast. You can do a faster one by just taking a intensity threshold (ie: 128) and incrementing RGB color channels above it and decrementing those below it, but this gives much better results. Parameters:
  | img | The QImage to process.
  | sharpen | If true sharpness is increase, (spiffed). Otherwise it is decreased, (dulled).
Author: Daniel M. Duley (mosfet) Definition at line 4642 of file kimageeffect.cpp. References QColor::blue(), QColor::green(), QColor::red(), QColor::setHsv(), and QColor::setRgb().

void KImageEffect::normalize | ( | QImage & | img | ) | `[static]`

  | Normalises the pixel values to span the full range of color values. This is a contrast enhancement technique. Parameters:
  | img | the image that is normalised
Author: Daniel M. Duley (mosfet) Definition at line 3721 of file kimageeffect.cpp. Referenced by charcoal().

void KImageEffect::equalize | ( | QImage & | img | ) | `[static]`

  | Performs histogram equalisation on the reference image. Parameters:
  | img | the image that is equalised
Author: Daniel M. Duley (mosfet) Definition at line 3931 of file kimageeffect.cpp. Referenced by emboss().

void KImageEffect::threshold | ( | QImage & | img,
|  | unsigned int | value = `128`
| ) | `[static]`

  | Thresholds the reference image. You can also threshold images by using ThresholdDither in the various QPixmap/QImage convert methods, but this lets you specify a threshold value. Parameters:
  | img | The QImage to process.
  | value | The threshold value.
Author: Daniel M. Duley (mosfet) Definition at line 2839 of file kimageeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::height(), QImage::numColors(), and QImage::width(). Referenced by solarize().

void KImageEffect::solarize | ( | QImage & | img,
|  | double | factor = `50.0`
| ) | `[static]`

  | Produces a 'solarization' effect seen when exposing a photographic film to light during the development process. Parameters:
  | img | The QImage to process.
  | factor | The extent of the solarization (0-99.9)
Author: Daniel M. Duley (mosfet) Definition at line 3450 of file kimageeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::height(), QImage::numColors(), threshold(), and QImage::width().

QImage KImageEffect::emboss | ( | QImage & | src,
|  | double | radius,
|  | double | sigma
| ) | `[static]`

  | Embosses the source image. This involves highlighting the edges and applying various other enhancements in order to get a metal effect. Parameters:
  | src | The QImage to process.
  | radius | The radius of the gaussian not counting the center pixel. Use 0 and a suitable radius will be automatically used.
  | sigma | The standard deviation of the gaussian. Use 1 if you're not sure.
Returns: The embossed image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 4069 of file kimageeffect.cpp. References QImage::convertDepth(), and equalize(). Referenced by emboss().

QImage KImageEffect::emboss | ( | QImage & | src | ) | `[static]`

| Convenience method. Definition at line 4063 of file kimageeffect.cpp. References emboss().

QImage KImageEffect::despeckle | ( | QImage & | src | ) | `[static]`

  | Minimizes speckle noise in the source image using the 8 hull algorithm. Parameters:
  | src | The QImage to process.
Returns: The despeckled image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 2935 of file kimageeffect.cpp. References QImage::colorTable(), QImage::scanLine(), and QImage::width().

QImage KImageEffect::charcoal | ( | QImage & | src,
|  | double | radius,
|  | double | sigma
| ) | `[static]`

  | Produces a neat little "charcoal" effect. Parameters:
  | src | The QImage to process.
  | radius | The radius of the gaussian not counting the center pixel. Use 0 and a suitable radius will be automatically used.
  | sigma | The standard deviation of the gaussian. Use 1 if you're not sure.
Returns: The charcoal image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3711 of file kimageeffect.cpp. References blur(), edge(), QImage::invertPixels(), normalize(), and toGray(). Referenced by charcoal().

QImage KImageEffect::charcoal | ( | QImage & | src,
|  | double | factor = `50.0`
| ) | `[static]`

| This is provided for binary compatability only! Use the above method with a radius and sigma instead! Definition at line 3705 of file kimageeffect.cpp. References charcoal().

QImage KImageEffect::rotate | ( | QImage & | src,
|  | RotateDirection | r
| ) | `[static]`

  | Rotates the image by the specified amount. Parameters:
  | src | The QImage to process.
  | r | The rotate direction.
Returns: The rotated image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3352 of file kimageeffect.cpp. References QImage::colorTable(), QImage::create(), Rotate180, Rotate270, Rotate90, QImage::scanLine(), and QImage::setNumColors().

QImage KImageEffect::sample | ( | QImage & | src,
|  | int | w,
|  | int | h
| ) | `[static]`

  | Scales an image using simple pixel sampling. This does not produce nearly as nice a result as QImage::smoothScale(), but has the advantage of being much faster - only a few milliseconds. Parameters:
  | src | The QImage to process.
  | w | The new width.
  | h | The new height.
Returns: The scaled image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 2746 of file kimageeffect.cpp. References QImage::height(), QImage::scanLine(), QImage::setNumColors(), and QImage::width().

QImage KImageEffect::addNoise | ( | QImage & | src,
|  | NoiseType | type = `GaussianNoise`
| ) | `[static]`

  | Adds noise to an image. Parameters:
  | src | The QImage to process.
  | type | The algorithm used to generate the noise.
Returns: The image with noise added. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3141 of file kimageeffect.cpp. References QImage::colorTable(), and QImage::scanLine().

QImage KImageEffect::blur | ( | QImage & | src,
|  | double | radius,
|  | double | sigma
| ) | `[static]`

  | Blurs an image by convolving pixel neighborhoods. Parameters:
  | src | The QImage to process.
  | radius | The radius of the gaussian not counting the center pixel. Use 0 and a suitable radius will be automatically used.
  | sigma | The standard deviation of the gaussian. Use 1 if you're not sure.
Returns: The blurred image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 4288 of file kimageeffect.cpp. References QImage::convertDepth(), QImage::create(), QImage::jumpTable(), and QImage::scanLine(). Referenced by blur(), and charcoal().

QImage KImageEffect::blur | ( | QImage & | src,
|  | double | factor = `50.0`
| ) | `[static]`

| This is provided for binary compatability only! Use the above method with a radius and sigma instead! Definition at line 4282 of file kimageeffect.cpp. References blur().

QImage KImageEffect::edge | ( | QImage & | src,
|  | double | radius
| ) | `[static]`

  | Detects edges in an image using pixel neighborhoods and an edge detection mask. Parameters:
  | src | The QImage to process.
  | radius | The radius of the gaussian not counting the center pixel. Use 0 and a suitable radius will be automatically used.
Returns: The image with edges detected. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 4031 of file kimageeffect.cpp. Referenced by charcoal().

QImage KImageEffect::implode | ( | QImage & | src,
|  | double | factor = `30.0`,
|  | unsigned int | background = `0xFFFFFFFF`
| ) | `[static]`

  | Implodes an image by a specified percent. Parameters:
  | src | The QImage to process.
  | factor | The extent of the implosion.
  | background | An RGBA value to use for the background. After the effect some pixels may be "empty". This value is used for those pixels.
Returns: The imploded image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3271 of file kimageeffect.cpp. References QImage::colorTable(), QImage::height(), QImage::scanLine(), and QImage::width().

QImage KImageEffect::oilPaintConvolve | ( | QImage & | src,
|  | double | radius
| ) | `[static]`

  | Produces an oil painting effect. Parameters:
  | src | The QImage to process.
  | radius | The radius of the gaussian not counting the center pixel. Use 0 and a suitable radius will be automatically used.
Returns: The new image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3641 of file kimageeffect.cpp. References QImage::convertDepth(), QImage::detach(), QImage::height(), QImage::jumpTable(), QImage::scanLine(), and QImage::width(). Referenced by oilPaint().

QImage KImageEffect::oilPaint | ( | QImage & | src,
|  | int | radius = `3`
| ) | `[static]`

| This is provided for binary compatability only! Use the above method instead! Definition at line 3635 of file kimageeffect.cpp. References oilPaintConvolve().

QImage KImageEffect::sharpen | ( | QImage & | src,
|  | double | radius,
|  | double | sigma
| ) | `[static]`

  | Sharpens the pixels in the image using pixel neighborhoods. Parameters:
  | src | The QImage to process.
  | radius | The radius of the gaussian not counting the center pixel. Use 0 and a suitable radius will be automatically used.
  | sigma | The standard deviation of the gaussian. Use 1 if you're not sure.
Returns: The sharpened image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 4464 of file kimageeffect.cpp. Referenced by sharpen().

QImage KImageEffect::sharpen | ( | QImage & | src,
|  | double | factor = `30.0`
| ) | `[static]`

| This is provided for binary compatability only! Use the above method instead! Definition at line 4458 of file kimageeffect.cpp. References sharpen().

QImage KImageEffect::spread | ( | QImage & | src,
|  | unsigned int | amount = `3`
| ) | `[static]`

  | Randomly displaces pixels. Parameters:
  | src | The QImage to process.
  | amount | The vicinity for choosing a random pixel to swap.
Returns: The image with pixels displaced. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3473 of file kimageeffect.cpp. References QImage::detach(), and QImage::scanLine().

QImage KImageEffect::shade | ( | QImage & | src,
|  | bool | color_shading = `true`,
|  | double | azimuth = `30.0`,
|  | double | elevation = `30.0`
| ) | `[static]`

  | Shades the image using a distance light source. Parameters:
  | src | The QImage to process.
  | color_shading | If true do color shading, otherwise do grayscale.
  | azimuth | Determines the light source and direction.
  | elevation | Determines the light source and direction.
Returns: The shaded image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 4504 of file kimageeffect.cpp. References shade(). Referenced by shade().

QImage KImageEffect::swirl | ( | QImage & | src,
|  | double | degrees = `50.0`,
|  | unsigned int | background = `0xFFFFFFFF`
| ) | `[static]`

  | Swirls the image by a specified amount. Parameters:
  | src | The QImage to process.
  | degrees | The tightness of the swirl.
  | background | An RGBA value to use for the background. After the effect some pixels may be "empty". This value is used for those pixels.
Returns: The swirled image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3524 of file kimageeffect.cpp. References QImage::colorTable(), QImage::height(), QImage::scanLine(), and QImage::width().

QImage KImageEffect::wave | ( | QImage & | src,
|  | double | amplitude = `25.0`,
|  | double | frequency = `150.0`,
|  | unsigned int | background = `0xFFFFFFFF`
| ) | `[static]`

  | Modifies the pixels along a sine wave. Parameters:
  | src | The QImage to process.
  | amplitude | The amplitude of the sine wave.
  | frequency | The frequency of the sine wave.
  | background | An RGBA value to use for the background. After the effect some pixels may be "empty". This value is used for those pixels.
Returns: The new image. The original is not changed. Author: Daniel M. Duley (mosfet) Definition at line 3602 of file kimageeffect.cpp. References QImage::scanLine().

QImage KImageEffect::bumpmap | ( | QImage & | img,
|  | QImage & | map,
|  | double | azimuth,
|  | double | elevation,
|  | int | depth,
|  | int | xofs,
|  | int | yofs,
|  | int | waterlevel,
|  | int | ambient,
|  | bool | compensate,
|  | bool | invert,
|  | BumpmapType | type,
|  | bool | tiled
| ) | `[static]`

  | A bumpmapping algorithm. Parameters:
  | img | the image you want bumpmap
  | map | the map used
  | azimuth | azimuth
  | elevation | elevation
  | depth | depth (not the depth of the image, but of the map)
  | xofs | X offset
  | yofs | Y offset
  | waterlevel | level that full transparency should represent
  | ambient | ambient lighting factor
  | compensate | compensate for darkening
  | invert | invert bumpmap
  | type | type of the bumpmap
  | tiled | tile the bumpmap over the image through the Y offset
Returns: The destination image (dst) containing the result. Author: Zack Rusin <zack@kde.org> Definition at line 4885 of file kimageeffect.cpp. References QImage::create(), QImage::depth(), FXCLAMP, QImage::hasAlphaBuffer(), QImage::height(), QImage::scanLine(), and QImage::width().

The documentation for this class was generated from the following files:

- kimageeffect.h
- kimageeffect.cpp

This file is part of the documentation for kdefx Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:17:10 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003