From d0f9fe2ac5902bb18c09ba25532023254c2f433e Mon Sep 17 00:00:00 2001
From: kleonc <9283098+kleonc@users.noreply.github.com>
Date: Sun, 4 Feb 2024 02:30:43 +0100
Subject: [PATCH] [3.x] Document some Image methods can unlock it (making
`set_pixel` fail)
---
doc/classes/Image.xml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index b7344a343bd..1115934f991 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -385,6 +385,13 @@
img.unlock()
img.set_pixel(x, y, color) # Does not have an effect
[/codeblock]
+ [b]Note:[/b] Some image methods can leave the image unlocked, making subsequent [method set_pixel] calls fail unless the image is locked again. Methods potentially unlocking the image: [method blend_rect], [method blend_rect_mask], [method blit_rect_mask], [method convert], [method fill], [method fill_rect], [method get_used_rect], and [method rgbe_to_srgb].
+ [codeblock]
+ img.lock()
+ img.set_pixel(x, y, color) # Works
+ img.fill(color) # Unlocks the image
+ img.set_pixel(x, y, color) # Does not have an effect
+ [/codeblock]
@@ -401,6 +408,13 @@
img.unlock()
img.set_pixelv(Vector2(x, y), color) # Does not have an effect
[/codeblock]
+ [b]Note:[/b] Some image methods can leave the image unlocked, making subsequent [method set_pixelv] calls fail unless the image is locked again. Methods potentially unlocking the image: [method blend_rect], [method blend_rect_mask], [method blit_rect_mask], [method convert], [method fill], [method fill_rect], [method get_used_rect], and [method rgbe_to_srgb].
+ [codeblock]
+ img.lock()
+ img.set_pixelv(Vector2(x, y), color) # Works
+ img.fill(dcolor) # Unlocks the image
+ img.set_pixelv(Vector2(x, y), color) # Does not have an effect
+ [/codeblock]