Skip to content

Translucency and images with Alpha channel #1977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tehsphinx opened this issue Feb 19, 2021 · 12 comments
Closed

Translucency and images with Alpha channel #1977

tehsphinx opened this issue Feb 19, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@tehsphinx
Copy link
Contributor

tehsphinx commented Feb 19, 2021

Describe the bug:

When applying Translucency to an image with an alpha channel, the otherwise transparent part of the image becomes visible. Below example uses one of the default icons to show the effect.

To Reproduce:

Steps to reproduce the behaviour:

  1. Run the go code below. go run .

Screenshots:

image

Note: The background of the icon should not be darkened.

Example code:

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/theme"
)

func main() {
	a := app.New()

	w := a.NewWindow("Test App")
	image := canvas.NewImageFromResource(theme.ConfirmIcon())
	image.Translucency = 0.5
	w.SetContent(container.NewPadded(image))
	w.Resize(fyne.Size{
		Width:  100,
		Height: 100,
	})

	w.ShowAndRun()
}

Device (please complete the following information):

  • MacOS
  • Big Sur 11.2.1
  • go version go1.16 darwin/amd64
  • fyne/v2 2.0.0
@tehsphinx tehsphinx added the bug Something isn't working label Feb 19, 2021
@tehsphinx
Copy link
Contributor Author

Might not be that important...

@AlbinoGeek
Copy link
Contributor

Thank you for bringing this to attention, I wasn't sure if I'd simply done something wrong (could not reproduce cleanly.)

@andydotxyz
Copy link
Member

Yes, thanks. We currently support an alpha channel or a translucency value but not both.
This should be fixed.

@junmaqiang
Copy link

me too I have this ask

@junmaqiang
Copy link

this is bug?

img := canvas.NewImageFromResource(theme.VisibilityOffIcon()) img.FillMode = canvas.ImageFillContain img.SetMinSize(fyne.NewSize(237, 237)) img.Translucency = 0.5

截屏2023-09-10 14 05 22

@andydotxyz
Copy link
Member

Yes

@hkparker
Copy link
Contributor

hkparker commented Dec 3, 2024

Running into this now as well. How difficult would it be to address this?

@andydotxyz
Copy link
Member

I think the error is in the GL shader - so not an easy fix as far as I can estimate.
However there is a possibility that it relates to colour models in the SVG rasteriser

@hkparker
Copy link
Contributor

hkparker commented Dec 4, 2024

Ah, in this case I was using a PNG, so it wouldn't be in any SVG specific code I expect

@andydotxyz
Copy link
Member

Oh it was missing from software renderer (I have fixed that locally) so yes looks like a GL issue

@andydotxyz andydotxyz mentioned this issue Dec 4, 2024
3 tasks
@andydotxyz
Copy link
Member

Thanks for the prod. I finally found the solution 🎉

@andydotxyz
Copy link
Member

This is landed on develop and in the v2.5.3-rc3 that we are testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants