ScummVM API documentation
ResourceImage.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_RESOURCE_IMAGE_H
29 #define HPL_RESOURCE_IMAGE_H
30 
31 #include "hpl1/engine/resources/ResourceBase.h"
32 
33 #include "common/array.h"
34 #include "hpl1/engine/graphics/GraphicsTypes.h"
35 #include "hpl1/engine/math/MathTypes.h"
36 
37 namespace hpl {
38 
39 class cFrameTexture;
40 class cFrameBitmap;
41 class iTexture;
42 
43 class cResourceImage : public iResourceBase {
44  friend class cImageManager;
45 
46 public:
47  cResourceImage(tString asName, cFrameTexture *apFrameTex,
48  cFrameBitmap *apFrameBmp,
49  cRect2l aRect,
50  cVector2l avSrcSize, int alHandle);
51 
52  bool reload();
53  void unload();
54  void destroy();
55 
56  // Image specific
57  int GetHeight() const { return mRect.h; }
58  int GetWidth() const { return mRect.w; }
59  cVector2l GetSize() const { return cVector2l(mRect.w, mRect.h); }
60  cVector2l GetPosition() const { return cVector2l(mRect.x, mRect.y); }
61 
62  int GetSourceWidth() const { return mvSourceSize.x; }
63  int GetSourceHeight() const { return mvSourceSize.y; }
64 
65  iTexture *GetTexture() const;
66 
67  cFrameTexture *GetFrameTexture() const { return mpFrameTexture; }
68  cFrameBitmap *GetFrameBitmap() const { return mpFrameBitmap; }
69 
70  tVertexVec GetVertexVecCopy(const cVector2f &avPos, const cVector2f &avSize);
71  const tVertexVec &GetVertexVec() { return mvVtx; }
72 
73 private:
74  ~cResourceImage();
75 
76  cFrameTexture *mpFrameTexture;
77  cFrameBitmap *mpFrameBitmap;
78 
79  cVector2l mvSourceSize;
80  cRect2l mRect;
81  tVertexVec mvVtx;
82 
83  int mlHandle;
84 };
85 
87 typedef tResourceImageVec::iterator tResourceImageVecIt;
88 
89 } // namespace hpl
90 
91 #endif // HPL_RESOURCE_IMAGE_H
Definition: AI.h:36
Definition: str.h:59
Definition: ResourceBase.h:36
Definition: Texture.h:88
T * iterator
Definition: array.h:54
Definition: ResourceImage.h:43
Definition: FrameBitmap.h:59
Definition: FrameTexture.h:37
Definition: ImageManager.h:48