org.kde.koala

Class KIconEffect

public class KIconEffect extends Object implements QtSupport

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

See Also: KIcon

UNKNOWN: Applies effects to icons.

Field Summary
static intColorize
static intDeSaturate
static intLastEffect
static intNoEffect
This is the enumeration of all possible icon effects.
static intToGamma
static intToGray
static intToMonochrome
Constructor Summary
protected KIconEffect(Class dummy)
KIconEffect()
Create a new KIconEffect.
Method Summary
QImageapply(QImage src, int group, int state)
Applies an effect to an image.
QImageapply(QImage src, int effect, float value, QColor rgb, boolean trans)
Applies an effect to an image.
QImageapply(QImage src, int effect, float value, QColor rgb, QColor rgb2, boolean trans)
QPixmapapply(QPixmap src, int group, int state)
Applies an effect to a pixmap.
QPixmapapply(QPixmap src, int effect, float value, QColor rgb, boolean trans)
Applies an effect to a pixmap.
QPixmapapply(QPixmap src, int effect, float value, QColor rgb, QColor rgb2, boolean trans)
static voidcolorize(QImage image, QColor col, float value)
Colorizes an image with a specific color.
static voiddeSaturate(QImage image, float value)
Desaturates an image.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
QImagedoublePixels(QImage src)
Returns an image twice as large, consisting of 2x2 pixels.
protected voidfinalize()
Deletes the wrapped C++ instance
Stringfingerprint(int group, int state)
Returns a fingerprint for the effect by encoding the given group and state into a String.
booleanhasEffect(int group, int state)
Tests whether an effect has been configured for the given icon group.
voidinit()
Rereads configuration.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
static voidoverlay(QImage src, QImage overlay)
Overlays an image with an other image.
static voidsemiTransparent(QImage image)
Renders an image semi-transparent.
static voidsemiTransparent(QPixmap pixmap)
Renders a pixmap semi-transparent.
static voidtoGamma(QImage image, float value)
Changes the gamma value of an image.
static voidtoGray(QImage image, float value)
Tints an image gray.
static voidtoMonochrome(QImage image, QColor black, QColor white, float value)
Produces a monochrome icon with a given foreground and background color
static voidvisualActivate(QWidget widget, QRect rect)
Provides visual feedback to show activation of an icon on a widget.

Field Detail

Colorize

public static final int Colorize

DeSaturate

public static final int DeSaturate

LastEffect

public static final int LastEffect

NoEffect

public static final int NoEffect
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 of the icon
  • DeSaturate: Reduce the saturation of the icon
  • ToMonochrome: Produces a monochrome icon
  • @short This is the enumeration of all possible icon effects.

    ToGamma

    public static final int ToGamma

    ToGray

    public static final int ToGray

    ToMonochrome

    public static final int ToMonochrome

    Constructor Detail

    KIconEffect

    protected KIconEffect(Class dummy)

    KIconEffect

    public KIconEffect()
    Create a new KIconEffect.

    UNKNOWN: Create a new KIconEffect.

    Method Detail

    apply

    public QImage apply(QImage src, int group, int state)
    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.

    UNKNOWN: Applies an effect to an image.

    apply

    public QImage apply(QImage src, int effect, float value, QColor rgb, boolean trans)
    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. rgb Color parameter for effects that need one. trans Add Transparency if trans = true.

    Returns: An image with the effect applied.

    UNKNOWN: Applies an effect to an image.

    apply

    public QImage apply(QImage src, int effect, float value, QColor rgb, QColor rgb2, boolean trans)

    UNKNOWN:

    apply

    public QPixmap apply(QPixmap src, int group, int state)
    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.

    UNKNOWN: Applies an effect to a pixmap.

    apply

    public QPixmap apply(QPixmap src, int effect, float value, QColor rgb, boolean trans)
    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. rgb Color parameter for effects that need one. trans Add Transparency if trans = true.

    Returns: A pixmap with the effect applied.

    UNKNOWN: Applies an effect to a pixmap.

    apply

    public QPixmap apply(QPixmap src, int effect, float value, QColor rgb, QColor rgb2, boolean trans)

    UNKNOWN:

    colorize

    public static void colorize(QImage image, QColor col, float value)
    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

    UNKNOWN: Colorizes an image with a specific color.

    deSaturate

    public static void deSaturate(QImage image, float value)
    Desaturates an image.

    Parameters: image The image value Strength of the effect. 0 <= value <= 1

    UNKNOWN: Desaturates an image.

    dispose

    public void dispose()
    Delete the wrapped C++ instance ahead of finalize()

    doublePixels

    public QImage doublePixels(QImage src)
    Returns an image twice as large, consisting of 2x2 pixels.

    Parameters: src the image.

    Returns: the scaled image.

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

    finalize

    protected void finalize()
    Deletes the wrapped C++ instance

    fingerprint

    public String fingerprint(int group, int state)
    Returns a fingerprint for the effect by encoding the given group and state into a String. 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

    UNKNOWN: Returns a fingerprint for the effect by encoding the given group and state into a String.

    hasEffect

    public boolean hasEffect(int group, int state)
    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: KIcon#Group KIcon#States

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

    init

    public void init()
    Rereads configuration.

    UNKNOWN: Rereads configuration.

    isDisposed

    public boolean isDisposed()
    Has the wrapped C++ instance been deleted?

    overlay

    public static void overlay(QImage src, QImage overlay)
    Overlays an image with an other image.

    Parameters: src The image overlay The image to overlay src with

    UNKNOWN: Overlays an image with an other image.

    semiTransparent

    public static void semiTransparent(QImage image)
    Renders an image semi-transparent.

    Parameters: image The image

    UNKNOWN: Renders an image semi-transparent.

    semiTransparent

    public static void semiTransparent(QPixmap pixmap)
    Renders a pixmap semi-transparent.

    Parameters: pixmap The pixmap

    UNKNOWN: Renders a pixmap semi-transparent.

    toGamma

    public static void toGamma(QImage image, float value)
    Changes the gamma value of an image.

    Parameters: image The image value Strength of the effect. 0 <= value <= 1

    UNKNOWN: Changes the gamma value of an image.

    toGray

    public static void toGray(QImage image, float value)
    Tints an image gray.

    Parameters: image The image value Strength of the effect. 0 <= value <= 1

    UNKNOWN: Tints an image gray.

    toMonochrome

    public static void toMonochrome(QImage image, QColor black, QColor white, float value)
    Produces a monochrome icon with a given foreground and background color

    Parameters: image The image white The color with which the white parts of image are painted black The color with which the black parts of image are painted value Strength of the effect. 0 <= value <= 1

    UNKNOWN: Produces a monochrome icon with a given foreground and background color

    visualActivate

    public static void visualActivate(QWidget widget, QRect rect)
    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

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