preview

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Canvas width
	CanvasW int
	// Canvas height
	CanvasH int
	// Opacity value for the black foreground under the title
	Opacity float64
	// Avatar diameter
	AvaD  int
	Title string
	// Title font size
	TitleSize float64
	Author    string
	// Author font size
	AuthorSize float64
	// Logo left part text (optional)
	LabelL string
	// Logo right part text (optional)
	LabelR string
	// Label font size
	LabelSize float64
	// Either an URL to a remote background image, or filename of the local image, or a HEX-color
	// An image will be thumbnailed and smart-cropped if it's not of the canvas size
	Bg string
	// An URL to an author avatar pic
	AvaURL string
	// An URL to a logo image
	LogoURL string
	// Logo height
	LogoH int
	// Resulting JPEG quality
	Quality int
}

Options defines a set of options required to draw a p.ctx.

type Preview

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

Preview can draw a preview using the provided Options.

func New

func New() *Preview

New returns an initialized Preview.

func (*Preview) Draw

func (p *Preview) Draw(ctx context.Context, opts Options) (image.Image, error)

Draw draws a preview using the provided Options.

Jump to

Keyboard shortcuts

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