OpenTTD Source  20241121-master-g67a0fccfad
8bpp_base.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef BLITTER_8BPP_BASE_HPP
11 #define BLITTER_8BPP_BASE_HPP
12 
13 #include "base.hpp"
14 
16 class Blitter_8bppBase : public Blitter {
17 public:
18  uint8_t GetScreenDepth() override { return 8; }
19  void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
20  void *MoveTo(void *video, int x, int y) override;
21  void SetPixel(void *video, int x, int y, uint8_t colour) override;
22  void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash) override;
23  void DrawRect(void *video, int width, int height, uint8_t colour) override;
24  void CopyFromBuffer(void *video, const void *src, int width, int height) override;
25  void CopyToBuffer(const void *video, void *dst, int width, int height) override;
26  void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
27  void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
28  size_t BufferSize(uint width, uint height) override;
29  void PaletteAnimate(const Palette &palette) override;
31 };
32 
33 #endif /* BLITTER_8BPP_BASE_HPP */
Base for all blitters.
Base for all 8bpp blitters.
Definition: 8bpp_base.hpp:16
void SetPixel(void *video, int x, int y, uint8_t colour) override
Draw a pixel with a given colour on the video-buffer.
Definition: 8bpp_base.cpp:32
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
Definition: 8bpp_base.cpp:52
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
Definition: 8bpp_base.cpp:88
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
Definition: 8bpp_base.cpp:17
void PaletteAnimate(const Palette &palette) override
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
Definition: 8bpp_base.cpp:152
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
Definition: 8bpp_base.cpp:64
size_t BufferSize(uint width, uint height) override
Calculate how much memory there is needed for an image of this size in the video-buffer.
Definition: 8bpp_base.cpp:147
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
Definition: 8bpp_base.cpp:157
void DrawRect(void *video, int width, int height, uint8_t colour) override
Make a single horizontal line in a single colour on the video-buffer.
Definition: 8bpp_base.cpp:44
uint8_t GetScreenDepth() override
Get the screen depth this blitter works for.
Definition: 8bpp_base.hpp:18
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
Definition: 8bpp_base.cpp:76
void * MoveTo(void *video, int x, int y) override
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
Definition: 8bpp_base.cpp:27
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash) override
Draw a line with a given colour.
Definition: 8bpp_base.cpp:37
How all blitters should look like.
Definition: base.hpp:29
PaletteAnimation
Types of palette animation.
Definition: base.hpp:50
uint32_t PaletteID
The number of the palette.
Definition: gfx_type.h:19
Information about the currently used palette.
Definition: gfx_type.h:328