imageutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COLOR_TYPE_RGBA    string = "rgba"
	COLOR_TYPE_HSVA    string = "hsva"
	COLOR_TYPE_HSLA    string = "hsla"
	COLOR_TYPE_GRAYA   string = "graya"
	COLOR_TYPE_GRAYA16 string = "graya16"
	COLOR_TYPE_GRAY    string = "gray"
	COLOR_TYPE_GRAY16  string = "gray16"
	COLOR_TYPE_ALPHA   string = "alpha"
	COLOR_TYPE_ALPHA16 string = "alpha16"
	COLOR_TYPE_CMYKA   string = "cmyka"
	COLOR_TYPE_CMYK    string = "cmyk"
	COLOR_TYPE_ZERO    string = "zero"
)

Variables

View Source
var EncodingExts = []string{
	".png",
	".jpg",
	".jpeg",
	".gif",
	".tiff",
	".bmp",
	".ico",
	".cur",
}

Functions

func Alpha16ToColorTable added in v0.3.0

func Alpha16ToColorTable(state *golua.LState, alpha int) *golua.LTable

func AlphaSet added in v0.3.0

func AlphaSet(img image.Image, alpha uint8)

func AlphaToColorTable added in v0.3.0

func AlphaToColorTable(state *golua.LState, alpha int) *golua.LTable

func CMYKAToColorTable added in v0.3.0

func CMYKAToColorTable(state *golua.LState, cyan, magenta, yellow, key, alpha int) *golua.LTable

func CMYKToColorTable added in v0.3.0

func CMYKToColorTable(state *golua.LState, cyan, magenta, yellow, key int) *golua.LTable

func Color16BitTo8Bit added in v0.3.0

func Color16BitTo8Bit(c uint16) uint8

func Color8BitTo16Bit added in v0.3.0

func Color8BitTo16Bit(c uint8) uint16

func ColorTableToAlpha added in v0.3.0

func ColorTableToAlpha(t *golua.LTable) uint8

func ColorTableToAlpha16 added in v0.3.0

func ColorTableToAlpha16(t *golua.LTable) uint16

func ColorTableToCMYK added in v0.3.0

func ColorTableToCMYK(t *golua.LTable) (uint8, uint8, uint8, uint8)

func ColorTableToCMYKA added in v0.3.0

func ColorTableToCMYKA(t *golua.LTable) (uint8, uint8, uint8, uint8, uint8)

func ColorTableToGray added in v0.3.0

func ColorTableToGray(t *golua.LTable) uint8

func ColorTableToGray16 added in v0.3.0

func ColorTableToGray16(t *golua.LTable) uint16

func ColorTableToGrayA added in v0.3.0

func ColorTableToGrayA(t *golua.LTable) (uint8, uint8)

func ColorTableToGrayA16 added in v0.3.0

func ColorTableToGrayA16(t *golua.LTable) (uint16, uint16)

func ColorTableToHSLA added in v0.3.0

func ColorTableToHSLA(t *golua.LTable) (float64, float64, float64, uint8)

func ColorTableToHSVA added in v0.3.0

func ColorTableToHSVA(t *golua.LTable) (float64, float64, float64, uint8)

func ColorTableToRGBA added in v0.3.0

func ColorTableToRGBA(t *golua.LTable) (uint8, uint8, uint8, uint8)

func ColorTableToRGBAColor added in v0.3.0

func ColorTableToRGBAColor(t *golua.LTable) *color.RGBA

func ConvertColor

func ConvertColor(model ColorModel, red, green, blue, alpha int) (int, int, int, int)

func CopyImage

func CopyImage(src image.Image, model ColorModel) image.Image

func DataChunkToTable added in v0.3.0

func DataChunkToTable(chunk *PNGDataChunk, state *golua.LState) *golua.LTable

func Decode

func Decode(r io.ReadSeeker, encoding ImageEncoding) (image.Image, error)

func DecodeConfig added in v0.3.0

func DecodeConfig(r io.Reader, encoding ImageEncoding) (int, int, error)

func Draw

func Draw(base image.Image, sub image.Image, x, y, width, height int)

func DrawRect added in v0.3.0

func DrawRect(base image.Image, sub image.Image, r image.Rectangle)

func Encode

func Encode(w io.WriteSeeker, img image.Image, encoding ImageEncoding) error

func EncodingExtension

func EncodingExtension(encoding ImageEncoding) string

func FramesToSpritesheet added in v0.3.0

func FramesToSpritesheet(imgs []image.Image, model ColorModel, count, width, height, perRow, hpixel, vpixel, hcell, vcell, index, hsep, vsep int) image.Image

func Get added in v0.3.0

func Get(img image.Image, x, y int) (int, int, int, int)

func GetColor added in v0.3.0

func GetColor(img image.Image, state *golua.LState, x, y int) *golua.LTable

func Gray16ToColorTable added in v0.3.0

func Gray16ToColorTable(state *golua.LState, gray int) *golua.LTable

func GrayA16ToColorTable added in v0.3.0

func GrayA16ToColorTable(state *golua.LState, gray, alpha int) *golua.LTable

func GrayAToColorTable added in v0.3.0

func GrayAToColorTable(state *golua.LState, gray, alpha int) *golua.LTable

func GrayToColorTable added in v0.3.0

func GrayToColorTable(state *golua.LState, gray int) *golua.LTable

func HSLAToColorTable added in v0.3.0

func HSLAToColorTable(state *golua.LState, hue, sat, light float64, alpha int) *golua.LTable

func HSVAToColorTable added in v0.3.0

func HSVAToColorTable(state *golua.LState, hue, sat, val float64, alpha int) *golua.LTable

func ImageCompare added in v0.3.0

func ImageCompare(img1, img2 image.Image) bool

func ImageGetDraw added in v0.3.0

func ImageGetDraw(img image.Image) draw.Image

func NewImage

func NewImage(width, height int, model ColorModel) image.Image

func PNGDataChunkEncode added in v0.3.0

func PNGDataChunkEncode(w io.WriteSeeker, img image.Image, chunks []*PNGDataChunk) error

func PNGDataChunkWrite added in v0.3.0

func PNGDataChunkWrite(key string, data string) []byte

func ParseAlpha16Table added in v0.3.0

func ParseAlpha16Table(t *golua.LTable) uint16

func ParseAlphaTable added in v0.3.0

func ParseAlphaTable(t *golua.LTable) uint8

func ParseCMYKATable added in v0.3.0

func ParseCMYKATable(t *golua.LTable) (uint8, uint8, uint8, uint8, uint8)

func ParseCMYKTable added in v0.3.0

func ParseCMYKTable(t *golua.LTable) (uint8, uint8, uint8, uint8)

func ParseGray16Table added in v0.3.0

func ParseGray16Table(t *golua.LTable) uint16

func ParseGrayA16Table added in v0.3.0

func ParseGrayA16Table(t *golua.LTable) (uint16, uint16)

func ParseGrayATable added in v0.3.0

func ParseGrayATable(t *golua.LTable) (uint8, uint8)

func ParseGrayTable added in v0.3.0

func ParseGrayTable(t *golua.LTable) uint8

func ParseHSLATable added in v0.3.0

func ParseHSLATable(t *golua.LTable) (float64, float64, float64, uint8)

func ParseHSVATable added in v0.3.0

func ParseHSVATable(t *golua.LTable) (float64, float64, float64, uint8)

func ParseRGBATable added in v0.3.0

func ParseRGBATable(t *golua.LTable) (uint8, uint8, uint8, uint8)

func PointToTable

func PointToTable(state *golua.LState, p image.Point) *golua.LTable

func RGBAColorToColorTable added in v0.3.0

func RGBAColorToColorTable(state *golua.LState, rgba *color.RGBA) *golua.LTable

func RGBAToColorTable added in v0.3.0

func RGBAToColorTable(state *golua.LState, r, g, b, a int) *golua.LTable

func Set

func Set(img image.Image, x, y, red, green, blue, alpha int)

func SpritesheetToFrames added in v0.3.0

func SpritesheetToFrames(img image.Image, copy bool, count, width, height, perRow, hpixel, vpixel, hcell, vcell, index, hsep, vsep int) []image.Image

func SubImage

func SubImage(img image.Image, x1, y1, x2, y2 int, copy bool) image.Image

func TableToPoint

func TableToPoint(t *golua.LTable) image.Point

func ZeroColorTable added in v0.3.0

func ZeroColorTable(state *golua.LState) *golua.LTable

Types

type ColorModel

type ColorModel int
const (
	MODEL_RGBA ColorModel = iota
	MODEL_RGBA64
	MODEL_NRGBA
	MODEL_NRGBA64
	MODEL_ALPHA
	MODEL_ALPHA16
	MODEL_GRAY
	MODEL_GRAY16
	MODEL_CMYK
)

func Limit

func Limit(img image.Image, model ColorModel) (image.Image, ColorModel)

type ImageEncoding

type ImageEncoding int
const (
	ENCODING_PNG ImageEncoding = iota
	ENCODING_JPEG
	ENCODING_GIF
	ENCODING_TIFF
	ENCODING_BMP
	ENCODING_ICO
	ENCODING_CUR
	ENCODING_UNKNOWN
)

func ExtensionEncoding

func ExtensionEncoding(ext string) ImageEncoding

type PNGChunkStripper

type PNGChunkStripper struct {
	Reader     io.Reader
	DataChunks []*PNGDataChunk

	ErrList []error
	// contains filtered or unexported fields
}

func (*PNGChunkStripper) Read

func (r *PNGChunkStripper) Read(p []byte) (int, error)

type PNGDataChunk added in v0.3.0

type PNGDataChunk struct {
	Key  string
	Data string
}

func NewPNGDataChunk added in v0.3.0

func NewPNGDataChunk(key string, data string) *PNGDataChunk

func PNGDataChunkDecode added in v0.3.0

func PNGDataChunkDecode(r io.Reader) (image.Image, []*PNGDataChunk, error)

func PNGDataChunkRead added in v0.3.0

func PNGDataChunkRead(p []byte) (*PNGDataChunk, error)

func TableToDataChunk added in v0.3.0

func TableToDataChunk(t *golua.LTable) *PNGDataChunk

type PNGDataError added in v0.3.0

type PNGDataError string

func NewPNGDataError added in v0.3.0

func NewPNGDataError(err string) PNGDataError

func NewPNGDataErrorf added in v0.3.0

func NewPNGDataErrorf(format string, args ...interface{}) PNGDataError

func (PNGDataError) Error added in v0.3.0

func (e PNGDataError) Error() string

Jump to

Keyboard shortcuts

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