Image Translucency – Fyne Golang GUI Tutorial 77

This is fyne series tutorial.

in this tutorial, we are going to learn about translucency in fyne , Golang GUI.

To declear image we normally use :


img := canvas.NewImageFromFile("bg.jpg")

To modify translucency we can use values from 0 to 0.9


img.Translucency = 0.9 // you can use 0 to 0.99

package main

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

func main() {
	// new app
	a := app.New()
	// new window
	w := a.NewWindow("Image Translucency-Alpha")
	w.Resize(fyne.NewSize(400, 400))
	img := canvas.NewImageFromFile("bg.jpg")
	img.Translucency = 0.9 // you can use 0.1 to 0.99
	// set content
	w.SetContent(img) // we will create image variable
	w.ShowAndRun()
}
[easy_media_download url=”http://blogvali.com/wp-content/uploads/fyne-golang-downloads/main13.go” text=”Download Code” color=”red_darker”]

Fyne GoLang GUI Course

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: