Added getters for the images and textures of the PaintCanvas.

This commit is contained in:
Relintai 2022-11-16 13:31:51 +01:00
parent 94da7051d4
commit afa0e83f78
2 changed files with 26 additions and 0 deletions

View File

@ -264,6 +264,20 @@ PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const in
return pixels;
}
Ref<Image> PaintCanvas::get_image() {
return _image;
}
Ref<Image> PaintCanvas::get_preview_image() {
return _preview_image;
}
Ref<ImageTexture> PaintCanvas::get_image_texture() {
return _image_texture;
}
Ref<ImageTexture> PaintCanvas::get_preview_image_texture() {
return _preview_image_texture;
}
PaintCanvas::PaintCanvas() {
_symmetry_x = false;
_symmetry_y = false;
@ -328,4 +342,10 @@ void PaintCanvas::_bind_methods() {
ClassDB::bind_method(D_METHOD("select_color", "x", "y"), &PaintCanvas::select_color);
ClassDB::bind_method(D_METHOD("select_same_color", "x", "y"), &PaintCanvas::select_same_color);
ClassDB::bind_method(D_METHOD("get_neighbouring_pixels", "x", "y"), &PaintCanvas::get_neighbouring_pixels);
ClassDB::bind_method(D_METHOD("get_image"), &PaintCanvas::get_image);
ClassDB::bind_method(D_METHOD("get_preview_image"), &PaintCanvas::get_preview_image);
ClassDB::bind_method(D_METHOD("get_image_texture"), &PaintCanvas::get_image_texture);
ClassDB::bind_method(D_METHOD("get_preview_image_texture"), &PaintCanvas::get_preview_image_texture);
}

View File

@ -50,6 +50,12 @@ public:
PoolVector2iArray select_same_color(const int p_x, const int p_y);
PoolVector2iArray get_neighbouring_pixels(const int pos_x, const int pos_y);
Ref<Image> get_image();
Ref<Image> get_preview_image();
Ref<ImageTexture> get_image_texture();
Ref<ImageTexture> get_preview_image_texture();
PaintCanvas();
~PaintCanvas();