org.kde.koala
Class KIconEffect

java.lang.Object
  extended by org.kde.koala.KIconEffect
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KIconEffect
extends java.lang.Object
implements org.kde.qt.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

Field Summary
static int Colorize
           
static int DeSaturate
           
static int LastEffect
           
static int NoEffect
          This is the enumeration of all possible icon effects.
static int ToGamma
           
static int ToGray
           
static int ToMonochrome
           
 
Constructor Summary
  KIconEffect()
          Create a new KIconEffect.
protected KIconEffect(java.lang.Class dummy)
           
 
Method Summary
 org.kde.qt.QImage apply(org.kde.qt.QImage src, int effect, float value, org.kde.qt.QColor rgb, boolean trans)
          Applies an effect to an image.
 org.kde.qt.QImage apply(org.kde.qt.QImage src, int effect, float value, org.kde.qt.QColor rgb, org.kde.qt.QColor rgb2, boolean trans)
           
 org.kde.qt.QImage apply(org.kde.qt.QImage src, int group, int state)
          Applies an effect to an image.
 org.kde.qt.QPixmap apply(org.kde.qt.QPixmap src, int effect, float value, org.kde.qt.QColor rgb, boolean trans)
          Applies an effect to a pixmap.
 org.kde.qt.QPixmap apply(org.kde.qt.QPixmap src, int effect, float value, org.kde.qt.QColor rgb, org.kde.qt.QColor rgb2, boolean trans)
           
 org.kde.qt.QPixmap apply(org.kde.qt.QPixmap src, int group, int state)
          Applies an effect to a pixmap.
static void colorize(org.kde.qt.QImage image, org.kde.qt.QColor col, float value)
          Colorizes an image with a specific color.
static void deSaturate(org.kde.qt.QImage image, float value)
          Desaturates an image.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
 org.kde.qt.QImage doublePixels(org.kde.qt.QImage src)
          Returns an image twice as large, consisting of 2x2 pixels.
protected  void finalize()
          Deletes the wrapped C++ instance
 java.lang.String fingerprint(int group, int state)
          Returns a fingerprint for the effect by encoding the given group and state into a String.
 boolean hasEffect(int group, int state)
          Tests whether an effect has been configured for the given icon group.
 void init()
          Rereads configuration.
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
static void overlay(org.kde.qt.QImage src, org.kde.qt.QImage overlay)
          Overlays an image with an other image.
static void semiTransparent(org.kde.qt.QImage image)
          Renders an image semi-transparent.
static void semiTransparent(org.kde.qt.QPixmap pixmap)
          Renders a pixmap semi-transparent.
static void toGamma(org.kde.qt.QImage image, float value)
          Changes the gamma value of an image.
static void toGray(org.kde.qt.QImage image, float value)
          Tints an image gray.
static void toMonochrome(org.kde.qt.QImage image, org.kde.qt.QColor black, org.kde.qt.QColor white, float value)
          Produces a monochrome icon with a given foreground and background color
static void visualActivate(org.kde.qt.QWidget widget, org.kde.qt.QRect rect)
          Provides visual feedback to show activation of an icon on a widget.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

    See Also:
    Constant Field Values

    ToGray

    public static final int ToGray
    See Also:
    Constant Field Values

    Colorize

    public static final int Colorize
    See Also:
    Constant Field Values

    ToGamma

    public static final int ToGamma
    See Also:
    Constant Field Values

    DeSaturate

    public static final int DeSaturate
    See Also:
    Constant Field Values

    ToMonochrome

    public static final int ToMonochrome
    See Also:
    Constant Field Values

    LastEffect

    public static final int LastEffect
    See Also:
    Constant Field Values
    Constructor Detail

    KIconEffect

    protected KIconEffect(java.lang.Class dummy)

    KIconEffect

    public KIconEffect()
    Create a new KIconEffect.

    Method Detail

    init

    public void init()
    Rereads configuration.


    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

    fingerprint

    public java.lang.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

    apply

    public org.kde.qt.QImage apply(org.kde.qt.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.

    apply

    public org.kde.qt.QImage apply(org.kde.qt.QImage src,
                                   int effect,
                                   float value,
                                   org.kde.qt.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.

    apply

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

    apply

    public org.kde.qt.QPixmap apply(org.kde.qt.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.

    apply

    public org.kde.qt.QPixmap apply(org.kde.qt.QPixmap src,
                                    int effect,
                                    float value,
                                    org.kde.qt.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.

    apply

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

    doublePixels

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

    Parameters:
    src - the image.
    Returns:
    the scaled image.

    visualActivate

    public static void visualActivate(org.kde.qt.QWidget widget,
                                      org.kde.qt.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

    toGray

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

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

    colorize

    public static void colorize(org.kde.qt.QImage image,
                                org.kde.qt.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

    toMonochrome

    public static void toMonochrome(org.kde.qt.QImage image,
                                    org.kde.qt.QColor black,
                                    org.kde.qt.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

    deSaturate

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

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

    toGamma

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

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

    semiTransparent

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

    Parameters:
    image - The image

    semiTransparent

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

    Parameters:
    pixmap - The pixmap

    overlay

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

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

    finalize

    protected void finalize()
                     throws java.lang.InternalError
    Deletes the wrapped C++ instance

    Overrides:
    finalize in class java.lang.Object
    Throws:
    java.lang.InternalError

    dispose

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


    isDisposed

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