shadow.h
00001 /* Copyright (C) 2003 by Sandro Giessl 00002 * based on the nice CVS KDesktop KShadowEngine class. thanks! 00003 * looking forward to see KShadowEngine in kdefx somewhen btw.. :) 00004 * ------------------------------------------------------------------------ 00005 * these are the original copyright notes: 00006 * This file is proposed to be part of the KDE libraries. 00007 * Copyright (C) 2003 Laur Ivan <laurivan@eircom.net> 00008 * 00009 * Many thanks to: 00010 * - Bernardo Hung <deciare@gta.igs.net> for the enhanced shadow 00011 * algorithm (currently used) 00012 * - Tim Jansen <tim@tjansen.de> for the API updates and fixes. 00013 * 00014 * This library is free software; you can redistribute it and/or 00015 * modify it under the terms of the GNU Library General Public 00016 * License version 2 as published by the Free Software Foundation. 00017 * 00018 * This library is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 * Library General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU Library General Public License 00024 * along with this library; see the file COPYING.LIB. If not, write to 00025 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00026 * Boston, MA 02111-1307, USA. 00027 */ 00028 00029 #ifndef __FX_SHADOW 00030 #define __FX_SHADOW 00031 00032 #include <qpixmap.h> 00033 #include <qimage.h> 00034 #include <qcolor.h> 00035 00036 class ShadowEngine 00037 { 00038 public: 00039 ShadowEngine(); 00040 ~ShadowEngine(); 00041 void setThickness(int thickness) { thickness_ = thickness; } 00042 void setMultiplicationFactor(double factor) { multiplicationFactor_ = factor; } 00043 QImage makeShadow(const QPixmap& textPixmap, const QColor &bgColor); 00044 private: 00045 double decay(QImage& source, int x, int y); 00046 00047 int thickness_; 00048 double multiplicationFactor_; 00049 }; 00050 00051 #endif