image

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 67

Documentation

Overview

Package image provides functions for converting between various image formats.

Index

Constants

This section is empty.

Variables

View Source
var (
	ATC_RGB_AMD                     = NewATC_RGB_AMD("ATC_RGB_AMD")
	ATC_RGBA_EXPLICIT_ALPHA_AMD     = NewATC_RGBA_EXPLICIT_ALPHA_AMD("ATC_RGBA_EXPLICIT_ALPHA_AMD")
	ATC_RGBA_INTERPOLATED_ALPHA_AMD = NewATC_RGBA_INTERPOLATED_ALPHA_AMD("ATC_RGBA_INTERPOLATED_ALPHA_AMD")
)
View Source
var (
	ETC2_RGB_U8_NORM         = NewETC2_RGB_U8_NORM("ETC2_RGB_U8_NORM")
	ETC2_RGBA_U8_NORM        = NewETC2_RGBA_U8_NORM("ETC2_RGBA_U8_NORM")
	ETC2_RGBA_U8U8U8U1_NORM  = NewETC2_RGBA_U8U8U8U1_NORM("ETC2_RGBA_U8U8U8U1_NORM")
	ETC2_SRGB_U8_NORM        = NewETC2_SRGB_U8_NORM("ETC2_SRGB_U8_NORM")
	ETC2_SRGBA_U8_NORM       = NewETC2_SRGBA_U8_NORM("ETC2_SRGBA_U8_NORM")
	ETC2_SRGBA_U8U8U8U1_NORM = NewETC2_SRGBA_U8U8U8U1_NORM("ETC2_SRGBA_U8U8U8U1_NORM")
	ETC2_R_U11_NORM          = NewETC2_R_U11_NORM("ETC2_R_U11_NORM")
	ETC2_RG_U11_NORM         = NewETC2_RG_U11_NORM("ETC2_RG_U11_NORM")
	ETC2_R_S11_NORM          = NewETC2_R_S11_NORM("ETC2_R_S11_NORM")
	ETC2_RG_S11_NORM         = NewETC2_RG_S11_NORM("ETC2_RG_S11_NORM")
)
View Source
var (
	RGTC1_BC4_R_U8_NORM  = NewRGTC1_BC4_R_U8_NORM("RGTC1_BC4_R_U8_NORM")
	RGTC1_BC4_R_S8_NORM  = NewRGTC1_BC4_R_S8_NORM("RGTC1_BC4_R_S8_NORM")
	RGTC2_BC5_RG_U8_NORM = NewRGTC2_BC5_RG_U8_NORM("RGTC2_BC5_RG_U8_NORM")
	RGTC2_BC5_RG_S8_NORM = NewRGTC2_BC5_RG_S8_NORM("RGTC2_BC5_RG_S8_NORM")
)
View Source
var (
	RGBA_F32      = newUncompressed(fmts.RGBA_F32)
	RGB_U8_NORM   = newUncompressed(fmts.RGB_U8_NORM)
	RGBA_U8_NORM  = newUncompressed(fmts.RGBA_U8_NORM)
	SRGB_U8_NORM  = newUncompressed(fmts.SRGB_U8_NORM)
	SRGBA_U8_NORM = newUncompressed(fmts.SRGBA_U8_NORM)
	R_U16_NORM    = newUncompressed(fmts.R_U16_NORM)
	RG_U16_NORM   = newUncompressed(fmts.RG_U16_NORM)
	R_S16_NORM    = newUncompressed(fmts.R_S16_NORM)
	RG_S16_NORM   = newUncompressed(fmts.RG_S16_NORM)
	Gray_U8_NORM  = newUncompressed(fmts.Gray_U8_NORM)
	D_U16_NORM    = newUncompressed(fmts.D_U16_NORM)
)
View Source
var (
	ETC1_RGB_U8_NORM = NewETC1_RGB_U8_NORM("ETC1_RGB_U8_NORM")
)
View Source
var ErrResizeUnsupported = fmt.Errorf("Format does not support resizing")

ErrResizeUnsupported is returned by Format.Resize() when the format does not support resizing.

View Source
var PNG = NewPNG("png")
View Source
var (
	S3_DXT1_RGB = NewS3_DXT1_RGB("S3_DXT1_RGB")
)
View Source
var (
	S3_DXT1_RGBA = NewS3_DXT1_RGBA("S3_DXT1_RGBA")
)
View Source
var (
	S3_DXT3_RGBA = NewS3_DXT3_RGBA("S3_DXT3_RGBA")
)
View Source
var (
	S3_DXT5_RGBA = NewS3_DXT5_RGBA("S3_DXT5_RGBA")
)

Functions

func Convert

func Convert(data []byte, width, height, depth int, srcFmt, dstFmt *Format) ([]byte, error)

Convert uses the registered Converters to convert the image formed from data, width and height from srcFmt to dstFmt. If no direct converter has been registered to convert from srcFmt to dstFmt, then Convert may try converting via an intermediate format.

func Difference

func Difference(a, b *Data) (float32, error)

Difference returns the normalized square error between the two images. A return value of 0 denotes identical images, a return value of 1 denotes a complete mismatch (black vs white). Only channels that are found in both in a and b are compared. However, if there are no common channels then an error is returned.

func RegisterConverter

func RegisterConverter(src, dst *Format, c Converter)

RegisterConverter registers the Converter for converting from src to dst formats. If a converter already exists for converting from src to dst, then this function panics.

Types

type Convertable

type Convertable interface {
	ConvertTo(ctx context.Context, f *Format) (interface{}, error)
}

Convertable is the interface implemented by types that can be converted to a new image format.

type Converter

type Converter func(data []byte, width, height, depth int) ([]byte, error)

Converter is used to convert the the image formed from the parameters data, width, height and depth into another format. If the conversion succeeds then the converted image data is returned, otherwise an error is returned.

type Thumbnailer

type Thumbnailer interface {
	// Thumbnail returns a thumbnail image info that most closely matches the
	// desired image width, height and depth.
	Thumbnail(ctx context.Context, w, h, d uint32) (*Info, error)
}

Thumbnailer is the interface implemented by types that can be visualized as a thumbnail image.

Directories

Path Synopsis
Package astc implements ASTC texture decompression.
Package astc implements ASTC texture decompression.

Jump to

Keyboard shortcuts

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