cache

package
v2.5.3-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoTexture = TextureType(0)

NoTexture used when there is no valid texture

Functions

func Clean added in v2.1.0

func Clean(canvasRefreshed bool)

Clean run cache clean task, it should be called on paint events.

func CleanCanvas added in v2.1.0

func CleanCanvas(canvas fyne.Canvas)

CleanCanvas performs a complete remove of all the objects that belong to the specified canvas. Usually used to free all objects from a closing windows.

func CleanCanvases added in v2.1.1

func CleanCanvases(refreshingCanvases []fyne.Canvas)

CleanCanvases runs cache clean tasks for canvases that are being refreshed. This is called on paint events.

func DeleteTexture added in v2.1.0

func DeleteTexture(obj fyne.CanvasObject)

DeleteTexture deletes the texture from the cache map.

func DestroyRenderer

func DestroyRenderer(wid fyne.Widget)

DestroyRenderer frees a render implementation for a widget. This is typically for internal use only.

func GetCanvasForObject added in v2.1.0

func GetCanvasForObject(obj fyne.CanvasObject) fyne.Canvas

GetCanvasForObject returns the canvas for the specified object.

func GetFontMetrics added in v2.1.0

func GetFontMetrics(text string, fontSize float32, style fyne.TextStyle, source fyne.Resource) (size fyne.Size, base float32)

GetFontMetrics looks up a calculated size and baseline required for the specified text parameters.

func GetSvg added in v2.1.0

func GetSvg(name string, o fyne.CanvasObject, w int, h int) *image.NRGBA

GetSvg gets svg image from cache if it exists.

func IsRendered

func IsRendered(wid fyne.Widget) bool

IsRendered returns true of the widget currently has a renderer. One will be created the first time a widget is shown but may be removed after it is hidden.

func IsValid added in v2.2.0

func IsValid(texture TextureType) bool

IsValid will return true if the passed texture is potentially a texture

func OverrideTheme added in v2.5.0

func OverrideTheme(o fyne.CanvasObject, th fyne.Theme)

OverrideTheme allows an app to specify that a single object should use a different theme to the app. This should be used sparingly to avoid a jarring user experience. If the object is a container it will theme the children, if it is a canvas primitive it will do nothing.

Since: 2.5

func OverrideThemeMatchingScope added in v2.5.0

func OverrideThemeMatchingScope(o, parent fyne.CanvasObject) bool

func RangeExpiredTexturesFor added in v2.1.0

func RangeExpiredTexturesFor(canvas fyne.Canvas, f func(fyne.CanvasObject))

RangeExpiredTexturesFor range over the expired textures for the specified canvas.

Note: If this is used to free textures, then it should be called inside a current gl context to ensure textures are deleted from gl.

func RangeTexturesFor added in v2.1.0

func RangeTexturesFor(canvas fyne.Canvas, f func(fyne.CanvasObject))

RangeTexturesFor range over the textures for the specified canvas. It will not return the texture for a `canvas.Text` as their render lifecycle is handled separately.

Note: If this is used to free textures, then it should be called inside a current gl context to ensure textures are deleted from gl.

func Renderer

func Renderer(wid fyne.Widget) fyne.WidgetRenderer

Renderer looks up the render implementation for a widget

func ResetThemeCaches added in v2.1.0

func ResetThemeCaches()

ResetThemeCaches clears all the svg and text size cache maps

func SetCanvasForObject added in v2.1.0

func SetCanvasForObject(obj fyne.CanvasObject, c fyne.Canvas, setup func())

SetCanvasForObject sets the canvas for the specified object. The passed function will be called if the item was not previously attached to this canvas

func SetFontMetrics added in v2.1.0

func SetFontMetrics(text string, fontSize float32, style fyne.TextStyle, source fyne.Resource, size fyne.Size, base float32)

SetFontMetrics stores a calculated font size and baseline for parameters that were missing from the cache.

func SetSvg added in v2.1.0

func SetSvg(name string, o fyne.CanvasObject, pix *image.NRGBA, w int, h int)

SetSvg sets a svg into the cache map.

func SetTextTexture added in v2.5.3

func SetTextTexture(ent FontCacheEntry, texture TextureType, canvas fyne.Canvas, free func())

SetTextTexture sets cached texture for a text run.

func SetTexture added in v2.1.0

func SetTexture(obj fyne.CanvasObject, texture TextureType, canvas fyne.Canvas)

SetTexture sets cached texture.

func WidgetScopeID added in v2.5.0

func WidgetScopeID(o fyne.CanvasObject) string

func WidgetTheme added in v2.5.0

func WidgetTheme(o fyne.CanvasObject) fyne.Theme

Types

type FontCacheEntry added in v2.5.3

type FontCacheEntry struct {
	Canvas fyne.Canvas
	Color  color.Color
	// contains filtered or unexported fields
}

type TextureType added in v2.1.0

type TextureType = uint32

TextureType represents an uploaded GL texture

func GetTextTexture added in v2.5.3

func GetTextTexture(ent FontCacheEntry) (TextureType, bool)

GetTextTexture gets cached texture for a text run.

func GetTexture added in v2.1.0

func GetTexture(obj fyne.CanvasObject) (TextureType, bool)

GetTexture gets cached texture.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL