From e58a43386dc3f4ee6fadde165fecf85f0d30cc62 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Mon, 1 Sep 2025 15:30:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20imlib2=20=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=9B=BE=E7=89=87=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/image.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/renderer/image.c b/src/renderer/image.c index a4db5a7..51b4708 100644 --- a/src/renderer/image.c +++ b/src/renderer/image.c @@ -25,11 +25,10 @@ uint32_t *generate_wallpaper(const wallpaper_config_t *wallpaper_config, if (!final_image) return NULL; imlib_context_set_image(final_image); - imlib_image_set_has_alpha(false); + imlib_image_set_has_alpha(true); - /* 填充背景色 */ - imlib_context_set_color(0, 0, 0, 255); - imlib_image_fill_rectangle(0, 0, screen_width, screen_height); + /* 重置像素数据 */ + imlib_image_clear(); const monitor_t *monitor = monitors; uint32_t monitor_index = 0; @@ -118,9 +117,8 @@ uint32_t *generate_icon_pixels(const char *image_path, uint32_t width, Imlib_Image target_img = imlib_create_image(width, height); imlib_context_set_image(target_img); - imlib_image_set_has_alpha(false); - imlib_context_set_color(0, 0, 0, 255); - imlib_image_fill_rectangle(0, 0, width, height); + imlib_image_set_has_alpha(true); + imlib_image_clear(); imlib_blend_image_onto_image(img, 1, src_x, src_y, src_width, src_height, padding, padding, dst_width, dst_height);