OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
10 #ifndef BLITTER_BASE_HPP
11 #define BLITTER_BASE_HPP
13 #include "../spritecache.h"
14 #include "../spriteloader/spriteloader.hpp"
91 virtual void *
MoveTo(
void *video,
int x,
int y) = 0;
100 virtual void SetPixel(
void *video,
int x,
int y, uint8_t colour) = 0;
109 virtual void DrawRect(
void *video,
int width,
int height, uint8_t colour) = 0;
124 virtual 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 = 0) = 0;
134 virtual void CopyFromBuffer(
void *video,
const void *src,
int width,
int height) = 0;
144 virtual void CopyToBuffer(
const void *video,
void *dst,
int width,
int height) = 0;
154 virtual void CopyImageToBuffer(
const void *video,
void *dst,
int width,
int height,
int dst_pitch) = 0;
166 virtual void ScrollBuffer(
void *video,
int &left,
int &top,
int &width,
int &height,
int scroll_x,
int scroll_y) = 0;
174 virtual size_t BufferSize(uint width, uint height) = 0;
200 virtual std::string_view
GetName() = 0;
209 template <
typename SetPixelT>
void DrawLineGeneric(
int x,
int y,
int x2,
int y2,
int screen_width,
int screen_height,
int width,
int dash, SetPixelT set_pixel);
int top
The top offset in the 'dst' in pixels to start drawing.
@ BM_TRANSPARENT
Perform transparency darkening remapping.
virtual void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)=0
Draw a colourtable to the screen.
int skip_left
How much pixels of the source to skip on the left (based on zoom of dst)
BlitterMode
The modes of blitting we can do.
int width
The width in pixels that needs to be drawn to dst.
virtual Blitter::PaletteAnimation UsePaletteAnimation()=0
Check if the blitter uses palette animation at all.
How all blitters should look like.
int sprite_height
Real height of the sprite.
const uint8_t * remap
XXX – Temporary storage for remap array.
virtual void CopyToBuffer(const void *video, void *dst, int width, int height)=0
Copy from the screen to a buffer.
virtual uint8_t GetScreenDepth()=0
Get the screen depth this blitter works for.
virtual void SetPixel(void *video, int x, int y, uint8_t colour)=0
Draw a pixel with a given colour on the video-buffer.
void * dst
Destination buffer.
virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)=0
Scroll the videobuffer some 'x' and 'y' value.
int sprite_width
Real width of the sprite.
int pitch
The pitch of the destination buffer.
uint32_t PaletteID
The number of the palette.
@ BM_NORMAL
Perform the simple blitting.
const void * sprite
Pointer to the sprite how ever the encoder stored it.
virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)=0
Draw an image to the screen, given an amount of params defined above.
virtual 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=0)=0
Draw a line with a given colour.
virtual bool NeedsAnimationBuffer()
Does this blitter require a separate animation buffer from the video backend?
virtual size_t BufferSize(uint width, uint height)=0
Calculate how much memory there is needed for an image of this size in the video-buffer.
virtual void PostResize()
Post resize event.
@ BM_COLOUR_REMAP
Perform a colour remapping.
@ BM_CRASH_REMAP
Perform a crash remapping.
Interface for something that can encode a sprite.
@ BM_BLACK_REMAP
Perform remapping to a completely blackened sprite.
virtual std::string_view GetName()=0
Get the name of the blitter, the same as the Factory-instance returns.
virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)=0
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
PaletteAnimation
Types of palette animation.
bool Is32BppSupported() override
Can the sprite encoder make use of RGBA sprites?
virtual void * MoveTo(void *video, int x, int y)=0
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
virtual void DrawRect(void *video, int width, int height, uint8_t colour)=0
Make a single horizontal line in a single colour on the video-buffer.
int left
The left offset in the 'dst' in pixels to start drawing.
@ PALETTE_ANIMATION_VIDEO_BACKEND
Palette animation should be done by video backend (8bpp only!)
@ PALETTE_ANIMATION_NONE
No palette animation.
virtual void CopyFromBuffer(void *video, const void *src, int width, int height)=0
Copy from a buffer to the screen.
virtual void PaletteAnimate(const Palette &palette)=0
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
Parameters related to blitting.
@ PALETTE_ANIMATION_BLITTER
The blitter takes care of the palette animation.
int height
The height in pixels that needs to be drawn to dst.
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
Information about the currently used palette.
@ BM_TRANSPARENT_REMAP
Perform transparency colour remapping.
ZoomLevel
All zoom levels we know.