ScummVM API documentation
screen.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 GRAPHICS_SCREEN_H
23 #define GRAPHICS_SCREEN_H
24 
25 #include "graphics/managed_surface.h"
26 #include "graphics/dirtyrects.h"
27 #include "graphics/palette.h"
28 #include "graphics/pixelformat.h"
29 
30 namespace Graphics {
31 
47 class Screen : public ManagedSurface {
48 protected:
53 
54 public:
55  Screen();
56  Screen(int width, int height);
57  Screen(int width, int height, PixelFormat pixelFormat);
58 
62  bool isDirty() const { return !_dirtyRects.empty(); }
63 
68  void makeAllDirty();
69 
73  void clearDirtyRects() override { _dirtyRects.clear(); }
74 
79  void addDirtyRect(const Common::Rect &r) override;
80 
84  virtual void update();
85 
89  virtual void updateScreen();
90 
94  void getPalette(byte palette[PALETTE_SIZE]);
95 
99  void getPalette(byte *palette, uint start, uint num);
100 
104  Graphics::Palette getPalette(uint start = 0, uint num = PALETTE_COUNT) {
105  byte tmp[PALETTE_SIZE];
106  getPalette(tmp, start, num);
107  return Graphics::Palette(tmp, num);
108  }
109 
113  void setPalette(const byte palette[PALETTE_SIZE]);
114 
118  void setPalette(const byte *palette, uint start, uint num);
119 
123  void setPalette(const Graphics::Palette &pal, uint start = 0) {
124  setPalette(pal.data(), start, pal.size());
125  }
126 
130  void clearPalette();
131 };
133 } // End of namespace Graphics
134 
135 #endif
Definition: managed_surface.h:51
bool isDirty() const
Definition: screen.h:62
Graphics::Palette getPalette(uint start=0, uint num=PALETTE_COUNT)
Definition: screen.h:104
Definition: pixelformat.h:138
void clearDirtyRects() override
Definition: screen.h:73
Definition: rect.h:524
Definition: screen.h:47
void addDirtyRect(const Common::Rect &r) override
constexpr int PALETTE_COUNT
Definition: palette.h:42
Definition: formatinfo.h:28
virtual void update()
bool empty() const
Definition: dirtyrects.h:68
void getPalette(byte palette[PALETTE_SIZE])
Definition: dirtyrects.h:43
void clear()
Definition: dirtyrects.h:73
DirtyRectList _dirtyRects
Definition: screen.h:52
Simple class for handling a palette data.
Definition: palette.h:61
virtual void updateScreen()
void setPalette(const Graphics::Palette &pal, uint start=0)
Definition: screen.h:123
void setPalette(const byte palette[PALETTE_SIZE])