Documentation ¶
Overview ¶
package process provides a common interfaces for manipulating images before adding them to a picturebook.
Index ¶
- func AvailableProcesses() []string
- func RegisterProcess(ctx context.Context, name string, fn ProcessInitializeFunc) error
- type ColourSpaceProcess
- type ContourProcess
- type HalftoneProcess
- type MultiProcess
- type NullProcess
- type Process
- func NewColourSpaceProcess(ctx context.Context, uri string) (Process, error)
- func NewContourProcess(ctx context.Context, uri string) (Process, error)
- func NewHalftoneProcess(ctx context.Context, uri string) (Process, error)
- func NewMultiProcess(ctx context.Context, processes ...Process) (Process, error)
- func NewNullProcess(ctx context.Context, uri string) (Process, error)
- func NewProcess(ctx context.Context, uri string) (Process, error)
- func NewRotateProcess(ctx context.Context, uri string) (Process, error)
- type ProcessInitializeFunc
- type RotateProcess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableProcesses ¶
func AvailableProcesses() []string
AvailableProcess returns the list of schemes that have been registered with `ProcessInitializeFunc` functions.
func RegisterProcess ¶
func RegisterProcess(ctx context.Context, name string, fn ProcessInitializeFunc) error
RegisterProcess associates a URI scheme with a `ProcessInitializeFunc` initialization function.
Types ¶
type ColourSpaceProcess ¶ added in v0.8.0
type ColourSpaceProcess struct { Process // contains filtered or unexported fields }
type ColourSpaceProcess implements the `Process` interface to ensure that all the pixels in an image are mapped to a specific colour space.
func (*ColourSpaceProcess) Transform ¶ added in v0.8.0
func (f *ColourSpaceProcess) Transform(ctx context.Context, source_bucket *blob.Bucket, target_bucket *blob.Bucket, path string) (string, error)
Tranform maps all the pixels in the image located at 'path' in 'source_bucket' and writes the results to 'target_bucket' returning a new relative path on success.
type ContourProcess ¶ added in v0.8.0
type ContourProcess struct { Process // contains filtered or unexported fields }
type ContourProcess implements the `Process` interface and transforms an image in to a series of black and white "contour" lines.
func (*ContourProcess) Transform ¶ added in v0.8.0
func (f *ContourProcess) Transform(ctx context.Context, source_bucket *blob.Bucket, target_bucket *blob.Bucket, path string) (string, error)
Tranform contours the image 'path' in 'source_bucket' and writes the results to 'target_bucket' returning a new relative path on success. If an image is not a JPEG file the method return an empty string.
type HalftoneProcess ¶
type HalftoneProcess struct {
Process
}
type HalftoneProcess implements the `Process` interface and applies a "halftone" dithering transformation to an image.
func (*HalftoneProcess) Transform ¶
func (f *HalftoneProcess) Transform(ctx context.Context, source_bucket *blob.Bucket, target_bucket *blob.Bucket, path string) (string, error)
Tranform applies a "halftone" dithering tranformation to 'path' in 'source_bucket' and writes the results to 'target_bucket' returning a new relative path on success.
type MultiProcess ¶
type MultiProcess struct { Process // contains filtered or unexported fields }
type MultiProcess implements the `Process` interface and allows multiple `Process` instances to to tranform an image before adding it to a picturebook.
func (*MultiProcess) Transform ¶
func (p *MultiProcess) Transform(ctx context.Context, source_bucket *blob.Bucket, target_bucket *blob.Bucket, path string) (string, error)
Tranform applies the `Tranform` method for all its internal `Process` instances. All processes must succeed in order for this method to succeed.
type NullProcess ¶
type NullProcess struct {
Process
}
type NullProcess implements the `Process` interface but does not apply any transformations to an image.
type Process ¶
type Process interface { // Transform reads a file from a `blob.Bucket` instance, processes it and writes the result to a // second `blob.Bucket` instance returning a new filename. Transform(context.Context, *blob.Bucket, *blob.Bucket, string) (string, error) }
type Process provides a common interfaces for manipulating images before adding them to a picturebook.
func NewColourSpaceProcess ¶ added in v0.8.0
NewColourSpaceProcess returns a new instance of `ColourSpaceProcess` for 'uri' which is expected to take the form of:
colourspace://{PROFILE} colorspace://{PROFILE}
Where {PROFILE} is one of the following: * `displayp3` which maps pixels to Apple's Display P3 colour space * `adobergb` which maps pixels to Adobe's RGB colour space
func NewContourProcess ¶ added in v0.8.0
NewContourProcess returns a new instance of `ContourProcess` for 'uri' which must be parsable as a valid `net/url` URL instance.
contour://?{PARAMETERS}
Where valid parameters are: * `iterations` The number of iterations to perform during the contour process. Default is 12. * `scale` The scale of the final contoured image. Default is 1.0.
func NewHalftoneProcess ¶
NewHalftoneProcess returns a new instance of `HalftoneProcess` for 'uri' which must be parsable as a valid `net/url` URL instance.
func NewMultiProcess ¶
NewMultiProcess returns a new instance of `MultiProcess` for 'processes'
func NewNullProcess ¶
NullProcess returns a new instance of `NullProcess` for 'uri' which must be parsable as a valid `net/url` URL instance.
func NewProcess ¶
NewProcess returns a new `Process` instance for 'uri' whose scheme is expected to have been associated with an `ProcessInitializeFunc` (by the `RegisterProcess` method.
type ProcessInitializeFunc ¶
type ProcessInitializeFunc defined a common initialization function for instances implementing the Process interface. This is specified when the packages definining those instances call `RegisterProcess` and invoked with the `NewProcess` method is called.
type RotateProcess ¶
type RotateProcess struct {
Process
}
type RotateProcess implements the `Process` interface and rotates and image based on its EXIF `Orientation` property.
func (*RotateProcess) Transform ¶
func (f *RotateProcess) Transform(ctx context.Context, source_bucket *blob.Bucket, target_bucket *blob.Bucket, path string) (string, error)
Tranform rotates the image 'path' in 'source_bucket' and writes the results to 'target_bucket' returning a new relative path on success. If an image is not a JPEG file the method return an empty string.