OpenTTD Source 20261112-master-gbcbec5e63f
40bpp_anim.cpp
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#include "../stdafx.h"
11#include "../spritecache.h"
13#include "../palette_func.h"
14#include "32bpp_anim.hpp"
15#include "40bpp_anim.hpp"
16#include "common.hpp"
17
18#include "../table/sprites.h"
19
20#include "../safeguards.h"
21
22
25
27static const Colour _black_colour{0, 0, 0};
28
34static inline uint8_t *ScreenToAnimationBuffer(const void *video)
35{
36 return ::ScreenToAnimationBuffer(video, VideoDriver::GetInstance()->GetAnimBuffer(), VideoDriver::GetInstance()->GetAnimBufferPitch());
37}
38
39void Blitter_40bppAnim::SetPixel(void *video, int x, int y, PixelColour colour)
40{
42 Blitter_32bppOptimized::SetPixel(video, x, y, colour);
43 } else {
44 size_t y_offset = static_cast<size_t>(y) * _screen.pitch;
45 *((Colour *)video + x + y_offset) = _black_colour;
46
47 ScreenToAnimationBuffer(video)[x + static_cast<size_t>(y) * VideoDriver::GetInstance()->GetAnimBufferPitch()] = colour.p;
48 }
49}
50
51void Blitter_40bppAnim::DrawRect(void *video, int width, int height, PixelColour colour)
52{
54 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
55 Blitter_32bppOptimized::DrawRect(video, width, height, colour);
56 return;
57 }
58
59 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
60 uint8_t *anim_line = ScreenToAnimationBuffer(video);
61 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
62
63 do {
64 Colour *dst = (Colour *)video;
65 uint8_t *anim = anim_line;
66
67 for (int i = width; i > 0; i--) {
68 *dst = _black_colour;
69 *anim = colour.p;
70 dst++;
71 anim++;
72 }
73 video = (uint32_t *)video + _screen.pitch;
74 anim_line += anim_pitch;
75 } while (--height);
76}
77
78void Blitter_40bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, PixelColour colour, int width, int dash)
79{
81 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
82 Blitter_32bppOptimized::DrawLine(video, x, y, x2, y2, screen_width, screen_height, colour, width, dash);
83 return;
84 }
85
86 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
87 uint8_t *anim = ScreenToAnimationBuffer(video);
88 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
89
90 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
91 *((Colour *)video + x + y * _screen.pitch) = _black_colour;
92 *(anim + x + y * anim_pitch) = colour.p;
93 });
94}
95
103template <BlitterMode mode>
105{
106 const SpriteData *src = (const SpriteData *)bp->sprite;
107
108 /* src_px : each line begins with uint32_t n = 'number of bytes in this line',
109 * then n times is the Colour struct for this line */
110 const Colour *src_px = reinterpret_cast<const Colour *>(src->data + src->offset[0][zoom]);
111 /* src_n : each line begins with uint32_t n = 'number of bytes in this line',
112 * then interleaved stream of 'm' and 'n' channels. 'm' is remap,
113 * 'n' is number of bytes with the same alpha channel class */
114 const uint16_t *src_n = reinterpret_cast<const uint16_t *>(src->data + src->offset[1][zoom]);
115
116 /* skip upper lines in src_px and src_n */
117 for (uint i = bp->skip_top; i != 0; i--) {
118 src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
119 src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
120 }
121
122 /* skip lines in dst */
123 Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
124 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
125 uint8_t *anim = ScreenToAnimationBuffer(dst);
126 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
127
128 /* store so we don't have to access it via bp every time (compiler assumes pointer aliasing) */
129 const uint8_t *remap = bp->remap;
130
131 for (int y = 0; y < bp->height; y++) {
132 /* next dst line begins here */
133 Colour *dst_ln = dst + bp->pitch;
134 uint8_t *anim_ln = anim + anim_pitch;
135
136 /* next src line begins here */
137 const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
138 src_px++;
139
140 /* next src_n line begins here */
141 const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
142 src_n += 2;
143
144 /* we will end this line when we reach this point */
145 Colour *dst_end = dst + bp->skip_left;
146
147 /* number of pixels with the same alpha channel class */
148 uint n;
149
150 while (dst < dst_end) {
151 n = *src_n++;
152
153 if (src_px->a == 0) {
154 dst += n;
155 src_px++;
156 src_n++;
157
158 if (dst > dst_end) anim += dst - dst_end;
159 } else {
160 if (dst + n > dst_end) {
161 uint d = dst_end - dst;
162 src_px += d;
163 src_n += d;
164
165 dst = dst_end - bp->skip_left;
166 dst_end = dst + bp->width;
167
168 n = std::min<uint>(n - d, (uint)bp->width);
169 goto draw;
170 }
171 dst += n;
172 src_px += n;
173 src_n += n;
174 }
175 }
176
177 dst -= bp->skip_left;
178 dst_end -= bp->skip_left;
179
180 dst_end += bp->width;
181
182 while (dst < dst_end) {
183 n = std::min<uint>(*src_n++, (uint)(dst_end - dst));
184
185 if (src_px->a == 0) {
186 anim += n;
187 dst += n;
188 src_px++;
189 src_n++;
190 continue;
191 }
192
193 draw:;
194
195 switch (mode) {
198 if (src_px->a == 255) {
199 do {
200 uint8_t m = GB(*src_n, 0, 8);
201 /* In case the m-channel is zero, only apply the crash remap by darkening the RGB colour. */
202 if (m == 0) {
203 *dst = mode == BlitterMode::CrashRemap ? this->MakeDark(*src_px) : *src_px;
204 *anim = 0;
205 } else {
206 uint r = remap[m];
207 if (r != 0) {
208 *dst = src_px->data;
209 *anim = r;
210 }
211 }
212 anim++;
213 dst++;
214 src_px++;
215 src_n++;
216 } while (--n != 0);
217 } else {
218 do {
219 uint8_t m = GB(*src_n, 0, 8);
220 Colour b = this->RealizeBlendedColour(*anim, *dst);
221 if (m == 0) {
222 Colour c = mode == BlitterMode::CrashRemap ? this->MakeDark(*src_px) : *src_px;
223 *dst = this->ComposeColourRGBANoCheck(c.r, c.g, c.b, src_px->a, b);
224 *anim = 0;
225 } else {
226 uint r = remap[m];
227 if (r != 0) {
228 *dst = this->ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, b);
229 *anim = 0; // Animation colours don't work with alpha-blending.
230 }
231 }
232 anim++;
233 dst++;
234 src_px++;
235 src_n++;
236 } while (--n != 0);
237 }
238 break;
239
241 do {
242 *anim++ = 0;
243 *dst++ = _black_colour;
244 src_px++;
245 src_n++;
246 } while (--n != 0);
247 break;
248
250 /* Make the current colour a bit more black, so it looks like this image is transparent */
251 src_n += n;
252 if (src_px->a == 255) {
253 src_px += n;
254 do {
255 /* If the anim buffer contains a colour value, the image composition will
256 * only look at the RGB brightness value. As such, we can simply darken the
257 * RGB value to darken the anim colour. */
258 Colour b = *anim != 0 ? Colour(GetColourBrightness(*dst), 0, 0) : *dst;
259 *dst = this->MakeTransparent(b, 3, 4);
260 anim++;
261 dst++;
262 } while (--n != 0);
263 } else {
264 do {
265 Colour b = this->RealizeBlendedColour(*anim, *dst);
266 *dst = this->MakeTransparent(b, (256 * 4 - src_px->a), 256 * 4);
267 *anim = 0; // Animation colours don't work with alpha-blending.
268 anim++;
269 dst++;
270 src_px++;
271 } while (--n != 0);
272 }
273 break;
274
276 /* Apply custom transparency remap. */
277 src_n += n;
278 if (src_px->a != 0) {
279 src_px += n;
280 do {
281 if (*anim != 0) {
282 *anim = remap[*anim];
283 } else {
284 *dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
285 *anim = 0;
286 }
287 anim++;
288 dst++;
289 } while (--n != 0);
290 } else {
291 dst += n;
292 anim += n;
293 src_px += n;
294 }
295 break;
296
297 default:
298 if (src_px->a == 255) {
299 do {
300 *anim++ = GB(*src_n, 0, 8);
301 *dst++ = src_px->data;
302 src_px++;
303 src_n++;
304 } while (--n != 0);
305 break;
306 } else {
307 do {
308 uint8_t m = GB(*src_n, 0, 8);
309 Colour b = this->RealizeBlendedColour(*anim, *dst);
310
311 if (m == 0) {
312 *dst = this->ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, b);
313 *anim = 0;
314 } else {
315 *dst = this->ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, b);
316 *anim = m;
317 }
318
319 anim++;
320 dst++;
321 src_px++;
322 src_n++;
323 } while (--n != 0);
324 }
325 }
326 }
327
328 dst = dst_ln;
329 anim = anim_ln;
330 src_px = src_px_ln;
331 src_n = src_n_ln;
332 }
333}
334
343{
344 assert(_screen.dst_ptr != nullptr);
345
346 if (_screen_disable_anim || VideoDriver::GetInstance()->GetAnimBuffer() == nullptr) {
347 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */
349 return;
350 }
351
352 switch (mode) {
353 default: NOT_REACHED();
354 case BlitterMode::Normal: Draw<BlitterMode::Normal>(bp, zoom); return;
360 }
361}
362
363void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
364{
366 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColourMappingRect() */
367 Blitter_32bppOptimized::DrawColourMappingRect(dst, width, height, pal);
368 return;
369 }
370
371 Colour *udst = (Colour *)dst;
372 uint8_t *anim = ScreenToAnimationBuffer(dst);
373 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
374
375 if (pal == PALETTE_TO_TRANSPARENT) {
376 /* If the anim buffer contains a colour value, the image composition will
377 * only look at the RGB brightness value. As such, we can simply darken the
378 * RGB value to darken the anim colour. */
379 do {
380 for (int i = 0; i != width; i++) {
381 Colour b = *anim != 0 ? Colour(GetColourBrightness(*udst), 0, 0) : *udst;
382 *udst = MakeTransparent(b, 154);
383 udst++;
384 anim++;
385 }
386 udst = udst - width + _screen.pitch;
387 anim = anim - width + anim_pitch;
388 } while (--height);
389 } else if (pal == PALETTE_NEWSPAPER) {
390 const uint8_t *remap = GetNonSprite(pal, SpriteType::Recolour) + 1;
391 do {
392 for (int i = 0; i != width; i++) {
393 if (*anim == 0) {
394 *udst = MakeGrey(*udst);
395 } else {
396 *anim = remap[*anim];
397 }
398 udst++;
399 anim++;
400 }
401 udst = udst - width + _screen.pitch;
402 anim = anim - width + anim_pitch;
403 } while (--height);
404 } else {
405 const uint8_t *remap = GetNonSprite(pal, SpriteType::Recolour) + 1;
406 do {
407 for (int i = 0; i != width; i++) {
408 if (*anim != 0) *anim = remap[*anim];
409 anim++;
410 }
411 anim = anim - width + anim_pitch;
412 } while (--height);
413 }
414}
415
417{
418 return this->EncodeInternal<false>(sprite_type, sprite, allocator);
419}
420
421
422void Blitter_40bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
423{
424 assert(!_screen_disable_anim);
425 assert(video >= _screen.dst_ptr && video <= (uint32_t *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
426 uint32_t *dst = (uint32_t *)video;
427 const uint32_t *usrc = (const uint32_t *)src;
428
429 if (VideoDriver::GetInstance()->GetAnimBuffer() == nullptr) return;
430 uint8_t *anim_line = ScreenToAnimationBuffer(video);
431 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
432
433 for (; height > 0; height--) {
434 std::copy_n(usrc, width, dst);
435 usrc += width;
436 dst += _screen.pitch;
437 /* Copy back the anim-buffer */
438 std::copy_n(reinterpret_cast<const uint8_t *>(usrc), width, anim_line);
439 usrc = (const uint32_t *)((const uint8_t *)usrc + width);
440 anim_line += anim_pitch;
441 }
442}
443
444void Blitter_40bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height)
445{
446 assert(!_screen_disable_anim);
447 assert(video >= _screen.dst_ptr && video <= (uint32_t *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
448 uint32_t *udst = (uint32_t *)dst;
449 const uint32_t *src = (const uint32_t *)video;
450
451 if (VideoDriver::GetInstance()->GetAnimBuffer() == nullptr) return;
452 const uint8_t *anim_line = ScreenToAnimationBuffer(video);
453 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
454
455 for (; height > 0; height--) {
456 std::copy_n(src, width, udst);
457 src += _screen.pitch;
458 udst += width;
459 /* Copy the anim-buffer */
460 std::copy_n(anim_line, width, reinterpret_cast<uint8_t *>(udst));
461 udst = (uint32_t *)((uint8_t *)udst + width);
462 anim_line += anim_pitch;
463 }
464}
465
466void Blitter_40bppAnim::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
467{
468 if (VideoDriver::GetInstance()->GetAnimBuffer() == nullptr) {
469 Blitter_32bppOptimized::CopyImageToBuffer(video, dst, width, height, dst_pitch);
470 return;
471 }
472
473 uint32_t *udst = (uint32_t *)dst;
474 const uint32_t *src = (const uint32_t *)video;
475 const uint8_t *anim_line = ScreenToAnimationBuffer(video);
476 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
477
478 for (; height > 0; height--) {
479 for (int x = 0; x < width; x++) {
480 udst[x] = this->RealizeBlendedColour(anim_line[x], src[x]).data;
481 }
482 src += _screen.pitch;
483 anim_line += anim_pitch;
484 udst += dst_pitch;
485 }
486}
487
488void Blitter_40bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
489{
490 assert(!_screen_disable_anim);
491 assert(video >= _screen.dst_ptr && video <= (uint32_t *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
492 uint8_t *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
493 int anim_pitch = VideoDriver::GetInstance()->GetAnimBufferPitch();
494 uint8_t *dst, *src;
495
496 /* We need to scroll the anim-buffer too */
497 if (scroll_y > 0) {
498 dst = anim_buf + left + (top + height - 1) * anim_pitch;
499 src = dst - scroll_y * anim_pitch;
500
501 /* Adjust left & width */
502 if (scroll_x >= 0) {
503 dst += scroll_x;
504 } else {
505 src -= scroll_x;
506 }
507
508 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
509 uint th = height - scroll_y;
510 Blitter::MovePixels(src, dst, tw, th, -anim_pitch);
511 } else {
512 /* Calculate pointers */
513 dst = anim_buf + left + top * anim_pitch;
514 src = dst - scroll_y * anim_pitch;
515
516 /* Adjust left & width */
517 if (scroll_x >= 0) {
518 dst += scroll_x;
519 } else {
520 src -= scroll_x;
521 }
522
523 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
524 uint th = height + scroll_y;
525 Blitter::MovePixels(src, dst, tw, th, anim_pitch);
526 }
527
528 Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
529}
530
531size_t Blitter_40bppAnim::BufferSize(uint width, uint height)
532{
533 return (sizeof(uint32_t) + sizeof(uint8_t)) * width * height;
534}
535
540
542{
543 return true;
544}
A 32 bpp blitter with animation support.
static T * ScreenToAnimationBuffer(const void *video, T *animation_buffer, int animation_buffer_pitch)
Converts video buffer pointer into the animation buffer pointer.
static FBlitter_40bppAnim iFBlitter_40bppAnim
Instantiation of the 40bpp with animation blitter factory.
static uint8_t * ScreenToAnimationBuffer(const void *video)
Converts video buffer pointer into the animation buffer pointer.
static const Colour _black_colour
Cached black value.
Animated 40 bpp blitter.
BlitterMode
The modes of blitting we can do.
Definition base.hpp:16
@ Transparent
Perform transparency darkening remapping.
Definition base.hpp:19
@ CrashRemap
Perform a crash remapping.
Definition base.hpp:21
@ BlackRemap
Perform remapping to a completely blackened sprite.
Definition base.hpp:22
@ Normal
Perform the simple blitting.
Definition base.hpp:17
@ TransparentRemap
Perform transparency colour remapping.
Definition base.hpp:20
@ ColourRemap
Perform a colour remapping.
Definition base.hpp:18
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
static Colour ComposeColourRGBANoCheck(uint r, uint g, uint b, uint a, Colour current)
Compose a colour based on RGBA values and the current pixel value.
static Colour ComposeColourPANoCheck(Colour colour, uint a, Colour current)
Compose a colour based on Pixel value, alpha value, and the current pixel value.
static Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
void DrawRect(void *video, int width, int height, PixelColour colour) override
Make a single horizontal line in a single colour on the video-buffer.
void SetPixel(void *video, int x, int y, PixelColour colour) override
Draw a pixel with a given colour on the video-buffer.
static Colour MakeTransparent(Colour colour, uint nom, uint denom=256)
Make a pixel looks like it is transparent.
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.
static Colour MakeGrey(Colour colour)
Make a colour grey - based.
static uint8_t MakeDark(uint8_t r, uint8_t g, uint8_t b)
Make a colour dark grey, for specialized 32bpp remapping.
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 Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draws a sprite to a (screen) buffer.
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.
Sprite * Encode(SpriteType sprite_type, const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
Convert a sprite from the loader to our own format.
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.
bool NeedsAnimationBuffer() override
Does this blitter require a separate animation buffer from the video backend?
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
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 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.
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
void DrawRect(void *video, int width, int height, PixelColour colour) override
Make a single horizontal line in a single colour on the video-buffer.
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
Draws a sprite to a (screen) buffer.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
void SetPixel(void *video, int x, int y, PixelColour colour) override
Draw a pixel with a given colour on the video-buffer.
PaletteAnimation
Types of palette animation.
Definition base.hpp:49
@ VideoBackend
Palette animation should be done by video backend (8bpp only!).
Definition base.hpp:51
Factory for the 40 bpp animated blitter (for OpenGL).
Interface for something that can allocate memory for a sprite.
SpriteCollMap< Sprite > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
constexpr uint8_t * GetAnimBuffer() const
Get a pointer to the animation buffer of the video back-end.
constexpr int GetAnimBufferPitch() const
Get the animation buffer pitch in uint8_t elements per row.
Common functionality for all blitter implementations.
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot).
Definition gfx.cpp:42
SpriteType
Types of sprites that might be loaded.
Definition gfx_type.h:404
@ Recolour
Recolour sprite.
Definition gfx_type.h:408
uint32_t PaletteID
The number of the palette.
Definition gfx_type.h:18
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b)
Get nearest colour palette index from an RGB colour.
Definition palette.cpp:156
Functions related to palettes.
static uint8_t GetColourBrightness(Colour colour)
Get the brightness of a colour.
A number of safeguards to prevent using unsafe methods.
Functions to cache sprites in memory.
This file contains all sprite-related enums and defines.
static const PaletteID PALETTE_TO_TRANSPARENT
This sets the sprite to transparent.
Definition sprites.h:1791
static const PaletteID PALETTE_NEWSPAPER
Recolour sprite for newspaper-greying.
Definition sprites.h:1793
Definition of base types and functions in a cross-platform compatible way.
Parameters related to blitting.
Definition base.hpp:31
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst).
Definition base.hpp:36
void * dst
Destination buffer.
Definition base.hpp:44
int left
The left offset in the 'dst' in pixels to start drawing.
Definition base.hpp:41
int pitch
The pitch of the destination buffer.
Definition base.hpp:45
int skip_left
How much pixels of the source to skip on the left (based on zoom of dst).
Definition base.hpp:35
int height
The height in pixels that needs to be drawn to dst.
Definition base.hpp:38
const uint8_t * remap
XXX – Temporary storage for remap array.
Definition base.hpp:33
int width
The width in pixels that needs to be drawn to dst.
Definition base.hpp:37
const void * sprite
Pointer to the sprite how ever the encoder stored it.
Definition base.hpp:32
int top
The top offset in the 'dst' in pixels to start drawing.
Definition base.hpp:42
Data stored about a (single) sprite.
uint8_t data[]
Data, all zoomlevels.
SpriteCollMap< uint32_t > offset[2]
Offsets (from .data) to streams for different zoom levels, and the normal and remap image information...
Colour for pixel/line drawing.
Definition gfx_type.h:307
uint8_t p
Palette index.
Definition gfx_type.h:308
Data structure describing a sprite.
Base of all video drivers.
ZoomLevel
All zoom levels we know.
Definition zoom_type.h:20