fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design

Home Page:https://fyne.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with SetSystemTrayIcon when using jpg format

aynakeya opened this issue · comments

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

when setting a system tray icon using a JPG image, the color rendering is incorrect.

The same operation works as expected with PNG images.

Expected:
image

Png file

image

Jpg file.

image

How to reproduce

run example code

Screenshots

No response

Example code

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/driver/desktop"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("SysTray")

	//icon, _ := fyne.LoadResourceFromPath("./assets/icon.jpg")
	icon, _ := fyne.LoadResourceFromPath("./assets/icon.png")

	if desk, ok := a.(desktop.App); ok {
		m := fyne.NewMenu("MyApp",
			fyne.NewMenuItem("Show", func() {
				w.Show()
			}))
		desk.SetSystemTrayMenu(m)
		desk.SetSystemTrayIcon(icon)
	}

	w.SetContent(widget.NewLabel("Fyne System Tray"))
	w.SetCloseIntercept(func() {
		w.Hide()
	})
	w.ShowAndRun()
}

Fyne version

2.4.4

Go compiler version

1.20

Operating system and version

Kubuntu 22.04

Additional Information

seems like green and red were swapped for jpg image

if i swap green and red in argbForImage.

image

the result looks like this.

image