Crazy Eddies GUI System: CEGUIImage.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# CEGUIImage.h

    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 "CEGUIRenderer.h"
    00036 #include <map>
    00037
    00038
    00039 #if defined(_MSC_VER)
    00040 #       pragma warning(push)
    00041 #       pragma warning(disable : 4251)
    00042 #endif
    00043
    00044
    00045 // Start of CEGUI namespace section
    00046 namespace CEGUI
    00047 {
    00052 class CEGUIEXPORT Image
    00053 {
    00054 public:
    00062         Size    getSize(void) const                     {return Size(d_scaledWidth, d_scaledHeight);}
    00063
    00064
    00072         float   getWidth(void) const            {return d_scaledWidth;}
    00073
    00074
    00082         float   getHeight(void) const           {return d_scaledHeight;}
    00083
    00084
    00092         Point   getOffsets(void) const          {return d_scaledOffset;}
    00093
    00094
    00102         float   getOffsetX(void) const          {return d_scaledOffset.d_x;}
    00103
    00104
    00112         float   getOffsetY(void) const          {return d_scaledOffset.d_y;}
    00113
    00114
    00122         const String&   getName(void) const;
    00123
    00124
    00132         const String&   getImagesetName(void) const;
    00133
    00142     const Rect& getSourceTextureArea(void) const;
    00143
    00181         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
    00182         {
    00183                 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,
    00184                         ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
    00185         }
    00186
    00187
    00225         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
    00226         {
    00227                 draw(dest_rect, z, clip_rect, ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
    00228         }
    00229
    00230
    00259         void    draw(const Vector3& position, const Size& size, const Rect& clip_rect, const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
    00260         {
    00261                 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);
    00262         }
    00263
    00264
    00293         void    draw(const Vector3& position, const Rect& clip_rect, const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
    00294         {
    00295                 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);
    00296         }
    00297
    00298
    00333         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
    00334         {
    00335                 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);
    00336         }
    00337
    00338
    00367         void    draw(const Rect& dest_rect, float z, const Rect& clip_rect,const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const;
    00368
    00369
    00380     void writeXMLToStream(OutStream& out_stream) const;
    00381
    00382
    00383         friend class std::map<String, Image>;
    00384         friend struct std::pair<const String, Image>;
    00385
    00386
    00387         /*************************************************************************
    00388                 Construction and Destruction
    00389         *************************************************************************/
    00394         Image(void) {}
    00395
    00396
    00421         Image(const Imageset* owner, const String& name, const Rect& area, const Point& render_offset, float horzScaling = 1.0f, float vertScaling = 1.0f);
    00422
    00423
    00424
    00429         Image(const Image& image);
    00430
    00431
    00436         ~Image(void);
    00437
    00438
    00439 private:
    00440         /*************************************************************************
    00441                 Friends
    00442         *************************************************************************/
    00443         friend class Imageset;
    00444
    00445
    00446         /*************************************************************************
    00447                 Implementation Methods
    00448         *************************************************************************/
    00459         void    setHorzScaling(float factor);
    00460
    00461
    00472         void    setVertScaling(float factor);
    00473
    00474
    00475         /*************************************************************************
    00476                 Implementation Data
    00477         *************************************************************************/
    00478         const Imageset* d_owner;
    00479         Rect                    d_area;
    00480         Point                   d_offset;
    00481
    00482         // image auto-scaling fields.
    00483         float   d_scaledWidth;
    00484         float   d_scaledHeight;
    00485         Point   d_scaledOffset;
    00486         String  d_name;
    00487 };
    00488
    00489 } // End of  CEGUI namespace section
    00490
    00491 #if defined(_MSC_VER)
    00492 #       pragma warning(pop)
    00493 #endif
    00494
    00495 #endif  // end of guard _CEGUIImage_h_