summaryrefslogtreecommitdiff
path: root/core/image.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/image.h')
-rw-r--r--core/image.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/core/image.h b/core/image.h
index 8c4854e053..6af55ca8d9 100644
--- a/core/image.h
+++ b/core/image.h
@@ -33,7 +33,7 @@
#include "color.h"
#include "dvector.h"
-#include "math_2d.h"
+#include "rect2.h"
#include "resource.h"
/**
@@ -116,7 +116,8 @@ public:
enum CompressSource {
COMPRESS_SOURCE_GENERIC,
COMPRESS_SOURCE_SRGB,
- COMPRESS_SOURCE_NORMAL
+ COMPRESS_SOURCE_NORMAL,
+ COMPRESS_SOURCE_LAYERED,
};
//some functions provided by something else
@@ -125,7 +126,8 @@ public:
static ImageMemLoadFunc _jpg_mem_loader_func;
static ImageMemLoadFunc _webp_mem_loader_func;
- static void (*_image_compress_bc_func)(Image *, CompressSource p_source);
+ static void (*_image_compress_bc_func)(Image *, float, CompressSource p_source);
+ static void (*_image_compress_bptc_func)(Image *, float p_lossy_quality, CompressSource p_source);
static void (*_image_compress_pvrtc2_func)(Image *);
static void (*_image_compress_pvrtc4_func)(Image *);
static void (*_image_compress_etc1_func)(Image *, float);
@@ -133,6 +135,7 @@ public:
static void (*_image_decompress_pvrtc)(Image *);
static void (*_image_decompress_bc)(Image *);
+ static void (*_image_decompress_bptc)(Image *);
static void (*_image_decompress_etc1)(Image *);
static void (*_image_decompress_etc2)(Image *);
@@ -181,6 +184,15 @@ private:
Error _load_from_buffer(const PoolVector<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);
+ static void average_4_half(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
+ static void average_4_rgbe9995(uint32_t &p_out, const uint32_t &p_a, const uint32_t &p_b, const uint32_t &p_c, const uint32_t &p_d);
+ static void renormalize_uint8(uint8_t *p_rgb);
+ static void renormalize_float(float *p_rgb);
+ static void renormalize_half(uint16_t *p_rgb);
+ static void renormalize_rgbe9995(uint32_t *p_rgb);
+
public:
int get_width() const; ///< Get image width
int get_height() const; ///< Get image height
@@ -272,7 +284,7 @@ public:
static int get_format_block_size(Format p_format);
static void get_format_min_pixel_size(Format p_format, int &r_w, int &r_h);
- static int get_image_data_size(int p_width, int p_height, Format p_format, int p_mipmaps = 0);
+ static int get_image_data_size(int p_width, int p_height, Format p_format, bool p_mipmaps = false);
static int get_image_required_mipmaps(int p_width, int p_height, Format p_format);
enum CompressMode {
@@ -281,6 +293,7 @@ public:
COMPRESS_PVRTC4,
COMPRESS_ETC,
COMPRESS_ETC2,
+ COMPRESS_BPTC
};
Error compress(CompressMode p_mode = COMPRESS_S3TC, CompressSource p_source = COMPRESS_SOURCE_GENERIC, float p_lossy_quality = 0.7);
@@ -303,7 +316,8 @@ public:
Rect2 get_used_rect() const;
Ref<Image> get_rect(const Rect2 &p_area) const;
- static void set_compress_bc_func(void (*p_compress_func)(Image *, CompressSource));
+ static void set_compress_bc_func(void (*p_compress_func)(Image *, float, CompressSource));
+ static void set_compress_bptc_func(void (*p_compress_func)(Image *, float, CompressSource));
static String get_format_name(Format p_format);
Error load_png_from_buffer(const PoolVector<uint8_t> &p_array);
@@ -329,6 +343,7 @@ public:
};
DetectChannels get_detected_channels();
+ void optimize_channels();
Color get_pixelv(const Point2 &p_src) const;
Color get_pixel(int p_x, int p_y) const;