Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsimagemanager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifndef MMSIMAGEMANAGER_H_
00034 #define MMSIMAGEMANAGER_H_
00035 
00036 #include "mmsgui/mmsguitools.h"
00037 #include "mmstools/mmstafffile.h"
00038 #include "mmstools/mmslogger.h"
00039 #include "mmsconfig/mmsconfigdata.h"
00040 
00041 #define MMSIM_MAX_DESC_SUF      64
00042 #define MMSIM_DESC_SUF_LOADING  0xfffffffe
00043 #define MMSIM_DESC_SUF_END      0xffffffff
00044 
00045 typedef struct {
00046     MMSFBSurface    *surface;   //pointer to an surface
00047     unsigned int    delaytime;  //milliseconds
00048 } MMSIM_DESC_SUF;
00049 
00050 typedef struct {
00051     string          name;                       //extra name
00052     string          imagefile;                  //filename or url
00053     time_t          mtime;                      //modification time of the file
00054     int             usecount;                   //number of times this image is used
00055     MMSIM_DESC_SUF  suf[MMSIM_MAX_DESC_SUF+1];  //buffer for 'sub'-surfaces of the image (e.g. neede for GIF)
00056     int             sufcount;                   //number of surfaces available
00057     bool            loading;                    //true if loader is already running
00058 } MMSIM_DESC;
00059 
00060 class MMSImageManager {
00061     private:
00062         MMSFBLayer          *layer;         // this is the layer on which the image is to display
00063         MMSFBSurfacePixelFormat pixelformat;// pixelformat for all my images
00064         bool                usetaff;        // use the taff (image) format?
00065         MMSTAFF_PF          taffpf;         // pixelformat for the taff converter
00066 
00067         vector<MMSIM_DESC*> images;
00068 
00069         MMSMutex            lock;
00070 
00071         MMSConfigData       config;
00072 
00073         bool surface2TAFF(string &imagefile, MMSFBSurface *surface);
00074 
00075         bool loadGIF(string file, MMSIM_DESC *desc);
00076 
00077     public:
00078         MMSImageManager(MMSFBLayer *layer = NULL);
00079         ~MMSImageManager();
00080         MMSFBSurface *getImage(const string &path, const string &filename, MMSIM_DESC_SUF **surfdesc = NULL,
00081                                int mirror_size = 0, bool gen_taff = true);
00082         MMSFBSurface *newImage(const string &name, unsigned int width, unsigned int height, MMSFBSurfacePixelFormat pixelformat = MMSFB_PF_NONE);
00083         void releaseImage(const string &path, const string &filename);
00084         void releaseImage(MMSFBSurface *surface);
00085 };
00086 
00087 #endif /*MMSIMAGEMANAGER_H_*/

Generated by doxygen