class KImageEffect

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

Definition#include <kimageeffect.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Static Methods


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.

enum GradientType { VerticalGradient, HorizontalGradient, DiagonalGradient, CrossDiagonalGradient, PyramidGradient, RectangleGradient, PipeCrossGradient, EllipticGradient }

GradientType

enum RGBComponent { Red, Green, Blue, Gray, All }

RGBComponent

enum Lighting {NorthLite, NWLite, WestLite, SWLite, SouthLite, SELite, EastLite, NELite}

Lighting

enum ModulationType { Intensity, Saturation, HueShift, Contrast }

ModulationType

enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise, ImpulseNoise, LaplacianNoise, PoissonNoise}

NoiseType

enum RotateDirection { Rotate90, Rotate180, Rotate270 }

RotateDirection

QImage  gradient (const QSize &size, const QColor &ca, const QColor &cb, GradientType type, int ncols=3)

gradient

[static]

Create a gradient from color a to color b of the specified type.

Parameters:
sizeThe desired size of the gradient.
caColor a
cbColor b
typeThe type of gradient.
ncolsThe 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.

QImage  unbalancedGradient (const QSize &size, const QColor &ca, const QColor &cb, GradientType type, int xfactor = 100, int yfactor = 100, int ncols = 3)

unbalancedGradient

[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:
sizeThe desired size of the gradient.
caColor a
cbColor b
typeThe type of gradient.
xfactorThe x decay length. Use a value between -200 and 200.
yfactorThe y decay length.
ncolsThe number of colors. See KPixmapEffect:gradient.

QImage&  blend (const QColor& clr, QImage& dst, float opacity)

blend

[static]

Blends a color into the destination image, using an opacity value for blending one into another. Very fast direct pixel manipulation is used.

Parameters:
clrsource color to be blended into the destination image.
dstdestination image in which the source will be blended into.
opacityopacity (in percent) which determines how much the source color will be blended into the destination image.

Returns: The destination image (dst) containing the result.

QImage&  blend (QImage& src, QImage& dst, float opacity)

blend

[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.

Parameters:
srcsource image to be blended into the destination image.
dstdestination image in which the source will be blended into.
opacityopacity (in percent) which determines how much the source image will be blended into the destination image.

Returns: The destination image (dst) containing the result.

QImage&  blend (QImage &image, float initial_intensity, const QColor &bgnd, GradientType eff, bool anti_dir=false)

blend

[static]

Blend the provided image into a background of the indicated color.

Parameters:
initial_intensitythis 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
bgndindicates the color of the background to blend in
efflets you choose what kind of blending you like
anti_dirblend in the opposite direction (makes no much sense with concentric blending effects)
imagemust be 32bpp

QImage&  blend (QImage &image1,QImage &image2, GradientType gt, int xf=100, int yf=100)

blend

[static]

Blend an image into another one, using a gradient type for blending from one to another.

Parameters:
image1source1 and result of blending
image2source2 of blending
gtgradient type for blending between source1 and source2
xfx decay length for unbalanced gradient tpye
yfy decay length for unbalanced gradient tpye

QImage&  blend (QImage &image1, QImage &image2, QImage &blendImage, RGBComponent channel)

blend

[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:
image1Source 1 and result of blending
image2Source 2 of blending
blendImageIf 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 inbetween, a corresponding blending is used.
channelThe RBG channel to use for the blending decision.

bool  blend (const QImage & upper, const QImage & lower, QImage & output)

blend

[static]

Blend an image into another one, using alpha in the expected way.

bool  blend (int &x, int &y, const QImage & upper, const QImage & lower, QImage & output)

blend

[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.

bool  blendOnLower (int x, int y, const QImage & upper, const QImage & lower)

blendOnLower

[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.

QImage&  channelIntensity (QImage &image, float percent, RGBComponent channel)

channelIntensity

[static]

Modifies the intensity of a pixmap's RGB channel component.

Parameters:
imageThe QImage to process.
percentPercent value. Use a negative value to dim.
channelWhich channel(s) should be modified

Returns: The image, provided for convenience.

QImage&  fade (QImage &img, float val, const QColor &color)

fade

[static]

Fade an image to a certain background color.

The number of colors will not be changed.

Parameters:
imageThe QImage to process.
valThe strength of the effect. 0 <= val <= 1.
colorThe background color.

Returns: Returns the image(), provided for convenience.

QImage&  flatten (QImage &image, const QColor &ca, const QColor &cb, int ncols=0)

flatten

[static]

This recolors a pixmap. The most dark color will become color a, the most bright one color b, and in between.

Parameters:
imageA QImage to process.
caColor a
cbColor b

QImage&  hash (QImage &image, Lighting lite=NorthLite, unsigned int spacing=0)

hash

[static]

Build a hash on any given QImage

Parameters:
imageThe QImage to process
liteThe hash faces the indicated lighting (cardinal poles).
spacingHow many unmodified pixels inbetween hashes.

Returns: Returns the image(), provided for convenience.

QImage&  intensity (QImage &image, float percent)

intensity

[static]

Either brighten or dim the image by a specified percent. For example, .50 will modify the colors by 50%.

Parameters:
imageThe QImage to process.
percentThe percent value. Use a negative value to dim.

Returns: Returns The image(), provided for convenience.

QImage&  modulate (QImage &image, QImage &modImage, bool reverse, ModulationType type, int factor, RGBComponent channel)

modulate

[static]

Modulate the image with a color channel of another image.

Parameters:
imageThe QImage to modulate and result.
modImageThe QImage to use for modulation.
reverseInvert the meaning of image/modImage; result is image!
typeThe modulation Type to use.
factorThe modulation amplitude; with 0 no effect [-200;200].
channelThe RBG channel of image2 to use for modulation.

Returns: Returns the image(), provided for convenience.

QImage&  toGray (QImage &image, bool fast = false)

toGray

[static]

Convert an image to grayscale.

Parameters:
imageThe QImage to process.
fastSet 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.

QImage&  desaturate (QImage &image, float desat = 0.3)

desaturate

[static]

Desaturate an image evenly.

Parameters:
imageThe QImage to process.
desatA value between 0 and 1 setting the degree of desaturation

Returns: Returns the image(), provided for convenience.

QImage&  contrast (QImage &image, int c)

contrast

[static]

Fast, but low quality contrast of an image. Also see contrastHSV.

Parameters:
imageThe QImage to process.
cA contrast value between -255 to 255.

Returns: The image(), provided for convenience.

QImage&  dither (QImage &img, const QColor *palette, int size)

dither

[static]

Dither an image using Floyd-Steinberg dithering for low-color situations.

Parameters:
imageThe QImage to process.
paletteThe color palette to use
sizeThe size of the palette

Returns: Returns the image(), provided for convenience.

QImage&  selectedImage ( QImage &img, const QColor &col )

selectedImage

[static]

Calculate the image for a selected image, for instance a selected icon on the desktop.

Parameters:
imgthe QImage to select
colthe selected color, usually from QColorGroup::highlight().

void  contrastHSV (QImage &img, bool sharpen=true)

contrastHSV

[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:
imgThe QImage to process.
sharpenIf true sharpness is increase, (spiffed). Otherwise it is decreased, (dulled).

void  normalize (QImage &img)

normalize

[static]

Normalizes the pixel values to span the full range of color values. This is a contrast enhancement technique.

void  equalize (QImage &img)

equalize

[static]

Performs histogram equalization on the reference image.

void  threshold (QImage &img, unsigned int value=128)

threshold

[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:
imgThe QImage to process.
valueThe threshold value.

void  solarize (QImage &img, double factor=50.0)

solarize

[static]

Produces a 'solarization' effect seen when exposing a photographic film to light during the development process.

Parameters:
imgThe QImage to process.
factorThe extent of the solarization (0-99.9)

QImage  emboss (QImage &src)

emboss

[static]

Embosses the source image. This involves highlighting the edges and applying various other enhancements in order to get a metal effect.

Parameters:
srcThe QImage to process.

Returns: The embossed image. The original is not changed.

QImage  despeckle (QImage &src)

despeckle

[static]

Minimizes speckle noise in the source image using the 8 hull algorithm.

Parameters:
srcThe QImage to process.

Returns: The despeckled image. The original is not changed.

QImage  charcoal (QImage &src, double factor=50.0)

charcoal

[static]

Produces a neat little "charcoal" effect.

Parameters:
srcThe QImage to process.
factorThe factor for detecting lines (0-99.0).

Returns: The charcoal image. The original is not changed.

QImage  rotate (QImage &src, RotateDirection r)

rotate

[static]

Rotates the image by the specified amount

Parameters:
srcThe QImage to process.
rThe rotate direction.

Returns: The rotated image. The original is not changed.

QImage  sample (QImage &src, int w, int h)

sample

[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:
srcThe QImage to process.
wThe new width.
hThe new height.

Returns: The scaled image. The original is not changed.

QImage  addNoise (QImage &src, NoiseType type = GaussianNoise)

addNoise

[static]

Adds noise to an image.

Parameters:
srcThe QImage to process.
typeThe algorithm used to generate the noise.

Returns: The image with noise added. The original is not changed.

QImage  blur (QImage &src, double factor=50.0)

blur

[static]

Blurs an image by convolving pixel neighborhoods.

Parameters:
srcThe QImage to process.
factorThe percent weight to give to the center pixel.

Returns: The blurred image. The original is not changed.

QImage  edge (QImage &src, double factor=50.0)

edge

[static]

Detects edges in an image using pixel neighborhoods and an edge detection mask.

Parameters:
srcThe QImage to process.
factorThe percent weight to give to the center pixel.

Returns: The image with edges detected. The original is not changed.

QImage  implode (QImage &src, double factor=30.0, unsigned int background = 0xFFFFFFFF)

implode

[static]

Implodes an image by a specified percent.

Parameters:
srcThe QImage to process.
factorThe extent of the implosion.
backgroundAn 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.

QImage  oilPaint (QImage &src, int radius=3)

oilPaint

[static]

Produces an oil painting effect.

Parameters:
srcThe QImage to process.
radiusThe radius of the pixel neighborhood used in applying the effect.

Returns: The new image. The original is not changed.

QImage  sharpen (QImage &src, double factor=30.0)

sharpen

[static]

Sharpens the pixels in the image using pixel neighborhoods.

Parameters:
srcThe QImage to process.
factorThe percent weight to give to the center pixel.

Returns: The sharpened image. The original is not changed.

QImage  spread (QImage &src, unsigned int amount=3)

spread

[static]

Randomly displaces pixels.

Parameters:
srcThe QImage to process.
amountThe vicinity for choosing a random pixel to swap.

Returns: The image with pixels displaced. The original is not changed.

QImage  shade (QImage &src, bool color_shading=true, double azimuth=30.0, double elevation=30.0)

shade

[static]

Shades the image using a distance light source.

Parameters:
srcThe QImage to process.
color_shadingIf true do color shading, otherwise do grayscale.
azimuthDetermines the light source and direction.
elevationDetermines the light source and direction.

Returns: The shaded image. The original is not changed.

QImage  swirl (QImage &src, double degrees=50.0, unsigned int background = 0xFFFFFFFF)

swirl

[static]

Swirls the image by a specified amount

Parameters:
srcThe QImage to process.
degreesThe tightness of the swirl.
backgroundAn 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.

QImage  wave (QImage &src, double amplitude=25.0, double frequency=150.0, unsigned int background = 0xFFFFFFFF)

wave

[static]

Modifies the pixels along a sine wave.

Parameters:
srcThe QImage to process.
amplitudeThe amplitude of the sine wave.
wavelengthThe frequency of the sine wave.

Returns: The new image. The original is not changed.


Generated by: dfaure on faure on Tue Apr 16 08:48:46 2002, using kdoc 2.0a53.