1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __C_GUI_IMAGE_H_INCLUDED__
6 #define __C_GUI_IMAGE_H_INCLUDED__
7 
8 #include "IrrCompileConfig.h"
9 #ifdef _IRR_COMPILE_WITH_GUI_
10 
11 #include "IGUIImage.h"
12 
13 namespace irr
14 {
15 namespace gui
16 {
17 
18 	class CGUIImage : public IGUIImage
19 	{
20 	public:
21 
22 		//! constructor
23 		CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
24 
25 		//! destructor
26 		virtual ~CGUIImage();
27 
28 		//! sets an image
29 		virtual void setImage(video::ITexture* image);
30 
31 		//! Gets the image texture
32 		virtual video::ITexture* getImage() const;
33 
34 		//! sets the color of the image
35 		virtual void setColor(video::SColor color);
36 
37 		//! sets if the image should scale to fit the element
38 		virtual void setScaleImage(bool scale);
39 
40 		//! draws the element and its children
41 		virtual void draw();
42 
43 		//! sets if the image should use its alpha channel to draw itself
44 		virtual void setUseAlphaChannel(bool use);
45 
46 		//! Gets the color of the image
47 		virtual video::SColor getColor() const;
48 
49 		//! Returns true if the image is scaled to fit, false if not
50 		virtual bool isImageScaled() const;
51 
52 		//! Returns true if the image is using the alpha channel, false if not
53 		virtual bool isAlphaChannelUsed() const;
54 
55 		//! Writes attributes of the element.
56 		virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
57 
58 		//! Reads attributes of the element
59 		virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
60 
61 	private:
62 		video::ITexture* Texture;
63 		video::SColor Color;
64 		bool UseAlphaChannel;
65 		bool ScaleImage;
66 
67 	};
68 
69 
70 } // end namespace gui
71 } // end namespace irr
72 
73 #endif // _IRR_COMPILE_WITH_GUI_
74 
75 #endif // __C_GUI_IMAGE_H_INCLUDED__
76