images

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Overview

Fetch and decode images in range various formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache map[string]Image

Cache stores the result of fetching an image.

func NewCache

func NewCache() Cache

type Color

type Color = parser.RGBA

type Image

type Image interface {
	backend.Image
	// contains filtered or unexported methods
}

Image is the common interface for supported image formats, such as gradients, SVG, or JPEG, PNG, etc...

func GetImageFromUri

func GetImageFromUri(cache Cache, fetcher utils.UrlFetcher, optimizeSize bool, url, forcedMimeType string, orientation pr.SBoolFloat) Image

Gets an image from an image URI. In case of an error, a log is printed and nil is returned

type LinearGradient

type LinearGradient struct {
	// contains filtered or unexported fields
}

func NewLinearGradient

func NewLinearGradient(from pr.LinearGradient) LinearGradient

func (LinearGradient) Draw

func (g LinearGradient) Draw(dst backend.Canvas, _ text.TextLayoutContext, concreteWidth, concreteHeight pr.Fl, _ string)

func (LinearGradient) GetIntrinsicSize

func (g LinearGradient) GetIntrinsicSize(_, _ pr.Float) (pr.MaybeFloat, pr.MaybeFloat, pr.MaybeFloat)

func (LinearGradient) Layout

func (lg LinearGradient) Layout(width, height pr.Float) backend.GradientLayout

type RadialGradient

type RadialGradient struct {
	// contains filtered or unexported fields
}

func NewRadialGradient

func NewRadialGradient(from pr.RadialGradient) RadialGradient

func (RadialGradient) Draw

func (g RadialGradient) Draw(dst backend.Canvas, _ text.TextLayoutContext, concreteWidth, concreteHeight pr.Fl, _ string)

func (RadialGradient) GetIntrinsicSize

func (g RadialGradient) GetIntrinsicSize(_, _ pr.Float) (pr.MaybeFloat, pr.MaybeFloat, pr.MaybeFloat)

func (RadialGradient) Layout

func (rg RadialGradient) Layout(width, height pr.Float) backend.GradientLayout

type SVGImage

type SVGImage struct {
	// contains filtered or unexported fields
}

func NewSVGImage

func NewSVGImage(svgData io.Reader, baseURL string, urlFetcher utils.UrlFetcher) (SVGImage, error)

func NewSVGImageFromNode added in v0.0.2

func NewSVGImageFromNode(node *html.Node, baseURL string, urlFetcher utils.UrlFetcher) (SVGImage, error)

func (SVGImage) Draw

func (img SVGImage) Draw(dst backend.Canvas, textContext text.TextLayoutContext, concreteWidth, concreteHeight pr.Fl, imageRendering string)

func (SVGImage) GetIntrinsicSize

func (s SVGImage) GetIntrinsicSize(_, fontSize pr.Float) (pr.MaybeFloat, pr.MaybeFloat, pr.MaybeFloat)

Jump to

Keyboard shortcuts

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