image

package
v0.0.0-...-7a622f3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

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 (
	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)

	Luminance_R32      = newUncompressed(fmts.L_F32)
	Luminance_U8_NORM  = newUncompressed(fmts.L_U8_NORM)
	LuminanceA_U8_NORM = newUncompressed(fmts.LA_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.

func Registered

func Registered(src, dst *Format) bool

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 compression and decompression.
Package astc implements ASTC texture compression and decompression.
Package etc implements etc texture compression and decompression.
Package etc implements etc texture compression and decompression.

Jump to

Keyboard shortcuts

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