OpenTTD
8bpp_base.hpp
Go to the documentation of this file.
1 /* $Id: 8bpp_base.hpp 23448 2011-12-08 19:37:33Z 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_8BPP_BASE_HPP
13 #define BLITTER_8BPP_BASE_HPP
14 
15 #include "base.hpp"
16 
18 class Blitter_8bppBase : public Blitter {
19 public:
20  /* virtual */ uint8 GetScreenDepth() { return 8; }
21  /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
22  /* virtual */ void *MoveTo(void *video, int x, int y);
23  /* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
24  /* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
25  /* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
26  /* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
27  /* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
28  /* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
29  /* virtual */ int BufferSize(int width, int height);
30  /* virtual */ void PaletteAnimate(const Palette &palette);
32  /* virtual */ int GetBytesPerPixel() { return 1; }
33 };
34 
35 #endif /* BLITTER_8BPP_BASE_HPP */
void DrawRect(void *video, int width, int height, uint8 colour)
Make a single horizontal line in a single colour on the video-buffer.
Definition: 8bpp_base.cpp:38
uint32 PaletteID
The number of the palette.
Definition: gfx_type.h:20
Information about the currently used palette.
Definition: gfx_type.h:309
void SetPixel(void *video, int x, int y, uint8 colour)
Draw a pixel with a given colour on the video-buffer.
Definition: 8bpp_base.cpp:33
void * MoveTo(void *video, int x, int y)
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
Definition: 8bpp_base.cpp:28
int GetBytesPerPixel()
Get how many bytes are needed to store a pixel.
Definition: 8bpp_base.hpp:32
How all blitters should look like.
Definition: base.hpp:30
uint8 GetScreenDepth()
Get the screen depth this blitter works for.
Definition: 8bpp_base.hpp:20
void PaletteAnimate(const Palette &palette)
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
Definition: 8bpp_base.cpp:146
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
Draw a colourtable to the screen.
Definition: 8bpp_base.cpp:18
Base for all 8bpp blitters.
Definition: 8bpp_base.hpp:18
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
Scroll the videobuffer some &#39;x&#39; and &#39;y&#39; value.
Definition: 8bpp_base.cpp:82
Base for all blitters.
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp...
Definition: 8bpp_base.cpp:70
void CopyFromBuffer(void *video, const void *src, int width, int height)
Copy from a buffer to the screen.
Definition: 8bpp_base.cpp:46
Blitter::PaletteAnimation UsePaletteAnimation()
Check if the blitter uses palette animation at all.
Definition: 8bpp_base.cpp:151
void CopyToBuffer(const void *video, void *dst, int width, int height)
Copy from the screen to a buffer.
Definition: 8bpp_base.cpp:58
PaletteAnimation
Types of palette animation.
Definition: base.hpp:51
int BufferSize(int width, int height)
Calculate how much memory there is needed for an image of this size in the video-buffer.
Definition: 8bpp_base.cpp:141