KIconEffect Class Reference
Applies effects to icons. More...
#include <kiconeffect.h>
Public Types | |
enum | Effects { NoEffect, ToGray, Colorize, ToGamma, DeSaturate, LastEffect } |
This is the enumeration of all possible icon effects. More... | |
Public Member Functions | |
KIconEffect () | |
Create a new KIconEffect. | |
void | init () |
Rereads configuration. | |
bool | hasEffect (int group, int state) const |
Tests whether an effect has been configured for the given icon group. | |
QString | fingerprint (int group, int state) const |
Returns a fingerprint for the effect by encoding the given group and state into a QString. | |
QImage | apply (QImage src, int group, int state) const |
Applies an effect to an image. | |
QImage | apply (QImage src, int effect, float value, const QColor rgb, bool trans) const |
Applies an effect to an image. | |
QPixmap | apply (QPixmap src, int group, int state) const |
Applies an effect to a pixmap. | |
QPixmap | apply (QPixmap src, int effect, float value, const QColor rgb, bool trans) const |
Applies an effect to a pixmap. | |
QImage | doublePixels (QImage src) const |
Returns an image twice as large, consisting of 2x2 pixels. | |
Static Public Member Functions | |
void | visualActivate (QWidget *widget, QRect rect) |
Provides visual feedback to show activation of an icon on a widget. | |
void | toGray (QImage &image, float value) |
Tints an image gray. | |
void | colorize (QImage &image, const QColor &col, float value) |
Colorizes an image with a specific color. | |
void | deSaturate (QImage &image, float value) |
Desaturates an image. | |
void | toGamma (QImage &image, float value) |
Changes the gamma value of an image. | |
void | semiTransparent (QImage &image) |
Renders an image semi-transparent. | |
void | semiTransparent (QPixmap &pixmap) |
Renders a pixmap semi-transparent. | |
void | overlay (QImage &src, QImage &overlay) |
Overlays an image with an other image. |
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
Definition at line 35 of file kiconeffect.h.
Member Enumeration Documentation
|
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.
Definition at line 55 of file kiconeffect.h. |
Constructor & Destructor Documentation
|
Create a new KIconEffect.
Definition at line 44 of file kiconeffect.cpp. References init(). |
Member Function Documentation
|
Rereads configuration.
Definition at line 55 of file kiconeffect.cpp. References KGlobal::config(), KConfigBase::readBoolEntry(), KConfigBase::readColorEntry(), KConfigBase::readDoubleNumEntry(), KConfigBase::readEntry(), and KConfigBase::setGroup(). Referenced by KIconEffect(). |
|
Tests whether an effect has been configured for the given icon group.
Definition at line 124 of file kiconeffect.cpp. |
|
Returns a fingerprint for the effect by encoding the given This is useful for caching.
Definition at line 129 of file kiconeffect.cpp. References QString::fromLatin1(), QString::isEmpty(), and QString::setNum(). |
|
Applies an effect to an image.
The effect to apply depends on the
Definition at line 154 of file kiconeffect.cpp. References KIcon::LastState. Referenced by apply(). |
|
Applies an effect to an image.
Definition at line 170 of file kiconeffect.cpp. References colorize(), deSaturate(), semiTransparent(), toGamma(), and toGray(). |
|
Applies an effect to a pixmap.
Definition at line 203 of file kiconeffect.cpp. References apply(), and KIcon::LastState. |
|
Applies an effect to a pixmap.
Definition at line 219 of file kiconeffect.cpp. References apply(), QPixmap::convertFromImage(), QPixmap::convertToImage(), and semiTransparent(). |
|
Returns an image twice as large, consisting of 2x2 pixels.
Definition at line 458 of file kiconeffect.cpp. References QImage::bytesPerLine(), QImage::color(), QImage::create(), QImage::depth(), QImage::hasAlphaBuffer(), QImage::height(), QImage::numColors(), QImage::scanLine(), QImage::setAlphaBuffer(), QImage::setColor(), and QImage::width(). |
|
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).
Definition at line 622 of file kiconeffect.cpp. References QRect::center(), QPainter::drawRect(), QPainter::flush(), QRect::height(), QPainter::setPen(), QPainter::setRasterOp(), QRect::setRect(), KGlobalSettings::visualActivate(), KGlobalSettings::visualActivateSpeed(), QRect::width(), QPoint::x(), and QPoint::y(). |
|
Tints an image gray.
Definition at line 250 of file kiconeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::depth(), QImage::height(), QImage::numColors(), and QImage::width(). Referenced by apply(). |
|
Colorizes an image with a specific color.
Definition at line 272 of file kiconeffect.cpp. References QImage::bits(), QColor::blue(), QImage::colorTable(), QImage::depth(), QColor::green(), QImage::height(), QImage::numColors(), QColor::red(), and QImage::width(). Referenced by apply(). |
|
Desaturates an image.
Definition at line 313 of file kiconeffect.cpp. References QImage::bits(), QColor::blue(), QImage::colorTable(), QImage::depth(), QColor::green(), QImage::height(), QColor::hsv(), QImage::numColors(), QColor::red(), QColor::setHsv(), QColor::setRgb(), and QImage::width(). Referenced by apply(). |
|
Changes the gamma value of an image.
Definition at line 331 of file kiconeffect.cpp. References QImage::bits(), QImage::colorTable(), QImage::depth(), QImage::height(), QImage::numColors(), QColor::rgb(), QColor::setRgb(), and QImage::width(). Referenced by apply(). |
|
Renders an image semi-transparent.
Definition at line 353 of file kiconeffect.cpp. References QImage::color(), QImage::depth(), QImage::height(), QImage::numColors(), QImage::scanLine(), QImage::setAlphaBuffer(), QImage::setColor(), QImage::setPixel(), and QImage::width(). Referenced by apply(), and semiTransparent(). |
|
Renders a pixmap semi-transparent.
Definition at line 427 of file kiconeffect.cpp. References QPixmap::convertFromImage(), QPixmap::convertToImage(), QImage::create(), QImage::fill(), QImage::height(), QPixmap::mask(), QImage::scanLine(), semiTransparent(), QPixmap::setMask(), QPixmap::size(), and QImage::width(). |
|
Overlays an image with an other image.
Definition at line 507 of file kiconeffect.cpp. References QImage::color(), QImage::depth(), QImage::hasAlphaBuffer(), QImage::height(), QImage::numColors(), QImage::scanLine(), QImage::setColor(), QImage::setNumColors(), QImage::size(), and QImage::width(). Referenced by KIconLoader::loadIcon(). |
The documentation for this class was generated from the following files: