transform

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package transform provides interfaces for applying transformations to images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTransformation

func RegisterTransformation(ctx context.Context, name string, f InitializeTransformationFunc) error

RegisterTransformation registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `Transformation` instances by the `NewTransformation` method.

Types

type InitializeTransformationFunc

type InitializeTransformationFunc func(context.Context, string) (Transformation, error)

TransformationInitializationFunc is a function defined by individual transformation package and used to create an instance of that transformation

type MultiTransformation

type MultiTransformation struct {
	Transformation
	// contains filtered or unexported fields
}

Type MultiTransformation implements the `Transformation` interface for applying multiple transformations to images.

func (*MultiTransformation) Transform

func (tr *MultiTransformation) Transform(ctx context.Context, im image.Image) (image.Image, error)

type NullTransformation

type NullTransformation struct {
	Transformation
}

NullTransformation is a struct that implements the `Transformation` interface that does not apply any transformations to images.

func (*NullTransformation) Transform

func (tr *NullTransformation) Transform(ctx context.Context, im image.Image) (image.Image, error)

Tranform returns 'im'.

type Transformation

type Transformation interface {
	// Transform applies a transformation to an `image.Image` instance returning a new `image.Image` instance.
	Transform(context.Context, image.Image) (image.Image, error)
}

Transformation is an interface for writing data to multiple sources or targets.

func NewMultiTransformation

func NewMultiTransformation(ctx context.Context, transformations ...Transformation) (Transformation, error)

NewMultiTransformationWithURIs returns a `MultiTransformation` instance derived from 'transformation'. Transformations are applied in the same order as instances defined in 'transformation'.

func NewMultiTransformationWithURIs

func NewMultiTransformationWithURIs(ctx context.Context, transformation_uris ...string) (Transformation, error)

NewMultiTransformationWithURIs returns a `MultiTransformation` instance derived from 'transformation_uris'. Transformations are applied in the same order as URIs defined in 'transformation_uris'.

func NewNullTransformation

func NewNullTransformation(ctx context.Context, uri string) (Transformation, error)

NewNullWriter returns a new `NullTransformation` instance. 'uri' in the form of:

null://

func NewTransformation

func NewTransformation(ctx context.Context, uri string) (Transformation, error)

NewTransformation returns a new `Transformation` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `TransformationInitializationFunc` function used to instantiate the new `Transformation`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterTransformation` method.

Jump to

Keyboard shortcuts

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