ScummVM API documentation
bitmap2D.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_BITMAP2D_H
29 #define HPL_BITMAP2D_H
30 
31 #include "common/ptr.h"
32 #include "common/rect.h"
33 #include "graphics/pixelformat.h"
34 #include "graphics/surface.h"
35 #include "hpl1/engine/graphics/GraphicsTypes.h"
36 #include "hpl1/engine/graphics/LowLevelPicture.h"
37 #include "hpl1/engine/math/MathTypes.h"
38 #include "image/image_decoder.h"
39 
40 namespace hpl {
41 
42 class Bitmap2D : public LowLevelPicture {
43 public:
44  Bitmap2D(const cVector2l &size, const Graphics::PixelFormat &format);
45  Bitmap2D(const tString &filename, const tString &type, const Graphics::PixelFormat &desiredFormat = {});
46 
47  ~Bitmap2D();
48 
49  void drawToBitmap(Bitmap2D &dest, const cVector2l &at, Common::Rect srcSubrect = {});
50 
51  bool create(const cVector2l &size, const Graphics::PixelFormat &format);
52 
53  void fillRect(const cRect2l &rect, const cColor &color);
54 
55  const void *getRawData() const;
56 
57  int getNumChannels();
58 
59  const Graphics::PixelFormat &format() const;
60 
61  bool hasAlpha() override;
62 
63  uint32 getBpp() const override;
64 
65  void copyRedToAlpha();
66 
67 private:
68  void copyDecoder(const Graphics::PixelFormat &format = {});
69  const Graphics::Surface &activeSurface() const;
70 
71  Graphics::Surface _surface;
73  bool _isSurfaceActive;
74 };
75 
77 typedef Common::Array<Bitmap2D *>::iterator tBitmap2DVecIt;
78 
79 } // namespace hpl
80 
81 #endif // HPL_BITMAP2D_H
Definition: AI.h:36
Definition: str.h:59
Definition: surface.h:67
Definition: array.h:52
Definition: pixelformat.h:138
Definition: LowLevelPicture.h:37
Definition: bitmap2D.h:42
T * iterator
Definition: array.h:54
Definition: rect.h:144
Definition: Color.h:37