imageutil

package
v3.0.0-...-55e877b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Gray2Model   = _da.ModelFunc(_gged)
	Gray4Model   = _da.ModelFunc(_ebfb)
	NRGBA16Model = _da.ModelFunc(_dcaa)
)
View Source
var (
	MonochromeConverter = ConverterFunc(_gfb)
	Gray2Converter      = ConverterFunc(_acec)
	Gray4Converter      = ConverterFunc(_bfbf)
	GrayConverter       = ConverterFunc(_feaf)
	Gray16Converter     = ConverterFunc(_afec)
	NRGBA16Converter    = ConverterFunc(_aaacf)
	NRGBAConverter      = ConverterFunc(_aaga)
	NRGBA64Converter    = ConverterFunc(_agaac)
	RGBAConverter       = ConverterFunc(_fddf)
	CMYKConverter       = ConverterFunc(_fedb)
)
View Source
var ErrInvalidImage = _b.New("i\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0069\u006da\u0067\u0065\u0020\u0064\u0061\u0074\u0061 s\u0069\u007a\u0065\u0020f\u006f\u0072\u0020\u0070\u0072\u006f\u0076\u0069\u0064ed\u0020\u0064i\u006d\u0065\u006e\u0073\u0069\u006f\u006e\u0073")

Functions

func AddDataPadding

func AddDataPadding(width, height, bitsPerComponent, colorComponents int, data []byte) ([]byte, error)

func AutoThresholdTriangle

func AutoThresholdTriangle(histogram [256]int) uint8

func BytesPerLine

func BytesPerLine(width, bitsPerComponent, colorComponents int) int

func ColorAt

func ColorAt(x, y, width, bitsPerColor, colorComponents, bytesPerLine int, data, alpha []byte, decode []float64) (_da.Color, error)

func ColorAtCMYK

func ColorAtCMYK(x, y, width int, data []byte, decode []float64) (_da.CMYK, error)

func ColorAtGray16BPC

func ColorAtGray16BPC(x, y, bytesPerLine int, data []byte, decode []float64) (_da.Gray16, error)

func ColorAtGray1BPC

func ColorAtGray1BPC(x, y, bytesPerLine int, data []byte, decode []float64) (_da.Gray, error)

func ColorAtGray2BPC

func ColorAtGray2BPC(x, y, bytesPerLine int, data []byte, decode []float64) (_da.Gray, error)

func ColorAtGray4BPC

func ColorAtGray4BPC(x, y, bytesPerLine int, data []byte, decode []float64) (_da.Gray, error)

func ColorAtGray8BPC

func ColorAtGray8BPC(x, y, bytesPerLine int, data []byte, decode []float64) (_da.Gray, error)

func ColorAtGrayscale

func ColorAtGrayscale(x, y, bitsPerColor, bytesPerLine int, data []byte, decode []float64) (_da.Color, error)

func ColorAtNRGBA

func ColorAtNRGBA(x, y, width, bytesPerLine, bitsPerColor int, data, alpha []byte, decode []float64) (_da.Color, error)

func ColorAtNRGBA16

func ColorAtNRGBA16(x, y, width, bytesPerLine int, data, alpha []byte, decode []float64) (_da.NRGBA, error)

func ColorAtNRGBA32

func ColorAtNRGBA32(x, y, width int, data, alpha []byte, decode []float64) (_da.NRGBA, error)

func ColorAtNRGBA64

func ColorAtNRGBA64(x, y, width int, data, alpha []byte, decode []float64) (_da.NRGBA64, error)

func ColorAtRGBA32

func ColorAtRGBA32(x, y, width int, data, alpha []byte, decode []float64) (_da.RGBA, error)

func GrayHistogram

func GrayHistogram(g Gray) (_dcad [256]int)

func ImgToBinary

func ImgToBinary(i _e.Image, threshold uint8) *_e.Gray

func ImgToGray

func ImgToGray(i _e.Image) *_e.Gray

func InDelta

func InDelta(expected, current, delta float64) bool

func IsGrayImgBlackAndWhite

func IsGrayImgBlackAndWhite(i *_e.Gray) bool

func IsPowerOf2

func IsPowerOf2(n uint) bool

func LinearInterpolate

func LinearInterpolate(x, xmin, xmax, ymin, ymax float64) float64

func MonochromeModel

func MonochromeModel(threshold uint8) _da.Model

func NextPowerOf2

func NextPowerOf2(n uint) uint

func RasterOperation

func RasterOperation(dest *Monochrome, dx, dy, dw, dh int, op RasterOperator, src *Monochrome, sx, sy int) error

func ScaleAlphaToMonochrome

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

Types

type CMYK

type CMYK interface {
	CMYKAt(_ebg, _eaab int) _da.CMYK
	SetCMYK(_dgge, _fee int, _eefc _da.CMYK)
}

type CMYK32

type CMYK32 struct{ ImageBase }

func (*CMYK32) At

func (_abgg *CMYK32) At(x, y int) _da.Color

func (*CMYK32) Base

func (_eca *CMYK32) Base() *ImageBase

func (*CMYK32) Bounds

func (_fbca *CMYK32) Bounds() _e.Rectangle

func (*CMYK32) CMYKAt

func (_bac *CMYK32) CMYKAt(x, y int) _da.CMYK

func (*CMYK32) ColorAt

func (_adac *CMYK32) ColorAt(x, y int) (_da.Color, error)

func (*CMYK32) ColorModel

func (_dge *CMYK32) ColorModel() _da.Model

func (*CMYK32) Copy

func (_agd *CMYK32) Copy() Image

func (*CMYK32) Set

func (_afb *CMYK32) Set(x, y int, c _da.Color)

func (*CMYK32) SetCMYK

func (_ecf *CMYK32) SetCMYK(x, y int, c _da.CMYK)

func (*CMYK32) Validate

func (_ffba *CMYK32) Validate() error

type ColorConverter

type ColorConverter interface {
	Convert(_aed _e.Image) (Image, error)
}

func ConverterFunc

func ConverterFunc(converterFunc func(_ebd _e.Image) (Image, error)) ColorConverter

func GetConverter

func GetConverter(bitsPerComponent, colorComponents int) (ColorConverter, error)

func MonochromeThresholdConverter

func MonochromeThresholdConverter(threshold uint8) ColorConverter

type Gray

type Gray interface {
	GrayAt(_gabg, _dgd int) _da.Gray
	SetGray(_agff, _gdb int, _efg _da.Gray)
}

type Gray16

type Gray16 struct{ ImageBase }

func (*Gray16) At

func (_cggg *Gray16) At(x, y int) _da.Color

func (*Gray16) Base

func (_bgbcb *Gray16) Base() *ImageBase

func (*Gray16) Bounds

func (_dgfb *Gray16) Bounds() _e.Rectangle

func (*Gray16) ColorAt

func (_gdbe *Gray16) ColorAt(x, y int) (_da.Color, error)

func (*Gray16) ColorModel

func (_egc *Gray16) ColorModel() _da.Model

func (*Gray16) Copy

func (_fdfe *Gray16) Copy() Image

func (*Gray16) GrayAt

func (_ceac *Gray16) GrayAt(x, y int) _da.Gray

func (*Gray16) Histogram

func (_gcab *Gray16) Histogram() (_gbge [256]int)

func (*Gray16) Set

func (_cfad *Gray16) Set(x, y int, c _da.Color)

func (*Gray16) SetGray

func (_adeb *Gray16) SetGray(x, y int, g _da.Gray)

func (*Gray16) Validate

func (_edd *Gray16) Validate() error

type Gray2

type Gray2 struct{ ImageBase }

func (*Gray2) At

func (_aeef *Gray2) At(x, y int) _da.Color

func (*Gray2) Base

func (_cdd *Gray2) Base() *ImageBase

func (*Gray2) Bounds

func (_ggd *Gray2) Bounds() _e.Rectangle

func (*Gray2) ColorAt

func (_defa *Gray2) ColorAt(x, y int) (_da.Color, error)

func (*Gray2) ColorModel

func (_acbd *Gray2) ColorModel() _da.Model

func (*Gray2) Copy

func (_bca *Gray2) Copy() Image

func (*Gray2) GrayAt

func (_egda *Gray2) GrayAt(x, y int) _da.Gray

func (*Gray2) Histogram

func (_dcef *Gray2) Histogram() (_gade [256]int)

func (*Gray2) Set

func (_cebd *Gray2) Set(x, y int, c _da.Color)

func (*Gray2) SetGray

func (_degb *Gray2) SetGray(x, y int, gray _da.Gray)

func (*Gray2) Validate

func (_dggcc *Gray2) Validate() error

type Gray4

type Gray4 struct{ ImageBase }

func (*Gray4) At

func (_badab *Gray4) At(x, y int) _da.Color

func (*Gray4) Base

func (_ggdc *Gray4) Base() *ImageBase

func (*Gray4) Bounds

func (_ggcc *Gray4) Bounds() _e.Rectangle

func (*Gray4) ColorAt

func (_gdeec *Gray4) ColorAt(x, y int) (_da.Color, error)

func (*Gray4) ColorModel

func (_egdf *Gray4) ColorModel() _da.Model

func (*Gray4) Copy

func (_ddfa *Gray4) Copy() Image

func (*Gray4) GrayAt

func (_gaf *Gray4) GrayAt(x, y int) _da.Gray

func (*Gray4) Histogram

func (_fbcd *Gray4) Histogram() (_bbgd [256]int)

func (*Gray4) Set

func (_ddcfe *Gray4) Set(x, y int, c _da.Color)

func (*Gray4) SetGray

func (_bgcg *Gray4) SetGray(x, y int, g _da.Gray)

func (*Gray4) Validate

func (_bbag *Gray4) Validate() error

type Gray8

type Gray8 struct{ ImageBase }

func (*Gray8) At

func (_fgfb *Gray8) At(x, y int) _da.Color

func (*Gray8) Base

func (_dbaa *Gray8) Base() *ImageBase

func (*Gray8) Bounds

func (_ceef *Gray8) Bounds() _e.Rectangle

func (*Gray8) ColorAt

func (_ffbf *Gray8) ColorAt(x, y int) (_da.Color, error)

func (*Gray8) ColorModel

func (_daaf *Gray8) ColorModel() _da.Model

func (*Gray8) Copy

func (_cgba *Gray8) Copy() Image

func (*Gray8) GrayAt

func (_egad *Gray8) GrayAt(x, y int) _da.Gray

func (*Gray8) Histogram

func (_ddff *Gray8) Histogram() (_ccgf [256]int)

func (*Gray8) Set

func (_ecff *Gray8) Set(x, y int, c _da.Color)

func (*Gray8) SetGray

func (_cdg *Gray8) SetGray(x, y int, g _da.Gray)

func (*Gray8) Validate

func (_eebd *Gray8) Validate() error

type Histogramer

type Histogramer interface{ Histogram() [256]int }

type Image

type Image interface {
	_bb.Image
	Base() *ImageBase
	Copy() Image
	Pix() []byte
	ColorAt(_ddcg, _dbed int) (_da.Color, error)
	Validate() error
}

func FromGoImage

func FromGoImage(i _e.Image) (Image, error)

func NewImage

func NewImage(width, height, bitsPerComponent, colorComponents int, data, alpha []byte, decode []float64) (Image, error)

type ImageBase

type ImageBase struct {
	Width, Height                     int
	BitsPerComponent, ColorComponents int
	Data, Alpha                       []byte
	Decode                            []float64
	BytesPerLine                      int
}

func NewImageBase

func NewImageBase(width int, height int, bitsPerComponent int, colorComponents int, data []byte, alpha []byte, decode []float64) ImageBase

func (*ImageBase) GetAlpha

func (_dbgg *ImageBase) GetAlpha() []byte

func (*ImageBase) HasAlpha

func (_aebb *ImageBase) HasAlpha() bool

func (*ImageBase) MakeAlpha

func (_fgb *ImageBase) MakeAlpha()

func (*ImageBase) Pix

func (_eade *ImageBase) Pix() []byte

type Monochrome

type Monochrome struct {
	ImageBase
	ModelThreshold uint8
}

func (*Monochrome) AddPadding

func (_efbf *Monochrome) AddPadding() (_effa error)

func (*Monochrome) At

func (_gdde *Monochrome) At(x, y int) _da.Color

func (*Monochrome) Base

func (_aafb *Monochrome) Base() *ImageBase

func (*Monochrome) Bounds

func (_adbb *Monochrome) Bounds() _e.Rectangle

func (*Monochrome) ColorAt

func (_cfda *Monochrome) ColorAt(x, y int) (_da.Color, error)

func (*Monochrome) ColorModel

func (_adef *Monochrome) ColorModel() _da.Model

func (*Monochrome) Copy

func (_cage *Monochrome) Copy() Image

func (*Monochrome) ExpandBinary

func (_ccca *Monochrome) ExpandBinary(factor int) (*Monochrome, error)

func (*Monochrome) GrayAt

func (_fabbd *Monochrome) GrayAt(x, y int) _da.Gray

func (*Monochrome) Histogram

func (_adee *Monochrome) Histogram() (_aefa [256]int)

func (*Monochrome) InverseData

func (_adec *Monochrome) InverseData() error

func (*Monochrome) IsUnpadded

func (_cee *Monochrome) IsUnpadded() bool

func (*Monochrome) RasterOperation

func (_deaf *Monochrome) RasterOperation(dx, dy, dw, dh int, op RasterOperator, src *Monochrome, sx, sy int) error

func (*Monochrome) ReduceBinary

func (_dff *Monochrome) ReduceBinary(factor float64) (*Monochrome, error)

func (*Monochrome) ResolveDecode

func (_ggc *Monochrome) ResolveDecode() error

func (*Monochrome) Scale

func (_fff *Monochrome) Scale(scale float64) (*Monochrome, error)

func (*Monochrome) ScaleLow

func (_ecgc *Monochrome) ScaleLow(width, height int) (*Monochrome, error)

func (*Monochrome) Set

func (_cfc *Monochrome) Set(x, y int, c _da.Color)

func (*Monochrome) SetGray

func (_cefbg *Monochrome) SetGray(x, y int, g _da.Gray)

func (*Monochrome) Validate

func (_bgbc *Monochrome) Validate() error

type NRGBA

type NRGBA interface {
	NRGBAAt(_acga, _ebcb int) _da.NRGBA
	SetNRGBA(_defd, _eacaa int, _afga _da.NRGBA)
}

type NRGBA16

type NRGBA16 struct{ ImageBase }

func (*NRGBA16) At

func (_gcgc *NRGBA16) At(x, y int) _da.Color

func (*NRGBA16) Base

func (_cgff *NRGBA16) Base() *ImageBase

func (*NRGBA16) Bounds

func (_gadc *NRGBA16) Bounds() _e.Rectangle

func (*NRGBA16) ColorAt

func (_efedb *NRGBA16) ColorAt(x, y int) (_da.Color, error)

func (*NRGBA16) ColorModel

func (_ebgf *NRGBA16) ColorModel() _da.Model

func (*NRGBA16) Copy

func (_gbba *NRGBA16) Copy() Image

func (*NRGBA16) NRGBAAt

func (_ecbf *NRGBA16) NRGBAAt(x, y int) _da.NRGBA

func (*NRGBA16) Set

func (_bbc *NRGBA16) Set(x, y int, c _da.Color)

func (*NRGBA16) SetNRGBA

func (_ccee *NRGBA16) SetNRGBA(x, y int, c _da.NRGBA)

func (*NRGBA16) Validate

func (_dadag *NRGBA16) Validate() error

type NRGBA32

type NRGBA32 struct{ ImageBase }

func (*NRGBA32) At

func (_ddbcc *NRGBA32) At(x, y int) _da.Color

func (*NRGBA32) Base

func (_fdge *NRGBA32) Base() *ImageBase

func (*NRGBA32) Bounds

func (_eefg *NRGBA32) Bounds() _e.Rectangle

func (*NRGBA32) ColorAt

func (_eceag *NRGBA32) ColorAt(x, y int) (_da.Color, error)

func (*NRGBA32) ColorModel

func (_aab *NRGBA32) ColorModel() _da.Model

func (*NRGBA32) Copy

func (_fdff *NRGBA32) Copy() Image

func (*NRGBA32) NRGBAAt

func (_dabf *NRGBA32) NRGBAAt(x, y int) _da.NRGBA

func (*NRGBA32) Set

func (_gfcda *NRGBA32) Set(x, y int, c _da.Color)

func (*NRGBA32) SetNRGBA

func (_ffgae *NRGBA32) SetNRGBA(x, y int, c _da.NRGBA)

func (*NRGBA32) Validate

func (_cebe *NRGBA32) Validate() error

type NRGBA64

type NRGBA64 struct{ ImageBase }

func (*NRGBA64) At

func (_aacg *NRGBA64) At(x, y int) _da.Color

func (*NRGBA64) Base

func (_geadaa *NRGBA64) Base() *ImageBase

func (*NRGBA64) Bounds

func (_bcacf *NRGBA64) Bounds() _e.Rectangle

func (*NRGBA64) ColorAt

func (_ggebf *NRGBA64) ColorAt(x, y int) (_da.Color, error)

func (*NRGBA64) ColorModel

func (_cgfc *NRGBA64) ColorModel() _da.Model

func (*NRGBA64) Copy

func (_bbda *NRGBA64) Copy() Image

func (*NRGBA64) NRGBA64At

func (_gebf *NRGBA64) NRGBA64At(x, y int) _da.NRGBA64

func (*NRGBA64) Set

func (_ccf *NRGBA64) Set(x, y int, c _da.Color)

func (*NRGBA64) SetNRGBA64

func (_fabc *NRGBA64) SetNRGBA64(x, y int, c _da.NRGBA64)

func (*NRGBA64) Validate

func (_bcdd *NRGBA64) Validate() error

type RGBA

type RGBA interface {
	RGBAAt(_dfce, _dfdf int) _da.RGBA
	SetRGBA(_cdcbe, _ggga int, _dfcd _da.RGBA)
}

type RGBA32

type RGBA32 struct{ ImageBase }

func (*RGBA32) At

func (_dbgf *RGBA32) At(x, y int) _da.Color

func (*RGBA32) Base

func (_cdfg *RGBA32) Base() *ImageBase

func (*RGBA32) Bounds

func (_eaea *RGBA32) Bounds() _e.Rectangle

func (*RGBA32) ColorAt

func (_ddffc *RGBA32) ColorAt(x, y int) (_da.Color, error)

func (*RGBA32) ColorModel

func (_abfdd *RGBA32) ColorModel() _da.Model

func (*RGBA32) Copy

func (_ecde *RGBA32) Copy() Image

func (*RGBA32) RGBAAt

func (_bagd *RGBA32) RGBAAt(x, y int) _da.RGBA

func (*RGBA32) Set

func (_bbcc *RGBA32) Set(x, y int, c _da.Color)

func (*RGBA32) SetRGBA

func (_cebg *RGBA32) SetRGBA(x, y int, c _da.RGBA)

func (*RGBA32) Validate

func (_daddf *RGBA32) Validate() error

type RasterOperator

type RasterOperator int
const (
	PixSrc             RasterOperator = 0xc
	PixDst             RasterOperator = 0xa
	PixNotSrc          RasterOperator = 0x3
	PixNotDst          RasterOperator = 0x5
	PixClr             RasterOperator = 0x0
	PixSet             RasterOperator = 0xf
	PixSrcOrDst        RasterOperator = 0xe
	PixSrcAndDst       RasterOperator = 0x8
	PixSrcXorDst       RasterOperator = 0x6
	PixNotSrcOrDst     RasterOperator = 0xb
	PixNotSrcAndDst    RasterOperator = 0x2
	PixSrcOrNotDst     RasterOperator = 0xd
	PixSrcAndNotDst    RasterOperator = 0x4
	PixNotPixSrcOrDst  RasterOperator = 0x1
	PixNotPixSrcAndDst RasterOperator = 0x7
	PixNotPixSrcXorDst RasterOperator = 0x9
	PixPaint                          = PixSrcOrDst
	PixSubtract                       = PixNotSrcAndDst
	PixMask                           = PixSrcAndDst
)

type SMasker

type SMasker interface {
	HasAlpha() bool
	GetAlpha() []byte
	MakeAlpha()
}

Jump to

Keyboard shortcuts

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