10#ifndef BLITTER_32BPP_ANIM_HPP
11#define BLITTER_32BPP_ANIM_HPP
38 void DrawLine(
void *video,
int x,
int y,
int x2,
int y2,
int screen_width,
int screen_height,
PixelColour colour,
int width,
int dash)
override;
40 void CopyFromBuffer(
void *video,
const void *src,
int width,
int height)
override;
41 void CopyToBuffer(
const void *video,
void *dst,
int width,
int height)
override;
42 void ScrollBuffer(
void *video,
int &left,
int &top,
int &width,
int &height,
int scroll_x,
int scroll_y)
override;
43 size_t BufferSize(uint width, uint height)
override;
47 std::string_view
GetName()
override {
return "32bpp-anim"; }
55 return this->palette.
palette[index];
58 inline int ScreenToAnimOffset(
const uint32_t *video)
60 int raw_offset = video - (
const uint32_t *)_screen.dst_ptr;
61 if (_screen.pitch == this->anim_buf_pitch)
return raw_offset;
62 int lines = raw_offset / _screen.pitch;
63 int across = raw_offset % _screen.pitch;
64 return across + (lines * this->anim_buf_pitch);
67 template <BlitterMode mode>
void Draw(
const Blitter::BlitterParams *bp,
ZoomLevel zoom);
73 FBlitter_32bppAnim() :
BlitterFactory(
"32bpp-anim",
"32bpp Animation Blitter (palette animation)") {}
74 std::unique_ptr<Blitter>
CreateInstance()
override {
return std::make_unique<Blitter_32bppAnim>(); }
Optimized 32 bpp blitter.
BlitterMode
The modes of blitting we can do.
BlitterFactory(std::string_view name, std::string_view description, bool usable=true)
Construct the blitter, and register it.
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
Palette palette
The current palette.
std::unique_ptr< uint16_t[]> anim_alloc
The raw allocated buffer, not necessarily aligned correctly.
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
int anim_buf_width
The width of the animation buffer.
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.
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, PixelColour colour, int width, int dash) override
Draw a line with a given colour.
void SetPixel(void *video, int x, int y, PixelColour colour) override
Draw a pixel with a given colour on the video-buffer.
Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
std::string_view GetName() override
Get the name of the blitter, the same as the Factory-instance returns.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
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.
uint16_t * anim_buf
In this buffer we keep track of the 8bpp indexes so we can do palette animation.
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...
void PostResize() override
Post resize event.
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draw an image to the screen, given an amount of params defined above.
int anim_buf_height
The height of the animation buffer.
void DrawRect(void *video, int width, int height, PixelColour colour) override
Make a single horizontal line in a single colour on the video-buffer.
int anim_buf_pitch
The pitch of the animation buffer (width rounded up to 16 byte boundary).
The optimised 32 bpp blitter (without palette animation).
PaletteAnimation
Types of palette animation.
std::unique_ptr< Blitter > CreateInstance() override
Create an instance of this Blitter-class.
Palette _cur_palette
Current palette.
uint32_t PaletteID
The number of the palette.
Parameters related to blitting.
Colour palette[256]
Current palette. Entry 0 has to be always fully transparent!
Colour for pixel/line drawing.
ZoomLevel
All zoom levels we know.