ScummVM API documentation
renderer.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 CHAMBER_RENDERER_H
23 #define CHAMBER_RENDERER_H
24 
25 #include "chamber/common.h"
26 
27 namespace Chamber {
28 
29 class Renderer {
30 public:
31  virtual ~Renderer() {}
32 
33  virtual void switchToGraphicsMode() = 0;
34  virtual void colorSelect(byte csel) = 0;
35  virtual void selectCursor(uint16 num) = 0;
36  virtual void blitToScreen(int16 x, int16 y, int16 w, int16 h) = 0;
37  virtual void blitToScreen(int16 ofs, int16 w, int16 h) = 0;
38 
39  virtual uint16 calcXY(uint16 x, uint16 y) = 0;
40  virtual uint16 calcXY_p(uint16 x, uint16 y) = 0;
41 
42  virtual void backBufferToRealFull() = 0;
43  virtual void realBufferToBackFull() = 0;
44  virtual void swapRealBackBuffer() = 0;
45  virtual void copyScreenBlock(byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) = 0;
46  virtual void swapScreenRect(byte *pixels, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
47 
48  virtual byte *backupImage(byte *screen, uint16 ofs, uint16 w, uint16 h, byte *buffer) = 0;
49  virtual void restoreImage(byte *buffer, byte *target) = 0;
50  virtual void refreshImageData(byte *buffer) = 0;
51  virtual void restoreBackupImage(byte *target) = 0;
52 
53  virtual void blit(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
54  virtual void blitAndWait(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
55  virtual void fill(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
56  virtual void fillAndWait(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
57 
58  virtual void blitSprite(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
59  virtual void blitSpriteFlip(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
60  virtual void blitSpriteBak(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs, byte *backup, byte mask) = 0;
61  virtual void blitScratchBackSprite(uint16 sprofs, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
62  virtual void blitFromBackBuffer(byte w, byte h, byte *screen, uint16 ofs) = 0;
63  virtual void drawSprite(byte *sprite, byte *screen, uint16 ofs) = 0;
64  virtual void drawSpriteFlip(byte *sprite, byte *screen, uint16 ofs) = 0;
65  virtual byte *loadSprit(byte index) = 0;
66  virtual byte *loadPersSprit(byte index) = 0;
67  virtual void backupAndShowSprite(byte index, byte x, byte y) = 0;
68  virtual byte *loadPortraitWithFrame(byte index) = 0;
69 
70  virtual void drawVLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) = 0;
71  virtual void drawHLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) = 0;
72  virtual uint16 drawHLineWithEnds(uint16 bmask, uint16 bpix, byte color, uint16 l, byte *target, uint16 ofs) = 0;
73  virtual void printChar(byte c, byte *target) = 0;
74 
75  virtual void animLiftToLeft(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
76  virtual void animLiftToRight(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
77  virtual void animLiftToDown(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) = 0;
78  virtual void animLiftToUp(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 x, uint16 y) = 0;
79 
80  virtual void hideScreenBlockLiftToDown(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) = 0;
81  virtual void hideScreenBlockLiftToUp(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) = 0;
82  virtual void hideScreenBlockLiftToLeft(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) = 0;
83  virtual void hideScreenBlockLiftToRight(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) = 0;
84  virtual void hideShatterFall(byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) = 0;
85 
86  virtual void traceLine(uint16 sx, uint16 ex, uint16 sy, uint16 ey, byte *source, byte *target) = 0;
87 
88  virtual void zoomImage(byte *pixels, byte w, byte h, byte nw, byte nh, byte *target, uint16 ofs) = 0;
89  virtual void animZoomIn(byte *pixels, byte w, byte h, byte *target, uint16 ofs) = 0;
90  virtual void zoomInplaceXY(byte *pixels, byte w, byte h, byte nw, byte nh, uint16 x, uint16 y, byte *target) = 0;
91 };
92 
93 class CGARenderer : public Renderer {
94 public:
95  void switchToGraphicsMode() override;
96  void colorSelect(byte csel) override;
97  void selectCursor(uint16 num) override;
98  void blitToScreen(int16 x, int16 y, int16 w, int16 h) override;
99  void blitToScreen(int16 ofs, int16 w, int16 h) override;
100  uint16 calcXY(uint16 x, uint16 y) override;
101  uint16 calcXY_p(uint16 x, uint16 y) override;
102  void backBufferToRealFull() override;
103  void realBufferToBackFull() override;
104  void swapRealBackBuffer() override;
105  void copyScreenBlock(byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
106  void swapScreenRect(byte *pixels, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
107  byte *backupImage(byte *screen, uint16 ofs, uint16 w, uint16 h, byte *buffer) override;
108  void restoreImage(byte *buffer, byte *target) override;
109  void refreshImageData(byte *buffer) override;
110  void restoreBackupImage(byte *target) override;
111  void blit(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
112  void blitAndWait(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
113  void fill(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
114  void fillAndWait(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
115  void blitSprite(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
116  void blitSpriteFlip(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
117  void blitSpriteBak(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs, byte *backup, byte mask) override;
118  void blitScratchBackSprite(uint16 sprofs, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
119  void blitFromBackBuffer(byte w, byte h, byte *screen, uint16 ofs) override;
120  void drawSprite(byte *sprite, byte *screen, uint16 ofs) override;
121  void drawSpriteFlip(byte *sprite, byte *screen, uint16 ofs) override;
122  byte *loadSprit(byte index) override;
123  byte *loadPersSprit(byte index) override;
124  void backupAndShowSprite(byte index, byte x, byte y) override;
125  byte *loadPortraitWithFrame(byte index) override;
126  void drawVLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) override;
127  void drawHLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) override;
128  uint16 drawHLineWithEnds(uint16 bmask, uint16 bpix, byte color, uint16 l, byte *target, uint16 ofs) override;
129  void printChar(byte c, byte *target) override;
130  void animLiftToLeft(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
131  void animLiftToRight(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
132  void animLiftToDown(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
133  void animLiftToUp(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 x, uint16 y) override;
134  void hideScreenBlockLiftToDown(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
135  void hideScreenBlockLiftToUp(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
136  void hideScreenBlockLiftToLeft(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
137  void hideScreenBlockLiftToRight(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
138  void hideShatterFall(byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
139  void traceLine(uint16 sx, uint16 ex, uint16 sy, uint16 ey, byte *source, byte *target) override;
140  void zoomImage(byte *pixels, byte w, byte h, byte nw, byte nh, byte *target, uint16 ofs) override;
141  void animZoomIn(byte *pixels, byte w, byte h, byte *target, uint16 ofs) override;
142  void zoomInplaceXY(byte *pixels, byte w, byte h, byte nw, byte nh, uint16 x, uint16 y, byte *target) override;
143 };
144 
145 class EGARenderer : public Renderer {
146 public:
147  void switchToGraphicsMode() override;
148  void colorSelect(byte csel) override;
149  void selectCursor(uint16 num) override;
150  void blitToScreen(int16 x, int16 y, int16 w, int16 h) override;
151  void blitToScreen(int16 ofs, int16 w, int16 h) override;
152  uint16 calcXY(uint16 x, uint16 y) override;
153  uint16 calcXY_p(uint16 x, uint16 y) override;
154  void backBufferToRealFull() override;
155  void realBufferToBackFull() override;
156  void swapRealBackBuffer() override;
157  void copyScreenBlock(byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
158  void swapScreenRect(byte *pixels, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
159  byte *backupImage(byte *screen, uint16 ofs, uint16 w, uint16 h, byte *buffer) override;
160  void restoreImage(byte *buffer, byte *target) override;
161  void refreshImageData(byte *buffer) override;
162  void restoreBackupImage(byte *target) override;
163  void blit(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
164  void blitAndWait(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
165  void fill(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
166  void fillAndWait(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
167  void blitSprite(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
168  void blitSpriteFlip(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
169  void blitSpriteBak(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs, byte *backup, byte mask) override;
170  void blitScratchBackSprite(uint16 sprofs, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
171  void blitFromBackBuffer(byte w, byte h, byte *screen, uint16 ofs) override;
172  void drawSprite(byte *sprite, byte *screen, uint16 ofs) override;
173  void drawSpriteFlip(byte *sprite, byte *screen, uint16 ofs) override;
174  byte *loadSprit(byte index) override;
175  byte *loadPersSprit(byte index) override;
176  void backupAndShowSprite(byte index, byte x, byte y) override;
177  byte *loadPortraitWithFrame(byte index) override;
178  void drawVLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) override;
179  void drawHLine(uint16 x, uint16 y, uint16 l, byte color, byte *target) override;
180  uint16 drawHLineWithEnds(uint16 bmask, uint16 bpix, byte color, uint16 l, byte *target, uint16 ofs) override;
181  void printChar(byte c, byte *target) override;
182  void animLiftToLeft(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
183  void animLiftToRight(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
184  void animLiftToDown(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs) override;
185  void animLiftToUp(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 x, uint16 y) override;
186  void hideScreenBlockLiftToDown(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
187  void hideScreenBlockLiftToUp(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
188  void hideScreenBlockLiftToLeft(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
189  void hideScreenBlockLiftToRight(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
190  void hideShatterFall(byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs) override;
191  void traceLine(uint16 sx, uint16 ex, uint16 sy, uint16 ey, byte *source, byte *target) override;
192  void zoomImage(byte *pixels, byte w, byte h, byte nw, byte nh, byte *target, uint16 ofs) override;
193  void animZoomIn(byte *pixels, byte w, byte h, byte *target, uint16 ofs) override;
194  void zoomInplaceXY(byte *pixels, byte w, byte h, byte nw, byte nh, uint16 x, uint16 y, byte *target) override;
195 };
196 
197 } // End of namespace Chamber
198 
199 #endif // CHAMBER_RENDERER_H
Definition: renderer.h:93
Definition: renderer.h:29
Definition: anim.h:25
Definition: renderer.h:145