2022-04-22 22:54:42 +02:00
|
|
|
#ifndef IMAGE_INDEXER_H
|
|
|
|
#define IMAGE_INDEXER_H
|
|
|
|
|
|
|
|
#include "core/image.h"
|
2022-08-17 13:45:14 +02:00
|
|
|
#include "core/object/reference.h"
|
2022-08-17 13:17:12 +02:00
|
|
|
#include "core/variant/variant.h"
|
2022-08-17 12:53:49 +02:00
|
|
|
#include "core/containers/oa_hash_map.h"
|
2022-04-22 22:54:42 +02:00
|
|
|
|
|
|
|
class ImageIndexer : public Reference {
|
|
|
|
GDCLASS(ImageIndexer, Reference);
|
|
|
|
|
|
|
|
public:
|
|
|
|
PoolColorArray get_colors();
|
|
|
|
|
2022-04-24 11:19:03 +02:00
|
|
|
PoolIntArray index_image(Ref<Image> image);
|
2022-04-24 09:49:59 +02:00
|
|
|
void reset();
|
2022-04-22 22:54:42 +02:00
|
|
|
|
|
|
|
PoolByteArray indices_to_argb8_data(const PoolIntArray &indices);
|
|
|
|
|
|
|
|
ImageIndexer();
|
|
|
|
~ImageIndexer();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
private:
|
|
|
|
PoolColorArray _colors;
|
2022-04-24 09:49:59 +02:00
|
|
|
OAHashMap<Color, int> _col_map;
|
2022-04-22 22:54:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|