image

package
v0.0.0-...-77ed03d Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package image provides a bridge to the Go "image" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(im *imageserver.Image) (image.Image, error)

Decode decodes a raw Image to a Go Image.

It returns an error if the decoded Image format does not match the raw Image format.

func RegisterEncoder

func RegisterEncoder(format string, enc Encoder)

RegisterEncoder registers an Encoder for a format.

Types

type ChangeProcessor

type ChangeProcessor struct {
	Processor
}

ChangeProcessor is a Processor implementation that alway return true for the Change method.

func (*ChangeProcessor) Change

func (prc *ChangeProcessor) Change(params imageserver.Params) bool

Change implements Processor.

type Changer

type Changer interface {
	Change(imageserver.Params) bool
}

Changer returns true if the Image could change for the given Params.

type Encoder

type Encoder interface {
	Encode(io.Writer, image.Image, imageserver.Params) error
	Changer
}

Encoder encodes an Image.

An Encoder must encode to only one specific format.

type EncoderFunc

type EncoderFunc func(io.Writer, image.Image, imageserver.Params) error

EncoderFunc is an Encoder func.

func (EncoderFunc) Change

func (f EncoderFunc) Change(params imageserver.Params) bool

Change implements Encoder.

func (EncoderFunc) Encode

func (f EncoderFunc) Encode(w io.Writer, nim image.Image, params imageserver.Params) error

Encode implements Encoder.

type Handler

type Handler struct {
	Processor Processor // Optional Processor
}

Handler is a imageserver.Handler implementation that uses Go "image" package.

It supports format conversion and processing. It uses the "format" param to determine which Encoder is used.

If there is nothing to do, Handler does not decode the Image or call the Processor.

func (*Handler) Handle

func (hdr *Handler) Handle(im *imageserver.Image, params imageserver.Params) (*imageserver.Image, error)

Handle implements imageserver.Handler.

type ListProcessor

type ListProcessor []Processor

ListProcessor is a Processor implementation that wrap a list of Processor.

func (ListProcessor) Change

func (prc ListProcessor) Change(params imageserver.Params) bool

Change implements Processor.

func (ListProcessor) Process

func (prc ListProcessor) Process(nim image.Image, params imageserver.Params) (image.Image, error)

Process implements Processor.

type Processor

type Processor interface {
	Process(image.Image, imageserver.Params) (image.Image, error)
	Changer
}

Processor processes a Go Image.

It can return the given Image, but should not modify it.

type ProcessorFunc

type ProcessorFunc func(image.Image, imageserver.Params) (image.Image, error)

ProcessorFunc is a Processor func.

func (ProcessorFunc) Change

func (f ProcessorFunc) Change(params imageserver.Params) bool

Change implements Processor.

func (ProcessorFunc) Process

func (f ProcessorFunc) Process(nim image.Image, params imageserver.Params) (image.Image, error)

Process implements Processor.

type ProcessorProvider

type ProcessorProvider struct {
	Provider
	Processor Processor
}

ProcessorProvider is a Provider implementation that processes the Image.

func (*ProcessorProvider) Get

func (prv *ProcessorProvider) Get(params imageserver.Params) (image.Image, error)

Get implements Provider.

type Provider

type Provider interface {
	Get(imageserver.Params) (image.Image, error)
}

Provider returns a Go Image.

type ProviderFunc

type ProviderFunc func(imageserver.Params) (image.Image, error)

ProviderFunc is a Provider func.

func (ProviderFunc) Get

func (f ProviderFunc) Get(params imageserver.Params) (image.Image, error)

Get implements Provider.

type Server

type Server struct {
	Provider      Provider
	DefaultFormat string
}

Server is a imageserver.Server implementation that gets the Image from a Provider.

It uses the "format" param or the DefaultFormat variable to determine which Encoder is used.

func (*Server) Get

func (srv *Server) Get(params imageserver.Params) (*imageserver.Image, error)

Get implements imageserver.Server.

Directories

Path Synopsis
Package _test provides utilities for imageserver/image.Encoder testing.
Package _test provides utilities for imageserver/image.Encoder testing.
Package bmp provides a BMP imageserver/image.Encoder implementation.
Package bmp provides a BMP imageserver/image.Encoder implementation.
Package crop provides a imageserver/image.Processor implementation that allows to crop Image.
Package crop provides a imageserver/image.Processor implementation that allows to crop Image.
Package gamma provides gamma imageserver/image.Processor implementations.
Package gamma provides gamma imageserver/image.Processor implementations.
Package gif provides GIF imageserver/image.Encoder|Processor and imageserver.Handler implementations.
Package gif provides GIF imageserver/image.Encoder|Processor and imageserver.Handler implementations.
Package gift provides imageserver/image.Processor implementations for GIFT.
Package gift provides imageserver/image.Processor implementations for GIFT.
Package internal provides utilities functions used in the image package.
Package internal provides utilities functions used in the image package.
Package jpeg provides a JPEG imageserver/image.Encoder implementation.
Package jpeg provides a JPEG imageserver/image.Encoder implementation.
Package nfntresize provides a nfnt/resize imageserver/image.Processor implementation.
Package nfntresize provides a nfnt/resize imageserver/image.Processor implementation.
Package png provides a PNG imageserver/image.Encoder implementation.
Package png provides a PNG imageserver/image.Encoder implementation.
Package tiff provides a TIFF imageserver/image.Encoder implementation.
Package tiff provides a TIFF imageserver/image.Encoder implementation.

Jump to

Keyboard shortcuts

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