25 for (
auto *pixel = sprite.
data; pixel != pixel_end; ++pixel) {
28 uint8_t brightness = std::max({pixel->r, pixel->g, pixel->b});
29 if (brightness == 0 || brightness == 128)
continue;
32 Colour c = AdjustBrightness(
_cur_palette.palette[pixel->m], brightness);
40 }
else if (pixel->a < 128) {
52 ZoomLevels avail = this->baseloader.LoadSprite(sprite, file, file_pos, sprite_type,
true, control_flags, avail_8bpp, avail_32bpp);
RandomAccessFile with some extra information specific for sprite files.
ZoomLevels LoadSprite(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, SpriteCacheCtrlFlags control_flags, ZoomLevels &avail_8bpp, ZoomLevels &avail_32bpp) override
Load a sprite from the disk and return a sprite struct which is the same for all loaders.
SpriteCollMap< Sprite > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
Functions related to the gfx engine.
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.
Functions related to palettes.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
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.