ScummVM API documentation
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 TRECISION_GRAPHICS_H
23 #define TRECISION_GRAPHICS_H
24 
25 #include "common/rect.h"
26 #include "graphics/pixelformat.h"
27 #include "graphics/surface.h"
28 
29 namespace Common {
30 class SeekableReadStream;
31 }
32 
33 
34 namespace Trecision {
35 class TrecisionEngine;
36 
37 struct Font {
38  int8 *_data;
39  uint16 _width;
40 };
41 
43  TrecisionEngine *_vm;
44 
45  Graphics::Surface _screenBuffer;
46  Graphics::Surface _background;
47  Graphics::Surface _smkBackground;
48  Graphics::Surface _leftInventoryArrow;
49  Graphics::Surface _rightInventoryArrow;
50  Graphics::Surface _inventoryIcons;
51  Graphics::Surface _saveSlotThumbnails;
52  Graphics::Surface _textureMat;
53 
54  Graphics::PixelFormat _screenFormat;
55  uint16 _bitMask[3];
56  Font _fonts[256];
57 
58  Common::List<Common::Rect> _dirtyRects;
59 
60  const Graphics::PixelFormat _rgb555Format;
61 
62  uint16 aliasing(uint32 val1, uint32 val2, uint8 num);
63  void drawCharPixel(uint16 y, uint16 charLeft, uint16 charRight, Common::Rect rect, Common::Rect subtitleRect, uint16 color, Graphics::Surface *externalSurface = nullptr);
64  void initCursor();
65  void copyToScreenBufferInner(const Graphics::Surface *surface, int x, int y);
66  void paintObjAnm(uint16 curBox);
67  void drawObj(int index, bool mask, Common::Rect drawRect, Common::Rect drawObjRect, bool includeDirtyRect = true);
68  void eraseObj(Common::Rect drawObjRect);
69 
70 public:
72  ~GraphicsManager();
73 
74  bool init();
75  void clearScreen();
76  void copyToScreen(int x, int y, int w, int h);
77  void copyToScreenBuffer(const Graphics::Surface *surface, int x, int y, const byte *palette);
78  void blitToScreenBuffer(const Graphics::Surface *surface, int x, int y, const byte *palette, bool useSmkBg);
79  void paintScreen(bool flag);
80  void loadBackground(Common::SeekableReadStream *stream);
81  void clearScreenBuffer();
82  void clearScreenBufferTop();
83  void clearScreenBufferInventory();
84  void clearScreenBufferSaveSlotDescriptions();
85  void drawLeftInventoryArrow(byte startLine);
86  void drawRightInventoryArrow(byte startLine);
87  void drawInventoryIcon(byte iconIndex, byte iconSlot, byte startLine);
88  void drawSaveSlotThumbnail(byte iconIndex, byte iconSlot, byte startLine);
89  void setSaveSlotThumbnail(byte iconSlot, const Graphics::Surface *thumbnail);
90  void readSurface(Common::SeekableReadStream *stream, Graphics::Surface *surface, uint16 width, uint16 height, uint16 count = 1);
91  void readTexture(Common::SeekableReadStream *stream);
92  void drawTexturePixel(uint16 textureX, uint16 textureY, uint16 screenX, uint16 screenY);
93 
94  uint16 convertToScreenFormat(uint16 color) const;
95 
96  void shadow(uint16 x, uint16 y, uint8 num);
97  void pixelAliasing(uint16 x, uint16 y);
98  void dissolve();
99 
100  void addDirtyRect(Common::Rect rect, bool translateRect);
101 
102  uint16 getCharWidth(byte character);
103  void drawChar(byte curChar, uint16 textColor, uint16 line, Common::Rect rect, Common::Rect subtitleRect, uint16 inc, Graphics::Surface *externalSurface);
104 
105  bool isCursorVisible();
106  void showCursor();
107  void hideCursor();
108 
109  void loadFont();
110  void loadData();
111  void showDemoPic();
112 
113 };
114 
115 } // End of namespace Trecision
116 #endif
Definition: surface.h:67
Definition: pixelformat.h:138
Definition: trecision.h:112
Definition: rect.h:144
Definition: stream.h:745
Definition: actor.h:29
Definition: graphics.h:37
Definition: algorithm.h:29
Definition: graphics.h:42