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/palette.h"
27 #include "graphics/pixelformat.h"
28 #include "common/list.h"
29 #include "common/rect.h"
30 
31 namespace Graphics {
32 
48 class Screen : public ManagedSurface {
49 protected:
54 protected:
58  void mergeDirtyRects();
59 
63  bool unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2);
64 public:
65  Screen();
66  Screen(int width, int height);
67  Screen(int width, int height, PixelFormat pixelFormat);
68 
72  bool isDirty() const { return !_dirtyRects.empty(); }
73 
78  void makeAllDirty();
79 
83  virtual void clearDirtyRects() { _dirtyRects.clear(); }
84 
89  virtual void addDirtyRect(const Common::Rect &r);
90 
94  virtual void update();
95 
99  virtual void updateScreen();
100 
104  void getPalette(byte palette[PALETTE_SIZE]);
105 
109  void getPalette(byte *palette, uint start, uint num);
110 
114  Graphics::Palette getPalette(uint start = 0, uint num = PALETTE_COUNT) {
115  byte tmp[PALETTE_SIZE];
116  getPalette(tmp, start, num);
117  return Graphics::Palette(tmp, num);
118  }
119 
123  void setPalette(const byte palette[PALETTE_SIZE]);
124 
128  void setPalette(const byte *palette, uint start, uint num);
129 
133  void setPalette(const Graphics::Palette &pal, uint start = 0) {
134  setPalette(pal.data(), start, pal.size());
135  }
136 
140  void clearPalette();
141 };
143 } // End of namespace Graphics
144 
145 #endif
Definition: managed_surface.h:51
bool isDirty() const
Definition: screen.h:72
void mergeDirtyRects()
Graphics::Palette getPalette(uint start=0, uint num=PALETTE_COUNT)
Definition: screen.h:114
Definition: pixelformat.h:138
virtual void clearDirtyRects()
Definition: screen.h:83
Definition: rect.h:144
Definition: screen.h:48
virtual void addDirtyRect(const Common::Rect &r)
Common::List< Common::Rect > _dirtyRects
Definition: screen.h:53
bool unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2)
Definition: formatinfo.h:28
virtual void update()
void clear()
Definition: list.h:206
void getPalette(byte palette[PALETTE_SIZE])
Simple class for handling a palette data.
Definition: palette.h:45
virtual void updateScreen()
bool empty() const
Definition: list.h:219
void setPalette(const Graphics::Palette &pal, uint start=0)
Definition: screen.h:133
void setPalette(const byte palette[PALETTE_SIZE])