diff options
Diffstat (limited to 'game/addons/zylann.hterrain/native/src/image_utils.h')
-rw-r--r-- | game/addons/zylann.hterrain/native/src/image_utils.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/game/addons/zylann.hterrain/native/src/image_utils.h b/game/addons/zylann.hterrain/native/src/image_utils.h new file mode 100644 index 0000000..5cbe399 --- /dev/null +++ b/game/addons/zylann.hterrain/native/src/image_utils.h @@ -0,0 +1,38 @@ +#ifndef IMAGE_UTILS_H +#define IMAGE_UTILS_H + +#include <core/Godot.hpp> +#include <gen/Image.hpp> +#include <gen/Reference.hpp> +#include <vector> + +namespace godot { + +class ImageUtils : public Reference { + GODOT_CLASS(ImageUtils, Reference) +public: + static void _register_methods(); + + ImageUtils(); + ~ImageUtils(); + + void _init(); + + Vector2 get_red_range(Ref<Image> image_ref, Rect2 rect) const; + float get_red_sum(Ref<Image> image_ref, Rect2 rect) const; + float get_red_sum_weighted(Ref<Image> image_ref, Ref<Image> brush_ref, Vector2 p_pos, float factor) const; + void add_red_brush(Ref<Image> image_ref, Ref<Image> brush_ref, Vector2 p_pos, float factor) const; + void lerp_channel_brush(Ref<Image> image_ref, Ref<Image> brush_ref, Vector2 p_pos, float factor, float target_value, int channel) const; + void lerp_color_brush(Ref<Image> image_ref, Ref<Image> brush_ref, Vector2 p_pos, float factor, Color target_value) const; + float generate_gaussian_brush(Ref<Image> image_ref) const; + void blur_red_brush(Ref<Image> image_ref, Ref<Image> brush_ref, Vector2 p_pos, float factor); + void paint_indexed_splat(Ref<Image> index_map_ref, Ref<Image> weight_map_ref, Ref<Image> brush_ref, Vector2 p_pos, int texture_index, float factor); + //void erode_red_brush(Ref<Image> image_ref, Ref<Image> brush_ref, Vector2 p_pos, float factor); + +private: + std::vector<float> _blur_buffer; +}; + +} // namespace godot + +#endif // IMAGE_UTILS_H |