ScummVM API documentation
image_translation.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 HOLLYWOOD_IMAGE_TRANSLATION_H
23#define HOLLYWOOD_IMAGE_TRANSLATION_H
24
25#include "common/archive.h"
26#include "common/hash-str.h"
27#include "common/ptr.h"
28
29#include "hollywood/resource.h"
30
31namespace Hollywood {
32
33// Applies extracted image overlays while preserving the original files on disk.
35public:
37 bool load(const Common::Path &originalTextArchive);
38
39 bool hasFile(const Common::Path &path) const override;
40 int listMembers(Common::ArchiveMemberList &list) const override;
41 const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
42 Common::SharedArchiveContents readContentsForPath(const Common::Path &path) const override;
43
44private:
45 enum Layout {
46 kBlocks,
47 kPixels,
48 kPalette
49 };
50
51 struct Overlay {
52 Common::String source;
53 Common::String baseName;
54 byte chunk;
55 Layout layout;
56 byte paletteChunk;
57 uint16 x, y;
58 };
59
60 bool readOriginalChunk(Common::SeekableReadStream &file, const ResourceChunkTable &table,
61 uint index, Common::Array<byte> &data) const;
62 void remapPalette(Common::Array<byte> &pixels, const Common::Array<byte> &originalPalette,
63 const byte *translatedPalette) const;
64 bool applyImage(const Overlay &overlay, Common::SeekableReadStream &file,
65 const ResourceChunkTable &table, Common::Array<byte> &data) const;
66
67 Common::Archive *_archive; // Owned by TextTranslation.
68 Common::StringMap _sources;
69 Common::Array<Overlay> _overlays;
70};
71
72} // End of namespace Hollywood
73
74#endif // HOLLYWOOD_IMAGE_TRANSLATION_H
Definition: archive.h:141
Definition: list.h:44
Definition: path.h:52
Definition: stream.h:745
Definition: archive.h:242
Definition: str.h:59
Definition: image_translation.h:34
int listMembers(Common::ArchiveMemberList &list) const override
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
bool hasFile(const Common::Path &path) const override
Definition: default_display_client.h:68