I ran into this today trying to make a texture that was just a background fill color, with another texture drawn on top of it.
What I would really like, is some way to use the standard draw_ functions (like draw_circle()) on Images
As someone who used Gamemaker until last year, not being able to do this can sting sometimes
Here is the code I ended up going with
var working_image := Image.create_empty(dimensions.x,dimensions.y,false,Image.FORMAT_RGBA8)
var fill_color:Color
if from.mobility:
fill_color=mobility_color
else:
fill_color=offense_color
working_image.fill(fill_color)
var og_image:=from.graphic.get_image()
#why
for x in dimensions.x:
for y in dimensions.y:
var old_color:Color = working_image.get_pixel(x,y)
var new_color:Color = og_image.get_pixel(x,y)
working_image.set_pixel(x,y,old_color.blend(new_color))
var final_texture := ImageTexture.create_from_image(working_image)
It works fine, but it seems likely less efficient than a draw_texture() call could be
if I wanted something very much more complicated, I think I would be forced to code my own implementation of stuff like draw_circle, draw_texture, and so on)
I know one can use viewports, but I really want something that doesn't involve messing with the scene tree and can be down very quickly on the main thread in code, such that I could assign the generated texture on the next line
If anyone knows a good way to do this, or wants further discussion or clarification, please at me