class KIconEffect

# class KIconEffect | Applies effects to icons. More...
Definition | `#include <kiconeffect.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum Effects { NoEffect, ToGray, Colorize, ToGamma, DeSaturate, LastEffect }

#### Public Methods

- KIconEffect ()
- ~KIconEffect ()
- void init ()
- bool hasEffect (int group, int state) const
- QString fingerprint (int group, int state) const
- QImage apply (QImage src, int group, int state) const
- QImage apply (QImage src, int effect, float value, const QColor rgb, bool trans) const
- QPixmap apply (QPixmap src, int group, int state) const
- QPixmap apply (QPixmap src, int effect, float value, const QColor rgb, bool trans) const
- QImage doublePixels (QImage src) const

#### Public Static Methods

- static void visualActivate (QWidget *widget, QRect rect)
- static void toGray (QImage &image, float value)
- static void colorize (QImage &image, const QColor &col, float value)
- static void deSaturate (QImage &image, float value)
- static void toGamma (QImage &image, float value)
- static void semiTransparent (QImage &image)
- static void semiTransparent (QPixmap &pixmap)
- static void overlay (QImage &src, QImage &overlay)

## Detailed Description

Applies effects to icons.

This class applies effects to icons depending on their state and group. For example, it can be used to make all disabled icons in a toolbar grey.

See also: KIcon

KIconEffect () | ### KIconEffect

Create a new KIconEffect.

~KIconEffect () | ### ~KIconEffect

enum Effects { NoEffect, ToGray, Colorize, ToGamma, DeSaturate, LastEffect } | ### Effects

This is the enumeration of all possible icon effects. Note that 'LastEffect' is no valid icon effect but only used internally to check for invalid icon effects.

- NoEffect: Don't apply any icon effect
- ToGray: Tints the icon gray
- Colorize: Tints the icon with an other color
- ToGamma: Change the gamma value if the icon
- DeSaturate: Reduce the saturation of the icon

void init () | ### init

Rereads configuration.

bool hasEffect (int group, int state) | ### hasEffect

[const]

Tests whether an effect has been configured for the given icon group.

Parameters:

group | the group to check, see KIcon::Group
state | the state to check, see KIcon::States

Returns: true if an effect is configured for the given `group` in `state`, otherwise false.

See also: Group, States, KIcon::States

QString fingerprint (int group, int state) | ### fingerprint

[const]

Returns a fingerprint for the effect by encoding the given `group` and `state` into a QString. This is useful for caching.

Parameters:

group | the group, see KIcon::Group
state | the state, see KIcon::States

Returns: the fingerprint of the given `group`+`state`

QImage apply (QImage src, int group, int state) | ### apply

[const]

Applies an effect to an image. The effect to apply depends on the `group` and `state` parameters, and is configured by the user.

Parameters:

src | The image.
group | The group for the icon, see KIcon::Group
state | The icon's state, see KIcon::States

Returns: An image with the effect applied.

QImage apply (QImage src, int effect, float value, const QColor rgb, bool trans) | ### apply

[const]

Applies an effect to an image.

Parameters:

src | The image.
effect | The effect to apply, one of KIconEffect::Effects.
value | Strength of the effect. 0 <= `value` <= 1.
color | Color parameter for effects that need one.
trans | Add Transparency if trans = true.

Returns: An image with the effect applied.

QPixmap apply (QPixmap src, int group, int state) | ### apply

[const]

Applies an effect to a pixmap.

Parameters:

src | The pixmap.
group | The group for the icon, see KIcon::Group
state | The icon's state, see KIcon::States

Returns: A pixmap with the effect applied.

QPixmap apply (QPixmap src, int effect, float value, const QColor rgb, bool trans) | ### apply

[const]

Applies an effect to a pixmap.

Parameters:

src | The pixmap.
effect | The effect to apply, one of KIconEffect::Effects.
value | Strength of the effect. 0 <= `value` <= 1.
color | Color parameter for effects that need one.
trans | Add Transparency if trans = true.

Returns: A pixmap with the effect applied.

QImage doublePixels (QImage src) | ### doublePixels

[const]

Returns an image twice as large, consisting of 2x2 pixels.

Parameters:

src | the image.

Returns: the scaled image.

void visualActivate (QWidget *widget, QRect rect) | ### visualActivate

[static]

Provides visual feedback to show activation of an icon on a widget.

Not strictly an 'icon effect', but in practice that's what it looks like.

This method does nothing if the global 'Visual feedback on activation' option is not activated (See kcontrol/Peripherals/Mouse).

Parameters:

widget | The widget on which the effect should be painted
rect | This rectangle defines the effect's borders

void toGray (QImage &image, float value) | ### toGray

[static]

Tints an image gray.

Parameters:

image | The image
value | Strength of the effect. 0 <= `value` <= 1

void colorize (QImage &image, const QColor &col, float value) | ### colorize

[static]

Colorizes an image with a specific color.

Parameters:

image | The image
col | The color with which the `image` is tinted
value | Strength of the effect. 0 <= `value` <= 1

void deSaturate (QImage &image, float value) | ### deSaturate

[static]

Desaturates an image.

Parameters:

image | The image
value | Strength of the effect. 0 <= `value` <= 1

void toGamma (QImage &image, float value) | ### toGamma

[static]

Changes the gamma value of an image.

Parameters:

image | The image
value | Strength of the effect. 0 <= `value` <= 1

void semiTransparent (QImage &image) | ### semiTransparent

[static]

Renders an image semi-transparent.

Parameters:

image | The image

void semiTransparent (QPixmap &pixmap) | ### semiTransparent

[static]

Renders a pixmap semi-transparent.

Parameters:

image | The pixmap

void overlay (QImage &src, QImage &overlay) | ### overlay

[static]

Overlays an image with an other image.

Parameters:

src | The image
overlay | The image to overlay `src` with

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:15 2003, using kdoc 2.0a54.