1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-08 03:19:49 +00:00

if drawing over same color in index mode, check and update index as well

This commit is contained in:
Variable 2024-11-30 00:12:30 +05:00
parent 702f6d4590
commit f052902268
2 changed files with 5 additions and 2 deletions

View file

@ -30,6 +30,8 @@ class SimpleDrawer:
var color_new := op.process(Color(color_str), color_old)
if not color_new.is_equal_approx(color_old):
image.set_pixelv_custom(position, color_new)
else:
image.set_pixelv_custom(position, color_new, image.is_indexed)
class PixelPerfectDrawer:

View file

@ -139,7 +139,7 @@ func set_pixel_custom(x: int, y: int, color: Color) -> void:
## Equivalent of [method Image.set_pixelv],
## but also handles the logic necessary for indexed mode.
func set_pixelv_custom(point: Vector2i, color: Color) -> void:
func set_pixelv_custom(point: Vector2i, color: Color, index_image_only := false) -> void:
var new_color := color
if is_indexed:
var color_to_fill := TRANSPARENT
@ -170,7 +170,8 @@ func set_pixelv_custom(point: Vector2i, color: Color) -> void:
else:
indices_image.set_pixelv(point, TRANSPARENT)
new_color = TRANSPARENT
set_pixelv(point, new_color)
if not index_image_only:
set_pixelv(point, new_color)
## Finds the distance between colors [param c1] and [param c2].