00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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