env

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Create on 2022/6/26 @author xuzhuoxi

Create on 2022/6/26 @author xuzhuoxi

Create on 2022/6/26 @author xuzhuoxi

Index

Constants

View Source
const (
	DefaultRatio = 85
)

Variables

View Source
var (
	ModeSize = CmdFlag{Desc: "固定尺寸[Fixed]", /* contains filtered or unexported fields */} //固定分割,不足的补空
	ModeAvg  = CmdFlag{Desc: "固定数量[Avg]", /* contains filtered or unexported fields */}   //平均分割,根据图片总大小进行水平与垂直的平均分割
)
View Source
var (
	OrderLeftUp   = CmdFlag{Desc: "左上[LeftUp]", /* contains filtered or unexported fields */}   // 左上角起始位
	OrderLeftDown = CmdFlag{Desc: "左下[LeftDown]", /* contains filtered or unexported fields */} // 左下角起始位

)
View Source
var (
	EndTrimOff = CmdFlag{Desc: "关闭裁剪[TrimOff]", /* contains filtered or unexported fields */} // 关闭裁剪,不足补空
	EndTrimOn  = CmdFlag{Desc: "启用裁剪[TrimOn]", /* contains filtered or unexported fields */}  // 启用裁剪
)
View Source
var (
	WildcardN0 = []string{"{n0}", "{N0}"} // 从0开始的分割顺序数。
	WildcardN1 = []string{"{n1}", "{N1}"} // 从1开始的分割顺序数。

	WildcardX0 = []string{"{x0}", "{X0}"} // 从0开始的水平方向分割顺序数。
	WildcardX1 = []string{"{x1}", "{X1}"} // 从1开始的水平方向分割顺序数。

	WildcardY0 = []string{"{y0}", "{Y0}"} // 从0开始的垂直方向分割顺序数。
	WildcardY1 = []string{"{y1}", "{Y1}"} // 从1开始的垂直方向分割顺序数。

	WildcardExt = []string{"{ext}"}
)

Functions

This section is empty.

Types

type CmdFlag

type CmdFlag struct {
	Desc string
	// contains filtered or unexported fields
}

func (CmdFlag) DefaultValue

func (o CmdFlag) DefaultValue() string

func (CmdFlag) Match

func (o CmdFlag) Match(value string) bool

func (CmdFlag) MatchCase

func (o CmdFlag) MatchCase(value string) bool

type Size

type Size struct {
	Width  int // 宽 | 水平数量
	Height int // 高 | 垂直数量
}

func (Size) String

func (s Size) String() string

type SplitContext

type SplitContext struct {
	EnvPath string // 【**可选**】运行时环境路径,支持绝对路径与相对于当前执行目录的相对路径,空表示使用执行文件所在目录
	Mode    string // 【**必要**】分割模式,支持:fixed(1)、avg(2)
	Order   string // 【**必要**】分割顺序,支持:LeftUp(1)、LeftDown(2)
	Size    string // 【**必要**】分割参数,格式 "mxn","mXn","m*n"
	Trim    string // 【**必要**】尾部裁剪,支持:on、off

	InImagePath  string // 【**必要**】来源图片路径,要求为图片格式的文件
	OutImagePath string // 【**必要**】输出图片信息,要求使用通配符目录,

	Format      string // 【**非必要**】强制指定图像文件格式, 如果不指定,将使用源图像的格式
	FormatRatio int    // 【**非必要**】强制指定图像文件质量(如有必要),如果不指定,使用默认值85

	FlagSize             Size
	ImageSize            image.Point
	SliceSize, CountSize Size
	FormatExt            string // 图像格式对应的扩展名
}

func ParseFlags

func ParseFlags() *SplitContext

func (*SplitContext) GetMode

func (c *SplitContext) GetMode() CmdFlag

func (*SplitContext) GetOrder

func (c *SplitContext) GetOrder() CmdFlag

func (*SplitContext) GetSrcPoint

func (c *SplitContext) GetSrcPoint(xIndex int, yIndex int) (srcPoint image.Point)

func (*SplitContext) GetTrim

func (c *SplitContext) GetTrim() CmdFlag

func (*SplitContext) InitContext

func (c *SplitContext) InitContext() error

func (*SplitContext) SetDefaultFormat

func (c *SplitContext) SetDefaultFormat(format string)

func (*SplitContext) SetImageSize

func (c *SplitContext) SetImageSize(imageSize image.Point)

func (*SplitContext) TrimOn

func (c *SplitContext) TrimOn() bool

Jump to

Keyboard shortcuts

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