imagex

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 13 Imported by: 8

Documentation

Overview

Package imagex Created by xuzhuoxi on 2019-05-31. @author xuzhuoxi

Package imagex Created by xuzhuoxi on 2019-05-31. @author xuzhuoxi

Package imagex Created by xuzhuoxi on 2019-05-31. @author xuzhuoxi

Index

Constants

View Source
const (
	// Horizontal 水平方向,包含Left,Right
	Horizontal = Left | Right
	// Vertical 垂直方向,包含Up,down
	Vertical = Up | Down
	// Oblique 斜方向,包含LeftDown,LeftUp,RightDown,RightUp
	Oblique = LeftDown | LeftUp | RightDown | RightUp
	// AllDirection 全部八个方向
	AllDirection = Horizontal | Vertical | Oblique
)

Variables

View Source
var (
	LeftDirAdd      = PixelDirectionAdd{-1, 0}
	LeftUpDirAdd    = PixelDirectionAdd{-1, -1}
	UpDirAdd        = PixelDirectionAdd{0, -1}
	RightUpDirAdd   = PixelDirectionAdd{1, -1}
	RightDirAdd     = PixelDirectionAdd{1, 0}
	RightDownDirAdd = PixelDirectionAdd{1, 1}
	DownDirAdd      = PixelDirectionAdd{0, 1}
	LeftDownDirAdd  = PixelDirectionAdd{-1, 1}
)

Functions

func BlendSourceNormal

func BlendSourceNormal(destinationImg draw.Image, sourceColor color.Color)

BlendSourceNormal 增加背景色 背景色的透明通道会被忽略 R = S*(1-Da) + D*Da [0,1]

func Copy2PixelImage

func Copy2PixelImage(src image.Image, dst *PixelImage)

func Copy2PixelImage64

func Copy2PixelImage64(src image.Image, dst *PixelImage64)

func CopyImage

func CopyImage(srcImg image.Image) draw.Image

CopyImage 复制图像

func CopyImageStruct

func CopyImageStruct(srcImg image.Image) draw.Image

CopyImageStruct 复制图像

func CopyImageTo

func CopyImageTo(srcImg image.Image, dstImg draw.Image)

CopyImageTo 把源图像复制到目标图像

func CopyPixel2Image

func CopyPixel2Image(src *PixelImage, dst draw.Image)

func CopyPixel642Image

func CopyPixel642Image(src *PixelImage64, dst draw.Image)

func FillImage

func FillImage(img draw.Image, color color.Color)

FillImage 使用颜色填充图像

func FillImageAt

func FillImageAt(img draw.Image, color color.Color, rect image.Rectangle)

FillImageAt 使用颜色填充图像部分区域

func ForEachLoc

func ForEachLoc(img image.Image, eachFunc func(x, y int))

func LoadImage

func LoadImage(fullPath string, format formatx.ImageFormat) (img image.Image, imgFormat string, err error)

func NewGray

func NewGray(rect image.Rectangle, grayY uint8) *image.Gray

NewGray 新建灰度图像

func NewGray16

func NewGray16(rect image.Rectangle, grayY uint16) *image.Gray16

NewGray16 新建灰度图像

func NewNRGBA

func NewNRGBA(rect image.Rectangle, defaultColor color.Color) *image.NRGBA

NewNRGBA 新建NRGBA图像

func NewNRGBA64

func NewNRGBA64(rect image.Rectangle, defaultColor color.Color) *image.NRGBA64

NewNRGBA64 新建RGBA64图像

func NewRGBA

func NewRGBA(rect image.Rectangle, defaultColor color.Color) *image.RGBA

NewRGBA 新建RGBA图像

func NewRGBA64

func NewRGBA64(rect image.Rectangle, cdefaultColor color.Color) *image.RGBA64

NewRGBA64 新建RGBA64图像

func SaveImage

func SaveImage(img image.Image, fullPath string, format formatx.ImageFormat, options interface{}) error

func SprintImage

func SprintImage(img image.Image) string

SprintImage 图像字符串化

func XCopyImage

func XCopyImage(srcImg image.Image) draw.Image

XCopyImage 复制图像

func XCopyImageTo

func XCopyImageTo(srcImg image.Image, dstImg draw.Image)

XCopyImageTo 把源图像复制到目标图像

Types

type ARGB64ChanImage

type ARGB64ChanImage struct {
	Pixel64ChanImage
}

func (*ARGB64ChanImage) ARGB64At

func (p *ARGB64ChanImage) ARGB64At(x, y int) (A, R, G, B uint16)

func (*ARGB64ChanImage) Pixel64At

func (p *ARGB64ChanImage) Pixel64At(x, y int) (pixel uint64)

func (*ARGB64ChanImage) SetARGB64

func (p *ARGB64ChanImage) SetARGB64(x, y int, A, R, G, B uint16)

func (*ARGB64ChanImage) SetPixel64

func (p *ARGB64ChanImage) SetPixel64(x, y int, pixel uint64)

type ARGBChanImage

type ARGBChanImage struct {
	PixelChanImage
}

func (*ARGBChanImage) ARGBAt

func (p *ARGBChanImage) ARGBAt(x, y int) (A, R, G, B uint8)

func (*ARGBChanImage) PixelAt

func (p *ARGBChanImage) PixelAt(x, y int) (pixel uint32)

func (*ARGBChanImage) SetARGB

func (p *ARGBChanImage) SetARGB(x, y int, A, R, G, B uint8)

func (*ARGBChanImage) SetPixel

func (p *ARGBChanImage) SetPixel(x, y int, pixel uint32)

type Gray16ChanImage

type Gray16ChanImage struct {
	Pixel64ChanImage
}

func (*Gray16ChanImage) Gray16At

func (p *Gray16ChanImage) Gray16At(x, y int) uint16

func (*Gray16ChanImage) SetGray16

func (p *Gray16ChanImage) SetGray16(x, y int, gray uint16)

type GrayChanImage

type GrayChanImage struct {
	PixelChanImage
}

func (*GrayChanImage) GrayAt

func (p *GrayChanImage) GrayAt(x, y int) uint8

func (*GrayChanImage) SetGray

func (p *GrayChanImage) SetGray(x, y int, gray uint8)

type IPixelChanImage

type IPixelChanImage interface {
	Max() (maxX, maxY int)
	NumberChanel() int
}

type Pixel64ChanImage

type Pixel64ChanImage struct {
	C             []uint16
	Width, Height int
	NumChan       int
}

func (*Pixel64ChanImage) ChanValueAt

func (p *Pixel64ChanImage) ChanValueAt(x, y int, chanNum int) uint16

func (*Pixel64ChanImage) ChanValuesAt

func (p *Pixel64ChanImage) ChanValuesAt(x, y int) []uint16

func (*Pixel64ChanImage) Max

func (p *Pixel64ChanImage) Max() (maxX, maxY int)

func (*Pixel64ChanImage) NumberChanel

func (p *Pixel64ChanImage) NumberChanel() int

func (*Pixel64ChanImage) PixelAt

func (p *Pixel64ChanImage) PixelAt(x, y int) uint32

func (*Pixel64ChanImage) SetChanValue

func (p *Pixel64ChanImage) SetChanValue(x, y int, chanNum int, value uint16)

func (*Pixel64ChanImage) SetChanValues

func (p *Pixel64ChanImage) SetChanValues(x, y int, value ...uint16)

type PixelChanImage

type PixelChanImage struct {
	C             []uint8
	Width, Height int
	NumChan       int
}

func (*PixelChanImage) ChanValueAt

func (p *PixelChanImage) ChanValueAt(x, y int, chanNum int) uint8

func (*PixelChanImage) ChanValuesAt

func (p *PixelChanImage) ChanValuesAt(x, y int) []uint8

func (*PixelChanImage) Max

func (p *PixelChanImage) Max() (maxX, maxY int)

func (*PixelChanImage) NumberChanel

func (p *PixelChanImage) NumberChanel() int

func (*PixelChanImage) PixelAt

func (p *PixelChanImage) PixelAt(x, y int) uint32

func (*PixelChanImage) SetChanValue

func (p *PixelChanImage) SetChanValue(x, y int, chanNum int, value uint8)

func (*PixelChanImage) SetChanValues

func (p *PixelChanImage) SetChanValues(x, y int, value ...uint8)

type PixelDirection

type PixelDirection int
const (
	Left PixelDirection = 1 << iota
	LeftUp
	Up
	RightUp
	Right
	RightDown
	Down
	LeftDown
)

func DecomposeDirection

func DecomposeDirection(directions PixelDirection) []PixelDirection

DecomposeDirection 分解方向

func (PixelDirection) IncludeDirection

func (d PixelDirection) IncludeDirection(direction PixelDirection) bool

IncludeDirection 包含方向

func (PixelDirection) IsMulti

func (d PixelDirection) IsMulti() bool

IsMulti 多方向

func (PixelDirection) IsNone

func (d PixelDirection) IsNone() bool

IsNone 无方向

func (PixelDirection) IsSingle

func (d PixelDirection) IsSingle() bool

IsSingle 单方向

func (PixelDirection) Name

func (d PixelDirection) Name() string

func (PixelDirection) ReverseDirection

func (d PixelDirection) ReverseDirection() PixelDirection

ReverseDirection 取反方向

func (PixelDirection) String

func (d PixelDirection) String() string

type PixelDirectionAdd

type PixelDirectionAdd struct{ X, Y int }

PixelDirectionAdd 方向偏移量

func GetPixelDirectionAdd

func GetPixelDirectionAdd(direction PixelDirection) (PixelDirectionAdd, error)

GetPixelDirectionAdd 取方向坐标增加值

func GetPixelDirectionAdds

func GetPixelDirectionAdds(directions PixelDirection) []PixelDirectionAdd

GetPixelDirectionAdds 取多方向坐标增加值

type PixelImage

type PixelImage struct {
	//A,R,G,B
	Pix           []uint32
	Width, Height int
}

func NewPixelImage

func NewPixelImage(width, height int, pixel uint32) *PixelImage

func (*PixelImage) At

func (i *PixelImage) At(x, y int) uint32

func (*PixelImage) ForEachPixel

func (i *PixelImage) ForEachPixel(eachFunc func(x, y int))

func (*PixelImage) IndexAt

func (i *PixelImage) IndexAt(index int) uint32

func (*PixelImage) IndexSet

func (i *PixelImage) IndexSet(index int, pixel uint32)

func (*PixelImage) IndexSetPixel

func (i *PixelImage) IndexSetPixel(index int, pixel graphicx.Pixel)

func (*PixelImage) Max

func (i *PixelImage) Max() (maxX, maxY int)

func (*PixelImage) PixelAt

func (i *PixelImage) PixelAt(x, y int) graphicx.Pixel

func (*PixelImage) PixelIndexAt

func (i *PixelImage) PixelIndexAt(index int) graphicx.Pixel

func (*PixelImage) Set

func (i *PixelImage) Set(x, y int, pixel uint32)

func (*PixelImage) SetPixel

func (i *PixelImage) SetPixel(x, y int, pixel graphicx.Pixel)

type PixelImage64

type PixelImage64 struct {
	//A,R,G,B
	Pix           []uint64
	Width, Height int
}

func NewPixelImage64

func NewPixelImage64(width, height int, pixel uint64) *PixelImage64

func (*PixelImage64) At

func (i *PixelImage64) At(x, y int) uint64

func (*PixelImage64) ForEachPixel

func (i *PixelImage64) ForEachPixel(eachFunc func(x, y int))

func (*PixelImage64) IndexAt

func (i *PixelImage64) IndexAt(index int) uint64

func (*PixelImage64) IndexSet

func (i *PixelImage64) IndexSet(index int, pixel uint64)

func (*PixelImage64) IndexSetPixel

func (i *PixelImage64) IndexSetPixel(index int, pixel graphicx.Pixel64)

func (*PixelImage64) Max

func (i *PixelImage64) Max() (maxX, maxY int)

func (*PixelImage64) PixelAt

func (i *PixelImage64) PixelAt(x, y int) graphicx.Pixel64

func (*PixelImage64) PixelIndexAt

func (i *PixelImage64) PixelIndexAt(index int) graphicx.Pixel64

func (*PixelImage64) Set

func (i *PixelImage64) Set(x, y int, pixel uint64)

func (*PixelImage64) SetPixel

func (i *PixelImage64) SetPixel(x, y int, pixel graphicx.Pixel64)

type RGB64ChanImage

type RGB64ChanImage struct {
	Pixel64ChanImage
}

func (*RGB64ChanImage) Pixel64At

func (p *RGB64ChanImage) Pixel64At(x, y int) (pixel uint64)

func (*RGB64ChanImage) RGB64At

func (p *RGB64ChanImage) RGB64At(x, y int) (R, G, B uint16)

func (*RGB64ChanImage) SetPixel64

func (p *RGB64ChanImage) SetPixel64(x, y int, pixel uint64)

func (*RGB64ChanImage) SetRGB64

func (p *RGB64ChanImage) SetRGB64(x, y int, R, G, B uint16)

type RGBChanImage

type RGBChanImage struct {
	PixelChanImage
}

func (*RGBChanImage) PixelAt

func (p *RGBChanImage) PixelAt(x, y int) (pixel uint32)

func (*RGBChanImage) RGBAt

func (p *RGBChanImage) RGBAt(x, y int) (R, G, B uint8)

func (*RGBChanImage) SetPixel

func (p *RGBChanImage) SetPixel(x, y int, pixel uint32)

func (*RGBChanImage) SetRGB

func (p *RGBChanImage) SetRGB(x, y int, R, G, B uint8)

Directories

Path Synopsis
Difference of Gaussian 高斯函数差分
Difference of Gaussian 高斯函数差分
Package filterx 模糊
Package filterx 模糊
Package formatx Created by xuzhuoxi on 2019-04-26.
Package formatx Created by xuzhuoxi on 2019-04-26.
jpegx
Package jpegx Created by xuzhuoxi on 2019-04-27.
Package jpegx Created by xuzhuoxi on 2019-04-27.
pngx
Package pngx Created by xuzhuoxi on 2019-04-27.
Package pngx Created by xuzhuoxi on 2019-04-27.
webpx
Package webpx Create on 2023/5/3 @author xuzhuoxi
Package webpx Create on 2023/5/3 @author xuzhuoxi
Package projectionx 投影: 按水平或垂直方向统计色素有效性
Package projectionx 投影: 按水平或垂直方向统计色素有效性
Package resizex Created by xuzhuoxi on 2019-05-31.
Package resizex Created by xuzhuoxi on 2019-05-31.

Jump to

Keyboard shortcuts

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