mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Export palettes as images on the Web version
This commit is contained in:
parent
802c06cd6b
commit
8333b93664
|
@ -89,6 +89,9 @@ func _on_EditPaletteDialog_custom_action(action: String) -> void:
|
||||||
if action == DELETE_ACTION:
|
if action == DELETE_ACTION:
|
||||||
delete_confirmation.popup_centered()
|
delete_confirmation.popup_centered()
|
||||||
elif action == EXPORT_ACTION:
|
elif action == EXPORT_ACTION:
|
||||||
|
if OS.get_name() == "HTML5":
|
||||||
|
emit_signal("exported")
|
||||||
|
else:
|
||||||
export_file_dialog.popup_centered()
|
export_file_dialog.popup_centered()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,9 +225,15 @@ func _color_changed(_color: Color, button: int) -> void:
|
||||||
palette_grid.unselect_swatch(button, swatch_to_unselect)
|
palette_grid.unselect_swatch(button, swatch_to_unselect)
|
||||||
|
|
||||||
|
|
||||||
func _on_EditPaletteDialog_exported(path: String) -> void:
|
func _on_EditPaletteDialog_exported(path := "") -> void:
|
||||||
|
var image: Image = Palettes.current_palette.convert_to_image()
|
||||||
|
if OS.get_name() == "HTML5":
|
||||||
|
JavaScript.download_buffer(
|
||||||
|
image.save_png_to_buffer(), Palettes.current_palette.name, "image/png"
|
||||||
|
)
|
||||||
|
if path.empty():
|
||||||
|
return
|
||||||
var extension := path.get_extension()
|
var extension := path.get_extension()
|
||||||
match extension:
|
match extension:
|
||||||
"png":
|
"png":
|
||||||
var image: Image = Palettes.current_palette.convert_to_image()
|
|
||||||
image.save_png(path)
|
image.save_png(path)
|
||||||
|
|
Loading…
Reference in a new issue