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

pixmap_provider.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_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

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