resolution

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolution

type Resolution struct {
	Width  int
	Height int
}

Resolution defines represents the width and height of a thumbnail.

func Parse

func Parse(s string) (Resolution, error)

Parse parses a resolution string in the form <width>x<height> and returns a resolution instance.

func (Resolution) String

func (r Resolution) String() string

String returns the resolution in the format:

<width>x<height>

type Resolutions

type Resolutions []Resolution

Resolutions represents the available thumbnail resolutions.

func New

func New(rStrs []string) (Resolutions, error)

New creates an instance of Resolutions from resolution strings.

func (Resolutions) ClosestMatch

func (r Resolutions) ClosestMatch(width, height int) Resolution

ClosestMatch returns the resolution which is closest to the provided resolution. If there is no exact match the resolution will be the next higher one. If the given resolution is bigger than all available resolutions the biggest available one is used.

Jump to

Keyboard shortcuts

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