Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

piece_image_effect.h

00001 /*
00002  *   EasySok --- A(nother) sokoban game for KDE.
00003  *
00004  *   Copyright (C) 2001 by Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License version 2 as
00008  *   published by the Free Software Foundation.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with this program; if not, write to the Free Software
00017  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 
00021 #ifndef EASYSOK_PIECE_IMAGE_EFFECT_INC_GUARD_H
00022 #define EASYSOK_PIECE_IMAGE_EFFECT_INC_GUARD_H
00023 
00024 
00025 #include <vector>
00026 
00027 #include <qimage.h>
00028 
00029 
00030 class QDomElement;
00031 
00032 
00033 
00034 
00042 class PieceImageEffect
00043 {
00044 
00045 public:
00046 
00051     PieceImageEffect();
00052 
00053 
00060     PieceImageEffect(QDomElement const & dom_element);
00061 
00062 
00069     QImage apply(QImage const & image) const;
00070 
00071 
00078     bool operator == (PieceImageEffect const & other_effect) const;
00079 
00080 
00081 private:
00082 
00087     enum EffectType
00088     {
00093         MOVE,
00094 
00095 
00100         ROTATE_LEFT,
00101 
00102 
00107         ROTATE_RIGHT,
00108 
00109 
00114         UTURN,
00115 
00116 
00121         HMIRROR,
00122 
00123 
00128         VMIRROR,
00129 
00130 
00135         BLEND_RGB,
00136 
00137 
00142         BLEND_RGBA,
00143 
00144 
00149         BLEND_ALPHA,
00150 
00151 
00156         COLORIZE,
00157 
00158 
00163         SCALE,
00164 
00165 
00170         CROP
00171     };
00172 
00173 
00182     void putFactor(QDomElement const & element, QString const & name, int scale);
00183 
00184 
00191     void putColor(QDomElement const & element);
00192 
00193 
00198     void rotate90(QImage & image) const;
00199 
00200 
00205     void rotate180(QImage & image) const;
00206 
00207 
00212     void rotate270(QImage & image) const;
00213 
00214 
00219     void horizontalMirror(QImage & image) const;
00220 
00221 
00226     void verticalMirror(QImage & image) const;
00227 
00228 
00239     void blendRgb(QImage & image, int factor, int red, int green, int blue) const;
00240 
00241 
00253     void blendRgba(QImage & image, int factor, int red, int green, int blue, int alpha) const;
00254 
00255 
00264     void blendAlpha(QImage & image, int factor, int alpha) const;
00265 
00266 
00277     void colorize(QImage & image, int factor, int red, int green, int blue) const;
00278 
00279 
00290     void crop(QImage & image, int x_offset, int y_offset, int width, int height) const;
00291 
00292 
00301     void move(QImage & image, int x_offset, int y_offset) const;
00302 
00303 
00312     void scale(QImage & image, int width, int height) const;
00313 
00314 
00319     std::vector<int> m_effects;
00320 
00321 
00326     std::vector<int> m_parameters;
00327 };
00328 
00329 
00330 #endif

Generated at Sun Jan 6 18:49:09 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001