Codechange: Give sprite encoders a hint which colour components of a sprite are filled with useful information.

This commit is contained in:
Michael Lutz
2021-01-16 16:43:30 +01:00
parent e7e5316340
commit 70aa3b4011
6 changed files with 21 additions and 10 deletions

View File

@@ -11,11 +11,21 @@
#define SPRITELOADER_HPP
#include "../core/alloc_type.hpp"
#include "../core/enum_type.hpp"
#include "../gfx_type.h"
struct Sprite;
typedef void *AllocatorProc(size_t size);
/** The different colour components a sprite can have. */
enum SpriteColourComponent {
SCC_RGB = 1 << 0, ///< Sprite has RGB.
SCC_ALPHA = 1 << 1, ///< Sprite has alpha.
SCC_PAL = 1 << 2, ///< Sprite has palette data.
SCC_MASK = SCC_RGB | SCC_ALPHA | SCC_PAL, ///< Mask of valid colour bits.
};
DECLARE_ENUM_AS_BIT_SET(SpriteColourComponent)
/** Interface for the loader of our sprites. */
class SpriteLoader {
public:
@@ -40,6 +50,7 @@ public:
int16 x_offs; ///< The x-offset of where the sprite will be drawn
int16 y_offs; ///< The y-offset of where the sprite will be drawn
SpriteType type; ///< The sprite type
SpriteColourComponent colours; ///< The colour components of the sprite with useful information.
SpriteLoader::CommonPixel *data; ///< The sprite itself
/**