cache

package
v0.0.5-0...-0379fef Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheHash   = "hackadoll3"
	CachePrefix = "gtkcord3"
)

DO NOT TOUCH.

Variables

View Source
var (
	DirName = CachePrefix + "-" + CacheHash
	Temp    = os.TempDir()
	Path    = filepath.Join(Temp, DirName)
)
View Source
var Client = http.Client{
	Timeout: 15 * time.Second,
}

Functions

func AsyncFetch

func AsyncFetch(url string, img *gtk.Image, w, h int, pp ...Processor)

func AsyncFetchUnsafe

func AsyncFetchUnsafe(url string, img *gtk.Image, w, h int, pp ...Processor)

func GetPixbuf

func GetPixbuf(url string, pp ...Processor) (*gdk.Pixbuf, error)

func GetPixbufScaled

func GetPixbufScaled(url string, w, h int, pp ...Processor) (*gdk.Pixbuf, error)

func MaxSize

func MaxSize(w, h, maxW, maxH int) (int, int)

func ProcessAnimationStream

func ProcessAnimationStream(r io.Reader, processors []Processor) ([]byte, error)

func ProcessStream

func ProcessStream(r io.Reader, processors []Processor) ([]byte, error)

func Round

func Round(img image.Image) image.Image

func SanitizeString

func SanitizeString(str string) string

SanitizeString makes the string friendly to put into the file system. It converts anything that isn't a digit or letter into underscores.

func SetImage

func SetImage(url string, img *gtk.Image, pp ...Processor) error

func SetImageAsync

func SetImageAsync(url string, img *gtk.Image, w, h int) error

SetImageAsync is not cached.

func SetImageScaled

func SetImageScaled(url string, img *gtk.Image, w, h int, pp ...Processor) error

func SetImageScaledContext

func SetImageScaledContext(ctx context.Context,
	url string, img *gtk.Image, w, h int, pp ...Processor) error

func SizeToURL

func SizeToURL(url string, w, h int) string

func TransformURL

func TransformURL(s string) string

Types

type Processor

type Processor func(image.Image) image.Image

func Prepend

func Prepend(p1 Processor, pN []Processor) []Processor

func Resize

func Resize(maxW, maxH int) Processor

Jump to

Keyboard shortcuts

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