.TH "KIconEffect" 3 "28 Jan 2004" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KIconEffect \- Applies effects to icons.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kiconeffect.h>\fP
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBEffects\fP { \fBNoEffect\fP, \fBToGray\fP, \fBColorize\fP, \fBToGamma\fP, \fBDeSaturate\fP, \fBLastEffect\fP }"
.br
.RI "\fIThis is the enumeration of all possible icon effects. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKIconEffect\fP ()"
.br
.RI "\fICreate a new KIconEffect. \fP"
.ti -1c
.RI "void \fBinit\fP ()"
.br
.RI "\fIRereads configuration. \fP"
.ti -1c
.RI "bool \fBhasEffect\fP (int group, int state) const "
.br
.RI "\fITests whether an effect has been configured for the given icon group. \fP"
.ti -1c
.RI "\fBQString\fP \fBfingerprint\fP (int group, int state) const "
.br
.RI "\fIReturns a fingerprint for the effect by encoding the given \fCgroup\fP and \fCstate\fP into a \fBQString\fP. \fP"
.ti -1c
.RI "\fBQImage\fP \fBapply\fP (\fBQImage\fP src, int group, int state) const "
.br
.RI "\fIApplies an effect to an image. \fP"
.ti -1c
.RI "\fBQImage\fP \fBapply\fP (\fBQImage\fP src, int effect, float value, const  \fBQColor\fP rgb, bool trans) const "
.br
.RI "\fIApplies an effect to an image. \fP"
.ti -1c
.RI "\fBQPixmap\fP \fBapply\fP (\fBQPixmap\fP src, int group, int state) const "
.br
.RI "\fIApplies an effect to a pixmap. \fP"
.ti -1c
.RI "\fBQPixmap\fP \fBapply\fP (\fBQPixmap\fP src, int effect, float value, const  \fBQColor\fP rgb, bool trans) const "
.br
.RI "\fIApplies an effect to a pixmap. \fP"
.ti -1c
.RI "\fBQImage\fP \fBdoublePixels\fP (\fBQImage\fP src) const "
.br
.RI "\fIReturns an image twice as large, consisting of 2x2 pixels. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "void \fBvisualActivate\fP (\fBQWidget\fP *widget, \fBQRect\fP rect)"
.br
.RI "\fIProvides visual feedback to show activation of an icon on a widget. \fP"
.ti -1c
.RI "void \fBtoGray\fP (\fBQImage\fP &image, float value)"
.br
.RI "\fITints an image gray. \fP"
.ti -1c
.RI "void \fBcolorize\fP (\fBQImage\fP &image, const  \fBQColor\fP &col, float value)"
.br
.RI "\fIColorizes an image with a specific color. \fP"
.ti -1c
.RI "void \fBdeSaturate\fP (\fBQImage\fP &image, float value)"
.br
.RI "\fIDesaturates an image. \fP"
.ti -1c
.RI "void \fBtoGamma\fP (\fBQImage\fP &image, float value)"
.br
.RI "\fIChanges the gamma value of an image. \fP"
.ti -1c
.RI "void \fBsemiTransparent\fP (\fBQImage\fP &image)"
.br
.RI "\fIRenders an image semi-transparent. \fP"
.ti -1c
.RI "void \fBsemiTransparent\fP (\fBQPixmap\fP &pixmap)"
.br
.RI "\fIRenders a pixmap semi-transparent. \fP"
.ti -1c
.RI "void \fBoverlay\fP (\fBQImage\fP &src, \fBQImage\fP &overlay)"
.br
.RI "\fIOverlays an image with an other image. \fP"
.in -1c
.SH "Detailed Description"
.PP 
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. 
.PP
\fBSee also:\fP
.RS 4
\fBKIcon\fP 
.RE
.PP

.PP
Definition at line 35 of file kiconeffect.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKIconEffect::Effects\fP"
.PP
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.
.PP
.IP "\(bu" 2
NoEffect: Don't apply any icon effect 
.IP "\(bu" 2
ToGray: Tints the icon gray 
.IP "\(bu" 2
Colorize: Tints the icon with an other color 
.IP "\(bu" 2
ToGamma: Change the gamma value if the icon 
.IP "\(bu" 2
DeSaturate: Reduce the saturation of the icon 
.PP
Definition at line 55 of file kiconeffect.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KIconEffect::KIconEffect ()"
.PP
Create a new KIconEffect. Definition at line 44 of file kiconeffect.cpp.
.PP
References init().
.SH "Member Function Documentation"
.PP 
.SS "void KIconEffect::init ()"
.PP
Rereads configuration. Definition at line 55 of file kiconeffect.cpp.
.PP
References KGlobal::config(), KConfigBase::readBoolEntry(), KConfigBase::readColorEntry(), KConfigBase::readDoubleNumEntry(), KConfigBase::readEntry(), and KConfigBase::setGroup().
.PP
Referenced by KIconEffect().
.SS "bool KIconEffect::hasEffect (int group, int state) const"
.PP
Tests whether an effect has been configured for the given icon group. \fBParameters:\fP
.RS 4
\fIgroup\fP the group to check, see \fBKIcon::Group\fP 
.br
\fIstate\fP the state to check, see \fBKIcon::States\fP 
.RE
.PP
\fBReturns:\fP
.RS 4
true if an effect is configured for the given \fCgroup\fP in \fCstate\fP, otherwise false. 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKIcon::Group\fP \fBKIcon::States\fP 
.RE
.PP
Definition at line 124 of file kiconeffect.cpp.
.SS "\fBQString\fP KIconEffect::fingerprint (int group, int state) const"
.PP
Returns a fingerprint for the effect by encoding the given \fCgroup\fP and \fCstate\fP into a \fBQString\fP. This is useful for caching. 
.PP
\fBParameters:\fP
.RS 4
\fIgroup\fP the group, see \fBKIcon::Group\fP 
.br
\fIstate\fP the state, see \fBKIcon::States\fP 
.RE
.PP
\fBReturns:\fP
.RS 4
the fingerprint of the given \fCgroup+\fCstate\fP \fP 
.RE
.PP
Definition at line 129 of file kiconeffect.cpp.
.PP
References QString::fromLatin1(), QString::isEmpty(), and QString::setNum().
.SS "\fBQImage\fP KIconEffect::apply (\fBQImage\fP src, int group, int state) const"
.PP
Applies an effect to an image. The effect to apply depends on the \fCgroup\fP and \fCstate\fP parameters, and is configured by the user. 
.PP
\fBParameters:\fP
.RS 4
\fIsrc\fP The image. 
.br
\fIgroup\fP The group for the icon, see \fBKIcon::Group\fP 
.br
\fIstate\fP The icon's state, see \fBKIcon::States\fP 
.RE
.PP
\fBReturns:\fP
.RS 4
An image with the effect applied. 
.RE
.PP
Definition at line 154 of file kiconeffect.cpp.
.PP
References KIcon::LastState.
.PP
Referenced by apply().
.SS "\fBQImage\fP KIconEffect::apply (\fBQImage\fP src, int effect, float value, const \fBQColor\fP rgb, bool trans) const"
.PP
Applies an effect to an image. \fBParameters:\fP
.RS 4
\fIsrc\fP The image. 
.br
\fIeffect\fP The effect to apply, one of \fBKIconEffect::Effects\fP. 
.br
\fIvalue\fP Strength of the effect. 0 <= \fCvalue\fP <= 1. 
.br
\fIcolor\fP Color parameter for effects that need one. 
.br
\fItrans\fP Add Transparency if trans = true. 
.RE
.PP
\fBReturns:\fP
.RS 4
An image with the effect applied. 
.RE
.PP
Definition at line 170 of file kiconeffect.cpp.
.PP
References colorize(), deSaturate(), semiTransparent(), toGamma(), and toGray().
.SS "\fBQPixmap\fP KIconEffect::apply (\fBQPixmap\fP src, int group, int state) const"
.PP
Applies an effect to a pixmap. \fBParameters:\fP
.RS 4
\fIsrc\fP The pixmap. 
.br
\fIgroup\fP The group for the icon, see \fBKIcon::Group\fP 
.br
\fIstate\fP The icon's state, see \fBKIcon::States\fP 
.RE
.PP
\fBReturns:\fP
.RS 4
A pixmap with the effect applied. 
.RE
.PP
Definition at line 203 of file kiconeffect.cpp.
.PP
References apply(), and KIcon::LastState.
.SS "\fBQPixmap\fP KIconEffect::apply (\fBQPixmap\fP src, int effect, float value, const \fBQColor\fP rgb, bool trans) const"
.PP
Applies an effect to a pixmap. \fBParameters:\fP
.RS 4
\fIsrc\fP The pixmap. 
.br
\fIeffect\fP The effect to apply, one of \fBKIconEffect::Effects\fP. 
.br
\fIvalue\fP Strength of the effect. 0 <= \fCvalue\fP <= 1. 
.br
\fIcolor\fP Color parameter for effects that need one. 
.br
\fItrans\fP Add Transparency if trans = true. 
.RE
.PP
\fBReturns:\fP
.RS 4
A pixmap with the effect applied. 
.RE
.PP
Definition at line 219 of file kiconeffect.cpp.
.PP
References apply(), QPixmap::convertFromImage(), QPixmap::convertToImage(), and semiTransparent().
.SS "\fBQImage\fP KIconEffect::doublePixels (\fBQImage\fP src) const"
.PP
Returns an image twice as large, consisting of 2x2 pixels. \fBParameters:\fP
.RS 4
\fIsrc\fP the image. 
.RE
.PP
\fBReturns:\fP
.RS 4
the scaled image. 
.RE
.PP
Definition at line 458 of file kiconeffect.cpp.
.PP
References QImage::bytesPerLine(), QImage::color(), QImage::create(), QImage::depth(), QImage::hasAlphaBuffer(), QImage::height(), QImage::numColors(), QImage::scanLine(), QImage::setAlphaBuffer(), QImage::setColor(), and QImage::width().
.SS "void KIconEffect::visualActivate (\fBQWidget\fP * widget, \fBQRect\fP rect)\fC [static]\fP"
.PP
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.
.PP
This method does nothing if the global 'Visual feedback on activation' option is not activated (See kcontrol/Peripherals/Mouse).
.PP
\fBParameters:\fP
.RS 4
\fIwidget\fP The widget on which the effect should be painted 
.br
\fIrect\fP This rectangle defines the effect's borders 
.RE
.PP
Definition at line 622 of file kiconeffect.cpp.
.PP
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().
.SS "void KIconEffect::toGray (\fBQImage\fP & image, float value)\fC [static]\fP"
.PP
Tints an image gray. \fBParameters:\fP
.RS 4
\fIimage\fP The image 
.br
\fIvalue\fP Strength of the effect. 0 <= \fCvalue\fP <= 1 
.RE
.PP
Definition at line 250 of file kiconeffect.cpp.
.PP
References QImage::bits(), QImage::colorTable(), QImage::depth(), QImage::height(), QImage::numColors(), and QImage::width().
.PP
Referenced by apply().
.SS "void KIconEffect::colorize (\fBQImage\fP & image, const \fBQColor\fP & col, float value)\fC [static]\fP"
.PP
Colorizes an image with a specific color. \fBParameters:\fP
.RS 4
\fIimage\fP The image 
.br
\fIcol\fP The color with which the \fCimage\fP is tinted 
.br
\fIvalue\fP Strength of the effect. 0 <= \fCvalue\fP <= 1 
.RE
.PP
Definition at line 272 of file kiconeffect.cpp.
.PP
References QImage::bits(), QColor::blue(), QImage::colorTable(), QImage::depth(), QColor::green(), QImage::height(), QImage::numColors(), QColor::red(), and QImage::width().
.PP
Referenced by apply().
.SS "void KIconEffect::deSaturate (\fBQImage\fP & image, float value)\fC [static]\fP"
.PP
Desaturates an image. \fBParameters:\fP
.RS 4
\fIimage\fP The image 
.br
\fIvalue\fP Strength of the effect. 0 <= \fCvalue\fP <= 1 
.RE
.PP
Definition at line 313 of file kiconeffect.cpp.
.PP
References QImage::bits(), QColor::blue(), QImage::colorTable(), QImage::depth(), QColor::green(), QImage::height(), QImage::numColors(), QColor::red(), QColor::setHsv(), QColor::setRgb(), and QImage::width().
.PP
Referenced by apply().
.SS "void KIconEffect::toGamma (\fBQImage\fP & image, float value)\fC [static]\fP"
.PP
Changes the gamma value of an image. \fBParameters:\fP
.RS 4
\fIimage\fP The image 
.br
\fIvalue\fP Strength of the effect. 0 <= \fCvalue\fP <= 1 
.RE
.PP
Definition at line 331 of file kiconeffect.cpp.
.PP
References QImage::bits(), QImage::colorTable(), QImage::depth(), QImage::height(), QImage::numColors(), QColor::rgb(), QColor::setRgb(), and QImage::width().
.PP
Referenced by apply().
.SS "void KIconEffect::semiTransparent (\fBQImage\fP & image)\fC [static]\fP"
.PP
Renders an image semi-transparent. \fBParameters:\fP
.RS 4
\fIimage\fP The image 
.RE
.PP
Definition at line 353 of file kiconeffect.cpp.
.PP
References QImage::color(), QImage::depth(), QImage::height(), QImage::numColors(), QImage::scanLine(), QImage::setAlphaBuffer(), QImage::setColor(), QImage::setPixel(), and QImage::width().
.PP
Referenced by apply(), and semiTransparent().
.SS "void KIconEffect::semiTransparent (\fBQPixmap\fP & pixmap)\fC [static]\fP"
.PP
Renders a pixmap semi-transparent. \fBParameters:\fP
.RS 4
\fIimage\fP The pixmap 
.RE
.PP
Definition at line 427 of file kiconeffect.cpp.
.PP
References QPixmap::convertFromImage(), QPixmap::convertToImage(), QImage::create(), QImage::fill(), QImage::height(), QPixmap::mask(), QImage::scanLine(), semiTransparent(), QPixmap::setMask(), QPixmap::size(), and QImage::width().
.SS "void KIconEffect::overlay (\fBQImage\fP & src, \fBQImage\fP & overlay)\fC [static]\fP"
.PP
Overlays an image with an other image. \fBParameters:\fP
.RS 4
\fIsrc\fP The image 
.br
\fIoverlay\fP The image to overlay \fCsrc\fP with 
.RE
.PP
Definition at line 507 of file kiconeffect.cpp.
.PP
References QImage::color(), QImage::depth(), QImage::hasAlphaBuffer(), QImage::height(), QImage::numColors(), QImage::scanLine(), QImage::setColor(), QImage::setNumColors(), QImage::size(), and QImage::width().
.PP
Referenced by KIconLoader::loadIcon().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
