Fix layout icone en-tete: redimensionnement 24x24 avant affichage

Changements :
- Redimensionnement de l'icone PNG a 24x24 via CatmullRom (golang.org/x/image/draw)
- Corrige le decalage de l'interface cause par l'image 912x1164

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 12:51:04 +01:00
parent 3ffbb550ec
commit 2b2eb87f45
4 changed files with 12 additions and 4 deletions

11
gui.go
View File

@@ -4,6 +4,7 @@ import (
"bytes"
_ "embed"
"fmt"
"image"
"image/png"
"os"
"os/exec"
@@ -15,6 +16,7 @@ import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
xdraw "golang.org/x/image/draw"
)
//go:embed icon.png
@@ -253,7 +255,7 @@ func (a *App) buildAndRun() error {
AssignTo: &a.iconView,
MinSize: Size{Width: 24, Height: 24},
MaxSize: Size{Width: 24, Height: 24},
Mode: ImageViewModeShrink,
Mode: ImageViewModeIdeal,
},
Label{
Text: "Git Update Checker v" + VERSION,
@@ -342,11 +344,14 @@ func (a *App) buildAndRun() error {
}
}
// Icône dans l'en-tête (depuis PNG embarqué dans l'exe)
// Icône dans l'en-tête (depuis PNG embarqué dans l'exe, redimensionné 24x24)
if img, err := png.Decode(bytes.NewReader(iconPNG)); err != nil {
logWarn("Icône PNG: décodage échoué: " + err.Error())
} else {
bmp, err := walk.NewBitmapFromImageForDPI(img, 96)
const iconSize = 24
dst := image.NewRGBA(image.Rect(0, 0, iconSize, iconSize))
xdraw.CatmullRom.Scale(dst, dst.Bounds(), img, img.Bounds(), xdraw.Over, nil)
bmp, err := walk.NewBitmapFromImageForDPI(dst, 96)
if err != nil {
logWarn("Icône PNG: bitmap échoué: " + err.Error())
} else {