Documentation ¶
Overview ¶
Package image provides a bridge to the Go "image" package.
Index ¶
- func Decode(im *imageserver.Image) (image.Image, error)
- func RegisterEncoder(format string, enc Encoder)
- type ChangeProcessor
- type Changer
- type Encoder
- type EncoderFunc
- type Handler
- type ListProcessor
- type Processor
- type ProcessorFunc
- type ProcessorProvider
- type Provider
- type ProviderFunc
- type Server
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 ¶
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 EncoderFunc ¶
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 ¶
Processor processes a Go Image.
It can return the given Image, but should not modify it.
type ProcessorFunc ¶
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 ¶
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 ¶
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.
Source Files ¶
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. |