content

package
v0.0.0-...-3a06bfb Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content interface {
	GetHash() (ref.FileHash, error)
	BytesReader() (*bytes.Reader, error)
	Sizer
}

func New

func New(opts ...ContentOption) Content

type ContentOption

type ContentOption func(*content)

func WithBytes

func WithBytes(buf []byte) ContentOption

func WithFilePath

func WithFilePath(fp string) ContentOption

func WithHash

func WithHash(hash ref.FileHash) ContentOption

func WithLoadFunc

func WithLoadFunc(f loadFunc) ContentOption

func WithLoader

func WithLoader(l Loader) ContentOption

func WithPos

func WithPos(pos pos.P) ContentOption

func WithSizer

func WithSizer(s Sizer) ContentOption

type Image

type Image struct {
	Image image.Image

	SourceFormat string
}

type ImageContent

type ImageContent interface {
	Content
	Image() (Image, error)
}

func AsImage

func AsImage(ic Content) ImageContent

func NewImage

func NewImage(image Image) ImageContent

type LoadSizer

type LoadSizer interface {
	Loader
	Sizer
}

func FromFile

func FromFile(filepath string) LoadSizer

type Loader

type Loader interface {
	Load(w io.Writer) error
}

type Size

type Size int64
const IllegalSize Size = -1

func (Size) FmtHumanize

func (s Size) FmtHumanize() string

func (Size) FmtString

func (s Size) FmtString() string

type Sizer

type Sizer interface {
	Size() (Size, error)
}

Jump to

Keyboard shortcuts

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