mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Fix cel copying not working with indexed mode
This commit is contained in:
parent
e6c4a72158
commit
b87a8e2ab8
|
@ -8,7 +8,7 @@ var image: ImageExtended:
|
||||||
set = image_changed
|
set = image_changed
|
||||||
|
|
||||||
|
|
||||||
func _init(_image: ImageExtended, _opacity := 1.0) -> void:
|
func _init(_image := ImageExtended.new(), _opacity := 1.0) -> void:
|
||||||
image_texture = ImageTexture.new()
|
image_texture = ImageTexture.new()
|
||||||
image = _image # Set image and call setter
|
image = _image # Set image and call setter
|
||||||
opacity = _opacity
|
opacity = _opacity
|
||||||
|
@ -20,7 +20,7 @@ func image_changed(value: ImageExtended) -> void:
|
||||||
image_texture.set_image(image)
|
image_texture.set_image(image)
|
||||||
|
|
||||||
|
|
||||||
func get_content():
|
func get_content() -> ImageExtended:
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,17 +34,19 @@ func set_content(content, texture: ImageTexture = null) -> void:
|
||||||
image_texture.update(image)
|
image_texture.update(image)
|
||||||
|
|
||||||
|
|
||||||
func create_empty_content():
|
func create_empty_content() -> ImageExtended:
|
||||||
var empty_image := Image.create(
|
var empty := Image.create(image.get_width(), image.get_height(), false, image.get_format())
|
||||||
image.get_size().x, image.get_size().y, false, Image.FORMAT_RGBA8
|
var new_image := ImageExtended.new()
|
||||||
)
|
new_image.copy_from_custom(empty, image.is_indexed)
|
||||||
return empty_image
|
return new_image
|
||||||
|
|
||||||
|
|
||||||
func copy_content():
|
func copy_content() -> ImageExtended:
|
||||||
var copy_image := Image.create_from_data(
|
var tmp_image := Image.create_from_data(
|
||||||
image.get_width(), image.get_height(), false, Image.FORMAT_RGBA8, image.get_data()
|
image.get_width(), image.get_height(), false, image.get_format(), image.get_data()
|
||||||
)
|
)
|
||||||
|
var copy_image := ImageExtended.new()
|
||||||
|
copy_image.copy_from_custom(tmp_image, image.is_indexed)
|
||||||
return copy_image
|
return copy_image
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue