ScummVM API documentation
art.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 #ifndef HARVESTER_ART_H
23 #define HARVESTER_ART_H
24 
25 #include "common/array.h"
26 
27 namespace Graphics {
28 class Screen;
29 }
30 
31 namespace Harvester {
32 
33 class ResourceManager;
34 
35 struct IndexedBitmap {
36  uint32 width = 0;
37  uint32 height = 0;
38  Common::Array<byte> pixels;
39 
40  bool isValid() const {
41  return width != 0 && height != 0 && pixels.size() >= width * height;
42  }
43 };
44 
46  int32 xOffset = 0;
47  int32 yOffset = 0;
48 };
49 
50 class Art {
51 public:
52  bool load(ResourceManager &resources);
53  bool loadQuickTipsResources(ResourceManager &resources);
54  void drawWaitFrame(Graphics::Screen &screen) const;
55 
56  const byte *getWaitPalette() const { return _waitPalette; }
57  const Common::Array<AbmFrame> &getWaitFrames() const { return _waitFrames; }
58  const IndexedBitmap &getInventoryBitmap() const { return _inventoryBitmap; }
59  const IndexedBitmap &getLogoBitmap() const { return _logoBitmap; }
60  const IndexedBitmap &getTipsBitmap() const { return _tipsBitmap; }
61  const Common::Array<IndexedBitmap> &getAmmoIcons() const { return _ammoIcons; }
62  const IndexedBitmap *getTextboxBitmap(uint index) const {
63  return index < _textboxes.size() ? &_textboxes[index] : nullptr;
64  }
65 
66 private:
67  bool loadPalette(ResourceManager &resources, const Common::String &path, byte *dest) const;
68  bool loadBitmap(ResourceManager &resources, const Common::String &path, IndexedBitmap &bitmap) const;
69  bool loadAnimation(ResourceManager &resources, const Common::String &path, Common::Array<AbmFrame> &frames) const;
70  bool decodeAnimationFrame(const byte *source, uint32 sourceSize, bool compressed, Common::Array<byte> &dest) const;
71  void blitTransparentBitmap(Graphics::Screen &screen, const IndexedBitmap &bitmap, int x, int y) const;
72  void blitTransparentAnimationFrame(Graphics::Screen &screen, const Common::Array<AbmFrame> &frames,
73  uint frameIndex, int x, int y) const;
74 
75  byte _waitPalette[256 * 3] = { 0 };
76  Common::Array<AbmFrame> _waitFrames;
79  IndexedBitmap _inventoryBitmap;
80  IndexedBitmap _logoBitmap;
81  IndexedBitmap _tipsBitmap;
82 };
83 
84 } // End of namespace Harvester
85 
86 #endif // HARVESTER_ART_H
Definition: str.h:59
Definition: art.h:31
Definition: art.h:35
Definition: atari-screen.h:58
Definition: screen.h:47
Definition: art.h:50
Definition: formatinfo.h:28
Definition: art.h:45
size_type size() const
Definition: array.h:316
Definition: resources.h:32