Debian Codegraph @

src/board/imagehandler.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #ifndef IMAGEDATA_H
24 #define IMAGEDATA_H
25
26 #include <QtCore>
27 #include <QPixmap>
28
29 /* DONTREDRAWSTONES lets Qt do the scaling rather than redrawing them
30 * to scale. I'm not convinced it improves the speed all that much
31 * but I do know that it removes the border on the white stones in 2d
32 * mode so until that's fixed or until another solution is found, I'll
33 * comment this out */
34
35 //#define DONTREDRAWSTONES
36 struct WhiteDesc {
37 double cosTheta, sinTheta;
38 double stripeWidth, xAdd;
39 double stripeMul, zMul;
40 };
41
42 class ImageHandler
43 {
44 public:
45 ImageHandler();
46 ~ImageHandler();
47
48 void setDisplay(bool isDisplay = false);
49 void setSquareSize(int size);
50 static QPixmap *getBoardPixmap(QString ) ;
51 static QPixmap *getTablePixmap(QString ) ;
52 #ifdef DONTREDRAWSTONES
53 QList<QPixmap> *getStonePixmaps() const { return stonePixmapsScaled; }
54 QList<QPixmap> *getSmallStonePixmaps() const { return smallStonePixmapsScaled; }
55 QList<QPixmap> *getGhostPixmaps() const { return ghostPixmapsScaled; }
56 #else
57 QList<QPixmap> *getStonePixmaps() const { return stonePixmaps; }
58 QList<QPixmap> *getSmallStonePixmaps() const { return smallStonePixmaps; }
59 QList<QPixmap> *getGhostPixmaps() const { return ghostPixmaps; }
60 #endif //DONTREDRAWSTONES
61 static QList<QPixmap> * getAlternateGhostPixmaps() { return altGhostPixmaps; }
62 void ghostImage(QImage *img);
63
64 void icopy(int *im, QImage &qim, int w, int h);
65 void decideAppearance(WhiteDesc *desc, int size);
66 double getStripe(WhiteDesc &white, double bright, double z, int x, int y);
67
68
69 protected:
70 void scaleBoardPixmap(QPixmap *pix, int size);
71
72 private:
73
74 #ifdef DONTREDRAWSTONES
75 void generateStonePixmaps(int size);
76 QList<QPixmap> *stonePixmapsScaled, *ghostPixmapsScaled, *smallStonePixmapsScaled;
77 #endif //DONTREDRAWSTONES
78 void paintBlackStone (QImage &bi, int d, int stone_render);
79 void paintShadowStone (QImage &si, int d);
80 void paintWhiteStone (QImage &wi, int d, int stone_render);
81 int * painting_buffer;
82
83 bool isDisplayBoard;
84 QList<QPixmap> *stonePixmaps, *ghostPixmaps, *smallStonePixmaps;
85 static QList<QPixmap> *altGhostPixmaps;
86 static QPixmap *tablePixmap;
87 static QPixmap *woodPixmap1;
88 static int classCounter;
89 };
90
91 #endif