summaryrefslogtreecommitdiff
path: root/core/image.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/image.h')
-rw-r--r--core/image.h43
1 files changed, 19 insertions, 24 deletions
diff --git a/core/image.h b/core/image.h
index 1cc22420d5..4dc4bf1328 100644
--- a/core/image.h
+++ b/core/image.h
@@ -33,7 +33,7 @@
#include "core/color.h"
#include "core/math/rect2.h"
-#include "core/pool_vector.h"
+
#include "core/resource.h"
/**
@@ -47,7 +47,7 @@
class Image;
typedef Error (*SavePNGFunc)(const String &p_path, const Ref<Image> &p_img);
-typedef PoolVector<uint8_t> (*SavePNGBufferFunc)(const Ref<Image> &p_img);
+typedef Vector<uint8_t> (*SavePNGBufferFunc)(const Ref<Image> &p_img);
typedef Ref<Image> (*ImageMemLoadFunc)(const uint8_t *p_png, int p_size);
typedef Error (*SaveEXRFunc)(const String &p_path, const Ref<Image> &p_img, bool p_grayscale);
@@ -150,16 +150,14 @@ public:
static void (*_image_decompress_etc1)(Image *);
static void (*_image_decompress_etc2)(Image *);
- static PoolVector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality);
- static Ref<Image> (*lossy_unpacker)(const PoolVector<uint8_t> &p_buffer);
- static PoolVector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image);
- static Ref<Image> (*lossless_unpacker)(const PoolVector<uint8_t> &p_buffer);
- static PoolVector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels);
- static Ref<Image> (*basis_universal_unpacker)(const PoolVector<uint8_t> &p_buffer);
-
- PoolVector<uint8_t>::Write write_lock;
+ static Vector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality);
+ static Ref<Image> (*lossy_unpacker)(const Vector<uint8_t> &p_buffer);
+ static Vector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image);
+ static Ref<Image> (*lossless_unpacker)(const Vector<uint8_t> &p_buffer);
+ static Vector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels);
+ static Ref<Image> (*basis_universal_unpacker)(const Vector<uint8_t> &p_buffer);
- _FORCE_INLINE_ Color _get_color_at_ofs(uint8_t *ptr, uint32_t ofs) const;
+ _FORCE_INLINE_ Color _get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const;
_FORCE_INLINE_ void _set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color);
protected:
@@ -170,12 +168,12 @@ private:
create(p_width, p_height, p_use_mipmaps, p_format);
}
- void _create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data) {
+ void _create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data) {
create(p_width, p_height, p_use_mipmaps, p_format, p_data);
}
Format format;
- PoolVector<uint8_t> data;
+ Vector<uint8_t> data;
int width, height;
bool mipmaps;
@@ -198,7 +196,7 @@ private:
void _set_data(const Dictionary &p_data);
Dictionary _get_data() const;
- Error _load_from_buffer(const PoolVector<uint8_t> &p_array, ImageMemLoadFunc p_loader);
+ Error _load_from_buffer(const Vector<uint8_t> &p_array, ImageMemLoadFunc p_loader);
static void average_4_uint8(uint8_t &p_out, const uint8_t &p_a, const uint8_t &p_b, const uint8_t &p_c, const uint8_t &p_d);
static void average_4_float(float &p_out, const float &p_a, const float &p_b, const float &p_c, const float &p_d);
@@ -270,7 +268,7 @@ public:
* Create a new image of a given size and format. Current image will be lost
*/
void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format);
- void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data);
+ void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
void create(const char **p_xpm);
/**
@@ -278,11 +276,11 @@ public:
*/
bool empty() const;
- PoolVector<uint8_t> get_data() const;
+ Vector<uint8_t> get_data() const;
Error load(const String &p_path);
Error save_png(const String &p_path) const;
- PoolVector<uint8_t> save_png_to_buffer() const;
+ Vector<uint8_t> save_png_to_buffer() const;
Error save_exr(const String &p_path, bool p_grayscale) const;
/**
@@ -296,7 +294,7 @@ public:
/**
* import an image of a specific size and format from a pointer
*/
- Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data);
+ Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
enum AlphaMode {
ALPHA_NONE,
@@ -358,9 +356,9 @@ public:
static void set_compress_bptc_func(void (*p_compress_func)(Image *, float, UsedChannels));
static String get_format_name(Format p_format);
- Error load_png_from_buffer(const PoolVector<uint8_t> &p_array);
- Error load_jpg_from_buffer(const PoolVector<uint8_t> &p_array);
- Error load_webp_from_buffer(const PoolVector<uint8_t> &p_array);
+ Error load_png_from_buffer(const Vector<uint8_t> &p_array);
+ Error load_jpg_from_buffer(const Vector<uint8_t> &p_array);
+ Error load_webp_from_buffer(const Vector<uint8_t> &p_array);
void convert_rg_to_ra_rgba8();
void convert_ra_rgba8_to_rg();
@@ -370,9 +368,6 @@ public:
virtual Ref<Resource> duplicate(bool p_subresources = false) const;
- void lock();
- void unlock();
-
UsedChannels detect_used_channels(CompressSource p_source = COMPRESS_SOURCE_GENERIC);
void optimize_channels();