OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

base.hpp
Go to the documentation of this file.
1 /* $Id: base.hpp 26969 2014-10-06 18:45:51Z rubidium $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef BLITTER_BASE_HPP
13 #define BLITTER_BASE_HPP
14
15 #include "../spritecache.h"
16 #include "../spriteloader/spriteloader.hpp"
17
19 enum BlitterMode {
20 BM_NORMAL,
21 BM_COLOUR_REMAP,
22 BM_TRANSPARENT,
23 BM_CRASH_REMAP,
24 BM_BLACK_REMAP,
25 };
26
30 class Blitter {
31 public:
33 struct BlitterParams {
34 const void *sprite;
35 const byte *remap;
36
37 int skip_left;
38 int skip_top;
39 int width;
40 int height;
41 int sprite_width;
42 int sprite_height;
43 int left;
44 int top;
45
46 void *dst;
47 int pitch;
48 };
49
51 enum PaletteAnimation {
52 PALETTE_ANIMATION_NONE,
53 PALETTE_ANIMATION_VIDEO_BACKEND,
54 PALETTE_ANIMATION_BLITTER,
55 };
56
61 virtual uint8 GetScreenDepth() = 0;
62
66 virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
67
77 virtual void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) = 0;
78
82 virtual Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
83
92 virtual void *MoveTo(void *video, int x, int y) = 0;
93
101 virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
102
110 virtual void DrawRect(void *video, int width, int height, uint8 colour) = 0;
111
125 virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash = 0);
126
135 virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0;
136
145 virtual void CopyToBuffer(const void *video, void *dst, int width, int height) = 0;
146
155 virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0;
156
167 virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) = 0;
168
175 virtual int BufferSize(int width, int height) = 0;
176
182 virtual void PaletteAnimate(const Palette &palette) = 0;
183
188 virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
189
193 virtual const char *GetName() = 0;
194
198 virtual int GetBytesPerPixel() = 0;
199
203 virtual void PostResize() { };
204
205 virtual ~Blitter() { }
206 };
207
208 #endif /* BLITTER_BASE_HPP */