Documentation
¶
Overview ¶
Package transform provides interfaces for applying transformations to images.
Index ¶
- func RegisterTransformation(ctx context.Context, name string, f InitializeTransformationFunc) error
- type InitializeTransformationFunc
- type MultiTransformation
- type NullTransformation
- type Transformation
- func NewMultiTransformation(ctx context.Context, transformations ...Transformation) (Transformation, error)
- func NewMultiTransformationWithURIs(ctx context.Context, transformation_uris ...string) (Transformation, error)
- func NewNullTransformation(ctx context.Context, uri string) (Transformation, error)
- func NewTransformation(ctx context.Context, uri string) (Transformation, error)
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.
type NullTransformation ¶
type NullTransformation struct {
Transformation
}
NullTransformation is a struct that implements the `Transformation` interface that does not apply any transformations to images.
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.