ScummVM API documentation
view.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 SCI_GRAPHICS_VIEW_H
23#define SCI_GRAPHICS_VIEW_H
24
25#include "sci/util.h"
26
27namespace Sci {
28
29struct CelInfo {
30 int16 width, height;
31 int16 scriptWidth, scriptHeight;
32 int16 displaceX;
33 int16 displaceY;
34 byte clearKey;
35 uint16 offsetEGA;
36 uint32 offsetRLE;
37 uint32 offsetLiteral;
39};
40
41struct LoopInfo {
42 bool mirrorFlag;
44};
45
46enum {
47 SCI_VIEW_EGAMAPPING_SIZE = 16,
48 SCI_VIEW_EGAMAPPING_COUNT = 8
49};
50
51class GfxScreen;
52class GfxPalette;
53class Resource;
54
59class GfxView {
60public:
61 GfxView(ResourceManager *resMan, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId);
62 ~GfxView();
63
64 GuiResourceId getResourceId() const;
65 int16 getWidth(int16 loopNo, int16 celNo) const;
66 int16 getHeight(int16 loopNo, int16 celNo) const;
67 const CelInfo *getCelInfo(int16 loopNo, int16 celNo) const;
68 void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
69 void getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const;
70 void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const;
71 const SciSpan<const byte> &getBitmap(int16 loopNo, int16 celNo);
72 void draw(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleSignal = 0);
73 void drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, const Common::Rect &clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY, uint16 scaleSignal = 0);
74 uint16 getLoopCount() const { return _loop.size(); }
75 uint16 getCelCount(int16 loopNo) const;
76 Palette *getPalette();
77
78 bool isScaleable();
79
80 void adjustToUpscaledCoordinates(int16 &y, int16 &x);
81 void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
82
83private:
84 void initData();
85 void unpackCel(int16 loopNo, int16 celNo, SciSpan<byte> &outPtr);
86 void unditherBitmap(SciSpan<byte> &bitmap, int16 width, int16 height, byte clearKey);
87 byte getMappedColor(byte color, uint16 scaleSignal, const Palette *palette, int x2, int y2);
88
89 static void createScalingTable(Common::Array<uint16> &table, int16 celSize, uint16 maxSize, int16 scale, bool mirrorFlag);
90
91 ResourceManager *_resMan;
92 GfxCoordAdjuster16 *_coordAdjuster;
93 GfxScreen *_screen;
94 GfxPalette *_palette;
95
96 GuiResourceId _resourceId;
97 Resource *_resource;
98
100 bool _embeddedPal;
101 Palette _viewPalette;
102
103 SciSpan<const byte> _EGAmapping;
104
105 // this is set for sci0early to adjust for the getCelRect() change
106 int16 _adjustForSci0Early;
107
108 // this is not set for some views in laura bow 2 floppy and signals that the view shall never get scaled
109 // even if scaleX/Y are set (inside kAnimate)
110 bool _isScaleable;
111};
112
113} // End of namespace Sci
114
115#endif // SCI_GRAPHICS_VIEW_H
Definition: array.h:52
Definition: span.h:893
Definition: coordadjuster.h:37
Definition: palette16.h:41
Definition: screen.h:70
Definition: view.h:59
Definition: resource.h:256
Definition: resource.h:327
Definition: util.h:251
Definition: console.h:28
Definition: rect.h:536
Definition: view.h:29
Definition: view.h:41
Definition: helpers.h:247