tree: 83d7af94c0b6b08d8cf3a52b09e2fde3539c0d2f [path history] [tgz]
  1. alpha.go
  2. atc.go
  3. convert.go
  4. doc.go
  5. etc1.go
  6. format.go
  7. lum.go
  8. lum_alpha.go
  9. png.go
  10. README.md
  11. rgb.go
  12. utils.go
image/README.md

image


import "android.googlesource.com/platform/tools/gpu/image"

Package image provides functions for converting between various image formats.

Usage

func Convert

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

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

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.

type Converter

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

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

type Format

type Format interface {
	Check(data []byte, width, height int) error
}

Format is the interface for an image and/or pixel format.

Check returns an error if the combination of data, image width and image height is invalid for the given format, otherwise Check returns nil.

func ATC_RGBA_EXPLICIT_ALPHA_AMD

func ATC_RGBA_EXPLICIT_ALPHA_AMD() Format

ATC_RGBA_EXPLICIT_ALPHA_AMD returns a format representing the texture compression format with the same name.

func ATC_RGB_AMD

func ATC_RGB_AMD() Format

ATC_RGB_AMD returns a format representing the texture compression format with the same name.

func Alpha

func Alpha() Format

Alpha returns a format containing a single 8-bit alpha channel per pixel.

func ETC1_RGB8_OES

func ETC1_RGB8_OES() Format

ETC1_RGB8_OES returns a format representing the texture compression format with the same name.

func Luminance

func Luminance() Format

Luminance returns a format containing a single 8-bit luminance channel per pixel.

func LuminanceAlpha

func LuminanceAlpha() Format

LuminanceAlpha returns a format containing an 8-bit luminance and alpha channel per pixel.

func PNG

func PNG() Format

PNG returns a format representing the the texture compression format with the same name.

func RGB

func RGB() Format

RGB returns a format containing an 8-bit red, green and blue channel per pixel.

func RGBA

func RGBA() Format

RGBA returns a format containing an 8-bit red, green, blue and alpha channel per pixel.