00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef EASYSOK_PIXMAP_PROVIDER_INC_GUARD_H
00022 #define EASYSOK_PIXMAP_PROVIDER_INC_GUARD_H
00023
00024
00025 #include <vector>
00026
00027 #include <qcolor.h>
00028 #include <qpixmap.h>
00029 #include <qpoint.h>
00030
00031 #include "theme.h"
00032
00033
00034 class PieceImage;
00035
00036
00037
00038
00046 class PixmapProvider
00047 {
00048
00049 public:
00050
00058 PixmapProvider(Theme const & theme);
00059
00060
00065 ~PixmapProvider();
00066
00067
00072 bool hasBackgroundImage() const;
00073
00074
00079 QPixmap const & backgroundImage() const;
00080
00081
00086 QColor backgroundColor() const;
00087
00088
00096 QPixmap createPixmap(int index, int size) const;
00097
00098
00106 QPoint offset(int index, int size) const;
00107
00108
00113 bool smoothScaling() const;
00114
00115
00120 void setSmoothScaling(bool smooth_scaling);
00121
00122
00123 private:
00124
00131 QPixmap convertToPixmap(PieceImage const & image) const;
00132
00133
00141 QPixmap scale(QPixmap const & pixmap, int size) const;
00142
00143
00148 Theme const & m_theme;
00149
00150
00155 QPixmap m_background_image;
00156
00157
00162 QColor m_background_color;
00163
00164
00169 mutable std::vector<QPixmap *> m_pixmaps;
00170
00171
00176 bool m_smooth_scaling;
00177 };
00178
00179
00180 #endif