Painting on canvas

Godot Version

Godot 3.5.3

Question

How and where can you draw?
for example in OpenGL we clear the buffer using glClearColor, apply color, and draw something, and perhaps use glBlendFunc, is there a similar alternative in godot, I want to make a sprite editor

basically this func _draw(): on any node2d and control nodes

I won’t be able to save everything drawn this way, I need some kind of canvas/buffer on which each frame will be saved into a texture, and if necessary it can be cleared.

in game maker it’s called a “surface”

then you can use something like Screen Capture Demo - Godot Asset Library
to capture the image and even save it to your local storage

this one show how to save it to png

oh, this is not very convenient, drawing the same lines would have to be developed from scratch using set_pixel, you need something so that you can use the same functions as in _draw, for example draw_circle, if only they would be inserted into the texture or canvas.

I need a surface like the one in the video, in this engine, since it draws with a dot, you can draw with anything, sprites, lines, etc.

I wrote a demo of what I needed on an old game maker:

I found a solution by creating a viewport, making it never cleared and the result is the same as on the game maker.