ScummVM API documentation
drawing.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  * of the License, or(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 AGS_PLUGINS_AGSCREDITZ_DRAWING_H
23 #define AGS_PLUGINS_AGSCREDITZ_DRAWING_H
24 
25 #include "common/scummsys.h"
26 
27 namespace AGS3 {
28 namespace Plugins {
29 namespace AGSCreditz {
30 
31 class Drawing {
32 public:
33 void drawPixel(uint8 *bitmap, int32 x, int32 y,
34  uint col, int32 pitch, int32 coldepth) {
35  switch (coldepth) {
36  case 8:
37  bitmap[x + y * pitch] = col;
38  break;
39  case 16:
40  *((uint16 *)(bitmap + y * pitch + x * 2)) = col;
41  break;
42  case 32:
43  *((uint32 *)(bitmap + y * pitch + x * 4)) = col;
44  break;
45  }
46 }
47 
48 uint getPixelColor(uint8 *bitmap, int32 x, int32 y,
49  int32 pitch, int32 coldepth) {
50  switch (coldepth) {
51  case 8:
52  return bitmap[x + y * pitch];
53  case 16:
54  return *((uint16 *)(bitmap + y * pitch + x * 2));
55  case 32:
56  return *((uint32 *)(bitmap + y * pitch + x * 4));
57  }
58  return 0;
59 }
60 };
61 
62 } // namespace AGSCreditz
63 } // namespace Plugins
64 } // namespace AGS3
65 
66 #endif
Definition: drawing.h:31
Definition: ags.h:40