Adding logo to screenshots in GODOT

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Suraj Hande

Hi!
I am trying out a feature for my 2D game where the users are shown a screenshot of their playthrough after the level is finished or on the game over screen.

I am capturing the texture from the viewport with…

get_viewport().set_clear_mode(old_clear_mode)

However, I am struggling to understand how I would go about adding a logo to the texture.

How would I go about doing this?

FYI the function that is taking the screenshot:

func capture_screen():
get_viewport().set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME)
	# Wait until the frame has finished before getting the texture.
	yield(VisualServer, "frame_post_draw")

	# Retrieve the captured image.
	img = get_viewport().get_texture().get_data()

	# Flip it on the y-axis (because it's flipped).
	img.flip_y()

	captured = true

Capture with your logo in form of Sprite/TextureRect on top of your scene?

sash-rc | 2021-08-20 07:45

:bust_in_silhouette: Reply From: klaas

Hi.
just use

blit_rect ( Image src, Rect2 src_rect, Vector2 dst )
# Retrieve the captured image.
img = get_viewport().get_texture().get_data()
# Flip it on the y-axis (because it's flipped).
img.flip_y()
img.blit_rect( my_logo_image, my_logo_image.get_used_rect( ) , Vector2(10,10) )