ScummVM API documentation
myst_graphics.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 MOHAWK_MYST_GRAPHICS_H
23#define MOHAWK_MYST_GRAPHICS_H
24
25#include "mohawk/graphics.h"
26
27#include "common/file.h"
28#include "graphics/font.h"
29
30namespace Mohawk {
31
32class MystBitmap;
33class MohawkEngine_Myst;
34
35enum RectState {
36 kRectEnabled,
37 kRectDisabled,
38 kRectUnreachable
39};
40
42public:
43 explicit MystGraphics(MohawkEngine_Myst *vm);
44 ~MystGraphics() override;
45
46 void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest);
47 void copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest);
48 void copyImageToScreen(uint16 image, Common::Rect dest);
49 void copyImageToBackBuffer(uint16 image, Common::Rect dest);
50 void copyBackBufferToScreen(Common::Rect r);
51 void runTransition(TransitionType type, Common::Rect rect, uint16 steps, uint16 delay);
52 void drawRect(Common::Rect rect, RectState state);
53 void drawLine(const Common::Point &p1, const Common::Point &p2, uint32 color);
54 void fadeToBlack();
55 void fadeFromBlack();
56 void clearScreen();
57
58 void clearScreenPalette();
59 void setPaletteToScreen();
60 const byte *getPalette() const { return _palette; }
61
62 void saveStateForMainMenu();
63 void restoreStateForMainMenu();
64 Graphics::Surface *getThumbnailForMainMenu() const;
65
66 void loadMenuFont();
67 Common::Rect getTextBoundingBox(const Common::U32String &text, const Common::Rect &dest, Graphics::TextAlign align);
68 void drawText(uint16 image, const Common::U32String &text, const Common::Rect &dest, uint8 r, uint8 g, uint8 b, Graphics::TextAlign align, int16 deltaY);
69
70 void replaceImageWithRect(uint16 destImage, uint16 sourceImage, const Common::Rect &sourceRect);
71
72protected:
73 MohawkSurface *decodeImage(uint16 id) override;
74 MohawkEngine *getVM() override { return (MohawkEngine *)_vm; }
75
76private:
78 MystBitmap *_bmpDecoder;
79
80 Graphics::Surface *_backBuffer;
81 Graphics::PixelFormat _pixelFormat;
82 Common::Rect _viewport;
83 byte _palette[256 * 3];
84
88
89 void transitionDissolve(Common::Rect rect, uint step);
90 void transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay);
91 void transitionSlideToRight(Common::Rect rect, uint16 steps, uint16 delay);
92 void transitionSlideToTop(Common::Rect rect, uint16 steps, uint16 delay);
93 void transitionSlideToBottom(Common::Rect rect, uint16 steps, uint16 delay);
94 void transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps);
95 void transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps);
96
97 void remapSurfaceToSystemPalette(MohawkSurface *mhkSurface);
98 byte getColorIndex(const byte *palette, byte red, byte green, byte blue);
99
100 void applyImagePatches(uint16 id, const MohawkSurface *mhkSurface) const;
101
102 Graphics::Font *_menuFont;
103
104 const Graphics::Font *getMenuFont() const;
105};
106
107} // End of namespace Mohawk
108
109#endif
Definition: ustr.h:57
Definition: font.h:83
Definition: graphics.h:68
Definition: myst.h:129
Definition: mohawk.h:54
Definition: graphics.h:40
Definition: myst_graphics.h:41
TextAlign
Definition: font.h:48
Definition: bitmap.h:32
Definition: rect.h:144
Definition: rect.h:536
Definition: pixelformat.h:138
Definition: surface.h:67