Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../zoom_func.h"
14 #include "../table/sprites.h"
16 #include "../safeguards.h"
30 for (
int y = 0; y < bp->
height; y++) {
32 dst_line += bp->
pitch;
37 for (
int x = 0; x < bp->
width; x++) {
90 for (
int i = 0; i != width; i++) {
94 udst = udst - width + _screen.pitch;
100 for (
int i = 0; i != width; i++) {
104 udst = udst - width + _screen.pitch;
109 DEBUG(misc, 0,
"32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
115 Sprite *dest_sprite = (
Sprite *)allocator(
sizeof(*dest_sprite) + (size_t)sprite->
height * (
size_t)sprite->
width *
sizeof(*dst));
125 for (
int i = 0; i < sprite->
height * sprite->
width; i++) {
135 uint8 rgb_max = std::max({src->r, src->g, src->b});
138 if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
int top
The top offset in the 'dst' in pixels to start drawing.
@ BM_TRANSPARENT
Perform transparency colour remapping.
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.
void * dst
Destination buffer.
static const PaletteID PALETTE_TO_TRANSPARENT
This sets the sprite to transparent.
uint16 height
Height of the sprite.
int16 x_offs
Number of pixels to shift the sprite to the right.
int sprite_width
Real width of the sprite.
ZoomLevel
All zoom levels we know.
int pitch
The pitch of the destination buffer.
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override
Convert a sprite from the loader to our own format.
SpriteLoader::CommonPixel * data
The sprite itself.
const void * sprite
Pointer to the sprite how ever the encoder stored it.
static Colour MakeGrey(Colour colour)
Make a colour grey - based.
#define DEBUG(name, level,...)
Output a line of debugging information.
@ BM_COLOUR_REMAP
Perform a colour remapping.
Definition of a common pixel in OpenTTD's realm.
static const PaletteID PALETTE_NEWSPAPER
Recolour sprite for newspaper-greying.
@ BM_CRASH_REMAP
Perform a crash remapping.
static Colour ComposeColourPA(Colour colour, uint a, Colour current)
Compose a colour based on Pixel value, alpha value, and the current pixel value.
uint16 width
Width of the sprite.
static Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
int16 x_offs
The x-offset of where the sprite will be drawn.
@ BM_BLACK_REMAP
Perform remapping to a completely blackened sprite.
static uint8 MakeDark(uint8 r, uint8 g, uint8 b)
Make a colour dark grey, for specialized 32bpp remapping.
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
static Colour ComposeColourRGBA(uint r, uint g, uint b, uint a, Colour current)
Compose a colour based on RGBA values and the current pixel value.
uint16 width
Width of the sprite.
static int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right,...
static FBlitter_32bppSimple iFBlitter_32bppSimple
Instantiation of the simple 32bpp blitter factory.
uint32 PaletteID
The number of the palette.
int left
The left offset in the 'dst' in pixels to start drawing.
uint8 v
Brightness-channel.
int16 y_offs
Number of pixels to shift the sprite downwards.
Structure for passing information from the sprite loader to the blitter.
static Colour MakeTransparent(Colour colour, uint nom, uint denom=256)
Make a pixel looks like it is transparent.
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.
int height
The height in pixels that needs to be drawn to dst.
int16 y_offs
The y-offset of where the sprite will be drawn.
uint16 height
Height of the sprite.
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
Data structure describing a sprite.
const byte * remap
XXX – Temporary storage for remap array.
Factory for the simple 32 bpp blitter.