11#include "../core/bitmath_func.hpp"
12#include "../core/math_func.hpp"
13#include "../gfx_func.h"
14#include "../palette_func.h"
17#include "../safeguards.h"
26 for (
auto *pixel = sprite.
data; pixel != pixel_end; ++pixel) {
29 uint8_t brightness = std::max({pixel->r, pixel->g, pixel->b});
30 if (brightness == 0 || brightness == 128)
continue;
41 }
else if (pixel->a < 128) {
53 uint8_t avail = this->baseloader.
LoadSprite(sprite, file, file_pos, sprite_type,
true, control_flags, avail_8bpp, avail_32bpp);
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
RandomAccessFile with some extra information specific for sprite files.
uint8_t LoadSprite(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, uint8_t control_flags, uint8_t &avail_8bpp, uint8_t &avail_32bpp) override
Load a sprite from the disk and return a sprite struct which is the same for all loaders.
std::array< Sprite, ZOOM_LVL_END > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
virtual uint8_t LoadSprite(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, uint8_t control_flags, uint8_t &avail_8bpp, uint8_t &avail_32bpp)=0
Load a sprite from the disk and return a sprite struct which is the same for all loaders.
Palette _cur_palette
Current palette.
SpriteType
Types of sprites that might be loaded.
static void Convert32bppTo8bpp(SpriteLoader::Sprite &sprite)
Convert in place a 32bpp sprite to 8bpp.
Base for converting sprites from another source from 32bpp RGBA to indexed 8bpp.
constexpr bool IsInsideMM(const size_t x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
uint8_t GetNearestColourReshadeIndex(uint8_t b)
Get nearest colour palette index from a brightness level.
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b)
Get nearest colour palette index from an RGB colour.
Colour palette[256]
Current palette. Entry 0 has to be always fully transparent!
Structure for passing information from the sprite loader to the blitter.
uint16_t width
Width of the sprite.
SpriteLoader::CommonPixel * data
The sprite itself.
uint16_t height
Height of the sprite.
ZoomLevel
All zoom levels we know.
@ ZOOM_LVL_BEGIN
Begin for iteration.
@ ZOOM_LVL_END
End for iteration.