Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrDec = fmt.Errorf("improperly initialized Decoder") ErrFormat = fmt.Errorf("unsupported image color model") )
Functions ¶
This section is empty.
Types ¶
type DecodeConfigFunc ¶
A DecodeConfigFunc reads from a source io.Reader and returns an image.Config and an error.
type DecodeFunc ¶
A DecodeFunc reads an image fom the source io.Reader and returns an image.Image and an error. Each of the standard library's image package subdirectories contain functions that can be used here, although alternative implementations are fine too.
type Decoder ¶
type Decoder struct {
DecodeFunc
DecodeConfigFunc
}
A Decoder is a struct that can read gdf.XImages from source bytes. Most image codecs designed to be used with the standard library's image.RegisterFormat() function export functions that are useable as DecodeFunc and DecodeConfigFuncs. A Decoder can be reused on multiple images of the same format, although it is not concurrency safe. NOTE: For JPEG images, the gdf/jpeg package is more efficient.
func NewDecoder ¶
func NewDecoder(df DecodeFunc, dcf DecodeConfigFunc) Decoder
func (Decoder) Decode ¶
Decode interprets b as data representing a raster image. It decodes the image and returns a gdf.XImage and an error. This function may not be ideal for all images. In particular, grayscale images with alpha channels are converted to their NRGBA equivalents, which may have the effect of significantly increasing the image's encoding size. Applications sensitive to performance may benefit from processing the image data separately and then generating the image's XImage representation by way of the gdf.LoadXImage function.