# 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

- 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 }

#### Public Static Methods

- 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 (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 QImage& channelIntensity (QImage &image, float percent, RGBComponent channel)
- static QImage& fade (QImage &img, 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 &img, const QColor *palette, int size)
- static bool paint (int x, int y, QImage &tgt, const QImage &src)

## 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

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:

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.

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:

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 KPixmapEffect:gradient.

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_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)

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:

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

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:

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 inbetween, a corresponding blending is used.
channel | The 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:

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.

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:

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.

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:

image | A QImage to process.
ca | Color a
cb | Color b

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

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

image | The QImage to process.
percent | The 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:

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.

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

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

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

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

QImage& contrast (QImage &image, int c) | ### contrast

[static]

Modifie the contrast of an image.

Parameters:

image | The QImage to process.
c | A 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:

image | The QImage to process.
palette | The color palette to use
size | The size of the palette

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

bool paint (int x, int y, QImage &tgt, const QImage &src) | ### paint

[static]

Paints (copy) an image `src` over another one (`tgt`) at the specified point, x,y relative to tgt. `return` Returns true if everything was ok, or false if it couldn't be copied (because they're not 32-bit images). Note that if you specify x,y outside a reasonable range (outside the tgt image), then the return value is true.

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:24 2001, using kdoc 2.0a53.