Pass blurred image directly to texture (#307)
Instead of saving the blurred image into a temporary file and then read it back, pass it direcly to texture via a buffer.
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
from io import BytesIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@@ -83,10 +84,11 @@ class GameCover:
|
|||||||
.filter(ImageFilter.GaussianBlur(20))
|
.filter(ImageFilter.GaussianBlur(20))
|
||||||
)
|
)
|
||||||
|
|
||||||
tmp_path = Gio.File.new_tmp(None)[0].get_path()
|
buffer = BytesIO()
|
||||||
image.save(tmp_path, "tiff", compression=None)
|
image.save(buffer, "tiff", compression=None)
|
||||||
|
gbytes = GLib.Bytes.new(buffer.getvalue())
|
||||||
|
|
||||||
self.blurred = Gdk.Texture.new_from_filename(tmp_path)
|
self.blurred = Gdk.Texture.new_from_bytes(gbytes)
|
||||||
|
|
||||||
stat = ImageStat.Stat(image.convert("L"))
|
stat = ImageStat.Stat(image.convert("L"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user