OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
10 #ifndef BLITTER_32BPP_ANIM_HPP
11 #define BLITTER_32BPP_ANIM_HPP
40 void SetPixel(
void *video,
int x,
int y, uint8_t colour)
override;
41 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;
42 void DrawRect(
void *video,
int width,
int height, uint8_t colour)
override;
43 void CopyFromBuffer(
void *video,
const void *src,
int width,
int height)
override;
44 void CopyToBuffer(
const void *video,
void *dst,
int width,
int height)
override;
45 void ScrollBuffer(
void *video,
int &left,
int &top,
int &width,
int &height,
int scroll_x,
int scroll_y)
override;
46 size_t BufferSize(uint width, uint height)
override;
50 std::string_view
GetName()
override {
return "32bpp-anim"; }
58 return this->palette.
palette[index];
61 inline int ScreenToAnimOffset(
const uint32_t *video)
63 int raw_offset = video - (
const uint32_t *)_screen.dst_ptr;
64 if (_screen.pitch == this->anim_buf_pitch)
return raw_offset;
65 int lines = raw_offset / _screen.pitch;
66 int across = raw_offset % _screen.pitch;
Palette _cur_palette
Current palette.
Factory for the 32bpp blitter with animation.
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.
void PostResize() override
Post resize event.
BlitterMode
The modes of blitting we can do.
std::string_view GetName() override
Get the name of the blitter, the same as the Factory-instance returns.
How all blitters should look like.
The base factory, keeping track of all blitters.
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
Blitter * CreateInstance() override
Create an instance of this Blitter-class.
void SetPixel(void *video, int x, int y, uint8_t colour) override
Draw a pixel with a given colour on the video-buffer.
int anim_buf_pitch
The pitch of the animation buffer (width rounded up to 16 byte boundary).
int anim_buf_width
The width of the animation buffer.
uint32_t PaletteID
The number of the palette.
void * anim_alloc
The raw allocated buffer, not necessarily aligned correctly.
int anim_buf_height
The height of the animation buffer.
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.
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
Colour palette[256]
Current palette. Entry 0 has to be always fully transparent!
Palette palette
The current palette.
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...
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
BlitterFactory(const char *name, const char *description, bool usable=true)
Construct the blitter, and register it.
PaletteAnimation
Types of palette animation.
uint16_t * anim_buf
In this buffer we keep track of the 8bpp indexes so we can do palette animation.
The optimised 32 bpp blitter with palette animation.
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.
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
Parameters related to blitting.
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draw an image to the screen, given an amount of params defined above.
Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
Information about the currently used palette.
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.
The optimised 32 bpp blitter (without palette animation).
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
ZoomLevel
All zoom levels we know.