# CEGUIRenderCache.h

    00001 /************************************************************************
    00002     filename:   CEGUIRenderCache.h
    00003     created:    Fri Jun 17 2005
    00004     author:     Paul D Turner <paul@cegui.org.uk>
    00005 *************************************************************************/
    00006 /*************************************************************************
    00007     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00008     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00009
    00010     This library is free software; you can redistribute it and/or
    00011     modify it under the terms of the GNU Lesser General Public
    00012     License as published by the Free Software Foundation; either
    00013     version 2.1 of the License, or (at your option) any later version.
    00014
    00015     This library is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018     Lesser General Public License for more details.
    00019
    00020     You should have received a copy of the GNU Lesser General Public
    00021     License along with this library; if not, write to the Free Software
    00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00023 *************************************************************************/
    00024 #ifndef _CEGUIRenderCache_h_
    00025 #define _CEGUIRenderCache_h_
    00026
    00027 #include "CEGUIVector.h"
    00028 #include "CEGUIRect.h"
    00029 #include "CEGUIImage.h"
    00030 #include "CEGUIFont.h"
    00031 #include <vector>
    00032
    00033
    00034 #if defined(_MSC_VER)
    00035 #       pragma warning(push)
    00036 #       pragma warning(disable : 4251)
    00037 #endif
    00038
    00039
    00040 // Start of CEGUI namespace section
    00041 namespace CEGUI
    00042 {
    00059     class CEGUIEXPORT RenderCache
    00060     {
    00061     public:
    00066         RenderCache();
    00067
    00072         ~RenderCache();
    00073
    00082         bool hasCachedImagery() const;
    00083
    00100         void render(const Point& basePos, float baseZ, const Rect& clipper) const;
    00101
    00106         void clearCachedImagery();
    00107
    00129         void cacheImage(const Image& image, const Rect& destArea, float zOffset, const ColourRect& cols, const Rect* clipper = 0, bool clipToDisplay = false);
    00130
    00158         void cacheText(const String& text, const Font* font, TextFormatting format, const Rect& destArea, float zOffset, const ColourRect& cols, const Rect* clipper = 0, bool clipToDisplay = false);
    00159
    00160     private:
    00165         struct ImageInfo
    00166         {
    00167             const Image* source_image;
    00168             Rect target_area;
    00169             float z_offset;
    00170             ColourRect colours;
    00171             Rect customClipper;
    00172             bool usingCustomClipper;
    00173             bool clipToDisplay;
    00174         };
    00175
    00180         struct TextInfo
    00181         {
    00182             String text;
    00183             const Font* source_font;
    00184             TextFormatting formatting;
    00185             Rect target_area;
    00186             float z_offset;
    00187             ColourRect colours;
    00188             Rect customClipper;
    00189             bool usingCustomClipper;
    00190             bool clipToDisplay;
    00191         };
    00192
    00193         typedef std::vector<ImageInfo>  ImageryList;
    00194         typedef std::vector<TextInfo>   TextList;
    00195
    00196         ImageryList d_cachedImages;
    00197         TextList d_cachedTexts;
    00198     };
    00199
    00200 } // End of  CEGUI namespace section
    00201
    00202
    00203 #if defined(_MSC_VER)
    00204 #       pragma warning(pop)
    00205 #endif
    00206
    00207
    00208 #endif  // end of guard _CEGUIRenderCache_h_