Fyne API "fyne.StaticResource"

fyne.StaticResource


import "fyne.io/fyne"

Usage

type StaticResource

type StaticResource struct {
	StaticName    string
	StaticContent []byte
}

StaticResource is a bundled resource compiled into the application. These resources are normally generated by the fyne_bundle command included in the Fyne toolkit.

func NewStaticResource

func NewStaticResource(name string, content []byte) *StaticResource

NewStaticResource returns a new static resource object with the specified name and content. Creating a new static resource in memory results in sharable binary data that may be serialised to the location returned by CachePath().

func (*StaticResource) Content

func (r *StaticResource) Content() []byte

Content returns the bytes of the bundled resource, no compression is applied but any compression on the resource is retained.

func (*StaticResource) GoString

func (r *StaticResource) GoString() string

GoString converts a Resource object to Go code. This is useful if serialising to a Go file for compilation into a binary.

func (*StaticResource) Name

func (r *StaticResource) Name() string

Name returns the unique name of this resource, usually matching the file it was generated from.