Documentation ¶
Overview ¶
Package image provides functions for converting between various image formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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") )
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") )
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") )
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) )
var (
ETC1_RGB_U8_NORM = NewETC1_RGB_U8_NORM("ETC1_RGB_U8_NORM")
)
var ErrResizeUnsupported = fmt.Errorf("Format does not support resizing")
ErrResizeUnsupported is returned by Format.Resize() when the format does not support resizing.
var PNG = NewPNG("png")
var (
S3_DXT1_RGB = NewS3_DXT1_RGB("S3_DXT1_RGB")
)
var (
S3_DXT1_RGBA = NewS3_DXT1_RGBA("S3_DXT1_RGBA")
)
var (
S3_DXT3_RGBA = NewS3_DXT3_RGBA("S3_DXT3_RGBA")
)
var (
S3_DXT5_RGBA = NewS3_DXT5_RGBA("S3_DXT5_RGBA")
)
Functions ¶
func Convert ¶
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 ¶
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 ¶
Convertable is the interface implemented by types that can be converted to a new image format.
type Converter ¶
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.