2022-11-14 23:27:26 +01:00
|
|
|
#ifndef PAINT_NODE_H
|
|
|
|
#define PAINT_NODE_H
|
|
|
|
|
|
|
|
#include "core/math/vector2i.h"
|
|
|
|
|
|
|
|
#include "scene/2d/node_2d.h"
|
|
|
|
|
2022-11-15 23:11:55 +01:00
|
|
|
class PaintProject;
|
|
|
|
|
2022-11-14 23:27:26 +01:00
|
|
|
class PaintNode : public Node2D {
|
|
|
|
GDCLASS(PaintNode, Node2D);
|
|
|
|
|
|
|
|
public:
|
2022-11-19 13:17:30 +01:00
|
|
|
enum {
|
2022-11-19 19:26:19 +01:00
|
|
|
NOTIFICATION_PARENT_PAINT_NODE_RESIZED = 2500,
|
2022-11-19 23:12:06 +01:00
|
|
|
NOTIFICATION_PAINT_PROJECT_PRE_RENDER = 2501,
|
|
|
|
NOTIFICATION_PAINT_PROJECT_POST_RENDER = 2502,
|
2022-11-19 13:17:30 +01:00
|
|
|
};
|
|
|
|
|
2022-11-14 23:27:26 +01:00
|
|
|
Vector2i get_size();
|
|
|
|
void set_size(const Vector2i &size);
|
|
|
|
|
2022-11-19 01:23:33 +01:00
|
|
|
bool get_draw_outline();
|
|
|
|
void set_draw_outline(const bool val);
|
|
|
|
|
2022-11-19 23:12:06 +01:00
|
|
|
Ref<Image> render_image();
|
|
|
|
virtual Ref<Image> _render_image();
|
2022-11-19 13:45:14 +01:00
|
|
|
|
2022-11-19 23:12:06 +01:00
|
|
|
Ref<Image> get_rendered_image();
|
|
|
|
virtual Ref<Image> _get_rendered_image();
|
2022-11-19 13:17:30 +01:00
|
|
|
|
2022-11-19 23:12:06 +01:00
|
|
|
void render_evaluate_paint_node(PaintNode *node, Transform2D transform, Ref<Image> image);
|
|
|
|
void render_paint_node(PaintNode *node, Transform2D transform, Ref<Image> image);
|
2022-11-19 23:06:56 +01:00
|
|
|
|
2022-11-16 00:26:33 +01:00
|
|
|
PoolVector2iArray util_get_pixels_in_line(const Vector2i &from, const Vector2i &to);
|
|
|
|
|
|
|
|
int util_to_1d_v(const Vector2i &p, int w);
|
|
|
|
int util_to_1d(int x, int y, int w);
|
|
|
|
Vector2i util_to_2d(int idx, int w);
|
|
|
|
|
|
|
|
Color util_color_from_array(const PoolRealArray &color_array);
|
|
|
|
Color util_random_color();
|
|
|
|
Color util_random_color_alt();
|
|
|
|
|
2022-11-16 15:25:27 +01:00
|
|
|
bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
|
2022-11-18 23:47:05 +01:00
|
|
|
virtual bool _forward_canvas_gui_input(const Ref<InputEvent> &p_event);
|
2022-11-16 15:25:27 +01:00
|
|
|
|
2022-11-15 23:11:55 +01:00
|
|
|
PaintProject *get_paint_project();
|
2022-11-19 19:26:19 +01:00
|
|
|
PaintNode *get_parent_paint_node();
|
|
|
|
PaintNode *find_parent_paint_node();
|
2022-11-15 23:11:55 +01:00
|
|
|
|
2022-11-15 23:57:44 +01:00
|
|
|
String get_configuration_warning() const;
|
|
|
|
|
2022-11-19 19:26:19 +01:00
|
|
|
void _propagate_notification_resized();
|
2022-11-19 23:12:06 +01:00
|
|
|
void _propagate_notification_project_pre_render();
|
|
|
|
void _propagate_notification_project_post_render();
|
2022-11-19 13:17:30 +01:00
|
|
|
|
2022-11-14 23:27:26 +01:00
|
|
|
PaintNode();
|
|
|
|
~PaintNode();
|
|
|
|
|
|
|
|
protected:
|
2022-11-19 01:23:33 +01:00
|
|
|
void _notification(int p_what);
|
|
|
|
|
2022-11-14 23:27:26 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
Vector2i _size;
|
2022-11-19 01:23:33 +01:00
|
|
|
bool _draw_outline;
|
2022-11-14 23:27:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|