render

package
v0.0.0-...-c1a64fe Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBounds

func GetBounds(ps []image.Point) image.Rectangle

GetBounds finds the bounding image.Rectangle for a set of points

func ScaleRect

func ScaleRect(toScale, bounding image.Rectangle) image.Rectangle

ScaleRect scales a rectangle to fill at least the area of some target rectangle while maintaining its original aspect ratio. If any dimension of either passed rectangle is 0 the bounding rectangle is returned. The rectangle will be scaled about the origin (image.Point{0, 0}).

Types

type BasicRenderer

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

func NewBasic

func NewBasic(opts ...BasicRendererOption) (BasicRenderer, error)

NewBasic creates and returns a new BasicRenderer that implements the Renderer interface. The renderer simply fills in regions of the layout.L with images passed to it and returns the image. If there aren't enough images, some sections of the returned image will have the default color. Note: If BasicWithInterpolationFunc is not passed as an option, the BasicRenderer will use the resize.Lanczos3 algorithm to resize images to fit the bounding rectangles.

func (*BasicRenderer) Render

func (b *BasicRenderer) Render(l *layout.Layout, ai []provider.AlbumInfo) (image.Image, error)

type BasicRendererOption

type BasicRendererOption func(b *BasicRenderer) error

BasicRendererOption allows changes to the basic renderer.

func BasicWithAspectRatioIgnored

func BasicWithAspectRatioIgnored() BasicRendererOption

BasicWithAspectRatioIgnored allows images to be scaled to fit the bounding rectangle of a layout.L region without preserving their aspect ratio. This reduces the number of calculations done at the cost of skewing images

func BasicWithInterpolationFunc

func BasicWithInterpolationFunc(intFunc resize.InterpolationFunction) BasicRendererOption

BasicWithInterpolationFunc sets the interpolation function used by the basic renderer to resize images to fit the bounding rectangle of a layout.L region

type Renderer

type Renderer interface {
	// Render draws an image with the bounding rectangle rect filled with the pattern defined in the
	// layout.L. Each L section will be filled with an image based on an entry from the
	// provider.AlbumInfo slice. If len(l) > len(ai) then some regions may be left blank. If len(ai) >
	// len(l) then not all Album Infos need to be used.
	Render(l *layout.Layout, ai []provider.AlbumInfo) (image.Image, error)
}

Renderer allows for murum image rendering

Jump to

Keyboard shortcuts

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