Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIImage.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIImage.h
00003         created:        13/3/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines interface for Image class
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIImage_h_
00027 #define _CEGUIImage_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include "CEGUIRect.h"
00032 #include "CEGUIColourRect.h"
00033 #include "CEGUIVector.h"
00034 #include "CEGUISize.h"
00035 #include <map>
00036 
00037 
00038 #if defined(_MSC_VER)
00039 #       pragma warning(push)
00040 #       pragma warning(disable : 4251)
00041 #endif
00042 
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00051 class CEGUIBASE_API Image
00052 {
00053 public:
00061         Size    getSize(void) const                     {return Size(d_scaledWidth, d_scaledHeight);}
00062         
00063 
00071         float   getWidth(void) const            {return d_scaledWidth;}
00072 
00073 
00081         float   getHeight(void) const           {return d_scaledHeight;}
00082 
00083 
00091         Point   getOffsets(void) const          {return d_scaledOffset;}
00092 
00093 
00101         float   getOffsetX(void) const          {return d_scaledOffset.d_x;}
00102 
00103 
00111         float   getOffsetY(void) const          {return d_scaledOffset.d_y;}
00112 
00113 
00121         const String&   getName(void) const;
00122 
00123 
00131         const String&   getImagesetName(void) const;
00132 
00133 
00171         void    draw(const Vector3& position, const Size& size, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF, const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
00172         {
00173                 draw(Rect(position.d_x, position.d_y, position.d_x + size.d_width, position.d_y + size.d_height), position.d_z, clip_rect, 
00174                         ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
00175         }
00176 
00177 
00215         void    draw(const Rect& dest_rect, float z, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF, const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
00216         {
00217                 draw(dest_rect, z, clip_rect, ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
00218         }
00219 
00220 
00249         void    draw(const Vector3& position, const Size& size, const Rect& clip_rect, const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
00250         {
00251                 draw(Rect(position.d_x, position.d_y, position.d_x + size.d_width, position.d_y + size.d_height), position.d_z, clip_rect, colours, quad_split_mode);
00252         }
00253 
00254 
00283         void    draw(const Vector3& position, const Rect& clip_rect, const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
00284         {
00285                 draw(Rect(position.d_x, position.d_y, position.d_x + getWidth(), position.d_y + getHeight()), position.d_z, clip_rect, colours, quad_split_mode);
00286         }
00287 
00288 
00323         void    draw(const Vector3& position, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF, const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
00324         {
00325                 draw(Rect(position.d_x, position.d_y, position.d_x + getWidth(), position.d_y + getHeight()), position.d_z, clip_rect, ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
00326         }
00327 
00328 
00357         void    draw(const Rect& dest_rect, float z, const Rect& clip_rect,const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const;
00358 
00359 
00360 
00361         friend class std::map<String, Image>;
00362         friend struct std::pair<const String, Image>;
00363 
00364 
00365         /*************************************************************************
00366                 Construction and Destruction
00367         *************************************************************************/
00372         Image(void) {}
00373 
00374 
00399         Image(const Imageset* owner, const String& name, const Rect& area, const Point& render_offset, float horzScaling = 1.0f, float vertScaling = 1.0f);
00400 
00401 
00402 
00407         Image(const Image& image);
00408 
00409 
00414         ~Image(void);
00415 
00416 
00417 private:
00418         /*************************************************************************
00419                 Friends
00420         *************************************************************************/
00421         friend class Imageset;
00422 
00423                 
00424         /*************************************************************************
00425                 Implementation Methods
00426         *************************************************************************/
00437         void    setHorzScaling(float factor);
00438 
00439 
00450         void    setVertScaling(float factor);
00451 
00452 
00453         /*************************************************************************
00454                 Implementation Data
00455         *************************************************************************/
00456         const Imageset* d_owner;                
00457         Rect                    d_area;                 
00458         Point                   d_offset;               
00459 
00460         // image auto-scaling fields.
00461         float   d_scaledWidth;          
00462         float   d_scaledHeight;         
00463         Point   d_scaledOffset;         
00464         String  d_name;                         
00465 };
00466 
00467 } // End of  CEGUI namespace section
00468 
00469 #if defined(_MSC_VER)
00470 #       pragma warning(pop)
00471 #endif
00472 
00473 #endif  // end of guard _CEGUIImage_h_

Generated on Wed Feb 16 12:41:06 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1