KIconEffect Class Reference
from PyKDE4.kdeui import *
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 gray.
- See also:
- KIcon
Enumerations | |
Effects | { NoEffect, ToGray, Colorize, ToGamma, DeSaturate, ToMonochrome, LastEffect } |
Methods | |
__init__ (self) | |
__init__ (self, KIconEffect other) | |
QImage | apply (self, QImage src, int group, int state) |
QImage | apply (self, QImage src, int effect, float value, QColor rgb, bool trans) |
QImage | apply (self, QImage src, int effect, float value, QColor rgb, QColor rgb2, bool trans) |
QPixmap | apply (self, QPixmap src, int group, int state) |
QPixmap | apply (self, QPixmap src, int effect, float value, QColor rgb, bool trans) |
QPixmap | apply (self, QPixmap src, int effect, float value, QColor rgb, QColor rgb2, bool trans) |
QImage | doublePixels (self, QImage src) |
QString | fingerprint (self, int group, int state) |
bool | hasEffect (self, int group, int state) |
init (self) | |
Static Methods | |
colorize (QImage image, QColor col, float value) | |
deSaturate (QImage image, float value) | |
overlay (QImage src, QImage overlay) | |
semiTransparent (QImage image) | |
semiTransparent (QPixmap pixmap) | |
toGamma (QImage image, float value) | |
toGray (QImage image, float value) | |
toMonochrome (QImage image, QColor black, QColor white, float value) |
Method Documentation
__init__ | ( | self ) |
Create a new KIconEffect.
__init__ | ( | self, | ||
KIconEffect | other | |||
) |
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 KIconLoader.Group state The icon's state, see KIconLoader.States
- Returns:
- An image with the effect applied.
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.
Applies an effect to a pixmap.
- Parameters:
-
src The pixmap. group The group for the icon, see KIconLoader.Group state The icon's state, see KIconLoader.States
- Returns:
- A pixmap with the effect applied.
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.
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
deSaturate | ( | QImage | image, | |
float | value | |||
) |
Desaturates an image.
- Parameters:
-
image The image value Strength of the effect. 0 <= value <= 1
Returns an image twice as large, consisting of 2x2 pixels.
- Parameters:
-
src the image.
- Returns:
- the scaled image.
QString fingerprint | ( | self, | ||
int | group, | |||
int | state | |||
) |
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 KIconLoader.Group state the state, see KIconLoader.States
- Returns:
- the fingerprint of the given group+@p state
bool hasEffect | ( | self, | ||
int | group, | |||
int | state | |||
) |
Tests whether an effect has been configured for the given icon group.
- Parameters:
-
group the group to check, see KIconLoader.Group state the state to check, see KIconLoader.States
- Returns:
- true if an effect is configured for the given group in state, otherwise false.
- See also:
- KIconLoader.Group KIconLoader.States
init | ( | self ) |
Rereads configuration.
Overlays an image with an other image.
- Parameters:
-
src The image overlay The image to overlay src with
semiTransparent | ( | QImage | image | |
) |
Renders an image semi-transparent.
- Parameters:
-
image The image
semiTransparent | ( | QPixmap | pixmap | |
) |
Renders a pixmap semi-transparent.
- Parameters:
-
pixmap The pixmap
toGamma | ( | QImage | image, | |
float | value | |||
) |
Changes the gamma value of an image.
- Parameters:
-
image The image value Strength of the effect. 0 <= value <= 1
toGray | ( | QImage | image, | |
float | value | |||
) |
Tints an image gray.
- Parameters:
-
image The image value Strength of the effect. 0 <= value <= 1
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
Enumeration Documentation
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.
- Enumerator:
-
NoEffect ToGray Colorize ToGamma DeSaturate ToMonochrome LastEffect