31 #ifndef AGS_SHARED_AC_SPRITE_FILE_H 32 #define AGS_SHARED_AC_SPRITE_FILE_H 34 #include "ags/shared/core/types.h" 35 #include "common/std/memory.h" 36 #include "common/std/vector.h" 37 #include "ags/shared/util/stream.h" 38 #include "ags/globals.h" 47 enum SpriteFileVersion {
48 kSprfVersion_Undefined = 0,
49 kSprfVersion_Uncompressed = 4,
50 kSprfVersion_Compressed = 5,
51 kSprfVersion_Last32bit = 6,
52 kSprfVersion_64bit = 10,
53 kSprfVersion_HighSpriteLimit = 11,
54 kSprfVersion_StorageFormats = 12,
55 kSprfVersion_Current = kSprfVersion_StorageFormats
58 enum SpriteIndexFileVersion {
59 kSpridxfVersion_Initial = 1,
60 kSpridxfVersion_Last32bit = 2,
61 kSpridxfVersion_64bit = 10,
62 kSpridxfVersion_HighSpriteLimit = 11,
63 kSpridxfVersion_Current = kSpridxfVersion_HighSpriteLimit
70 kSprStore_OptimizeForSize = 0x01
75 kSprFmt_Undefined = 0,
77 kSprFmt_PaletteRgb888 = 32,
79 kSprFmt_PaletteArgb8888 = 33,
81 kSprFmt_PaletteRgb565 = 34
84 enum SpriteCompression {
85 kSprCompress_None = 0,
90 typedef int32_t sprkey_t;
94 int SpriteFileIDCheck = 0;
99 inline size_t GetCount()
const {
100 return Offsets.
size();
102 inline sprkey_t GetLastSlot()
const {
103 return (sprkey_t)GetCount() - 1;
110 SpriteFormat SFormat = kSprFmt_Undefined;
111 uint32_t PalCount = 0;
112 SpriteCompression Compress = kSprCompress_None;
118 uint32_t pal_count = 0, SpriteCompression compress = kSprCompress_None,
119 int w = 0,
int h = 0) : BPP(bpp), SFormat(sformat), PalCount(pal_count),
120 Compress(compress), Width(w), Height(h) {
129 static const char *DefaultSpriteFileName;
130 static const char *DefaultSpriteIndexName;
139 int GetStoreFlags()
const;
141 SpriteCompression GetSpriteCompression()
const;
143 sprkey_t GetTopmostSprite()
const;
146 bool LoadSpriteIndexFile(
const String &filename,
int expectedFileID,
159 void SeekToSprite(sprkey_t index);
171 SpriteFileVersion _version = kSprfVersion_Current;
173 SpriteCompression _compress = kSprCompress_None;
194 void Begin(
int store_flags, SpriteCompression compress, sprkey_t last_slot = -1);
196 void WriteBitmap(
Bitmap *image);
198 void WriteEmptySlot();
200 void WriteRawData(
const SpriteDatHeader &hdr,
const uint8_t *data,
size_t data_sz);
207 const uint8_t *im_data,
size_t im_data_sz,
int im_bpp,
208 const uint32_t palette[256]);
212 SpriteCompression _compress = kSprCompress_None;
213 soff_t _lastSlotPos = -1;
225 int SaveSpriteFile(
const String &save_to_file,
Definition: achievements_tables.h:27
Definition: allegro_bitmap.h:44
Definition: sprite_file.h:126
Definition: sprite_file.h:93
size_type size() const
Definition: array.h:315
Definition: sprite_file.h:180