filters

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DPI = 96

DPI constant. Ideally it would be read from the various system.

Variables

View Source
var (
	Yellow = color.RGBA{R: 255, G: 255, A: 255}
	Green  = color.RGBA{R: 80, G: 255, A: 80}
)

Functions

This section is empty.

Types

type Arrow

type Arrow struct {
	// From, To 箭头的起始点:
	// 箭头在To的位置
	From, To image.Point

	// Color 定义箭头的颜色
	Color color.Color

	// Thickness 箭头的宽度 实际像素点为 Thickness*arrowHeadWidthFactor
	Thickness float64
	// contains filtered or unexported fields
}

func NewArrow

func NewArrow(from, to image.Point, color color.Color, thickness float64) *Arrow

NewArrow 创建一个箭头,必须传入起始点和颜色,以及线条的宽度

func (*Arrow) Apply

func (c *Arrow) Apply(image image.Image) image.Image

Apply implements the ImageFilter interface.

func (*Arrow) SetPoints

func (c *Arrow) SetPoints(from, to image.Point)

type Circle

type Circle struct {
	// Dim defines the rectangle that will encompass the
	// circle/ellipse.
	Dim image.Rectangle

	// Color of the circle to be drawn.
	Color color.Color

	// Thickness of the circle to be drawn.
	Thickness float64

	// Center is generated automatically.
	Center Vec2
	// contains filtered or unexported fields
}

func NewCircle

func NewCircle(dim image.Rectangle, color color.Color, thickness float64) *Circle

NewCircle creates a new circle (or ellipsis) filter. It draws an ellipsis whose dimensions fit the given rectangle. You must specify the color and the thickness of the circle to be drawn.

func (*Circle) Apply

func (c *Circle) Apply(image image.Image) image.Image

Apply implements the ImageFilter interface.

func (*Circle) SetDim

func (c *Circle) SetDim(dim image.Rectangle)

type DottedLine added in v1.0.8

type DottedLine struct {
	// From, To 虚线开始到结束的位置记录:
	From, To image.Point

	// Color 指定虚线的颜色.
	Color color.Color

	// Thickness 指定虚线的宽度
	Thickness float64
	// contains filtered or unexported fields
}

func NewDottedLine added in v1.0.8

func NewDottedLine(from, to image.Point, color color.Color, thickness float64, dottedLineSpacing float64) *DottedLine

NewDottedLine 创建一个新的虚线,接口中必须传入虚线的宽度、颜色以及起点.

func (*DottedLine) Apply added in v1.0.8

func (c *DottedLine) Apply(image image.Image) image.Image

Apply 接口ImageFilter的实现. 实现方式,若是需要绘制的图,就替换为当先选中的颜色,若是不是就返回背景颜色 under

func (*DottedLine) SetPoints added in v1.0.8

func (c *DottedLine) SetPoints(from, to image.Point)

SetPoints 虚线打点

type Pen added in v1.0.12

type Pen struct {

	// Color 指定虚线的颜色.
	Color color.Color

	// Thickness 指定虚线的宽度
	Thickness float64
	// contains filtered or unexported fields
}

func NewPen added in v1.0.12

func NewPen(to image.Point, color color.Color, thickness float64) *Pen

NewPen 创建一个新的虚线,接口中必须传入虚线的宽度、颜色以及起点.

func (*Pen) Apply added in v1.0.12

func (c *Pen) Apply(image image.Image) image.Image

Apply 接口ImageFilter的实现. 实现方式,若是需要绘制的图,就替换为当先选中的颜色,若是不是就返回背景颜色 under

func (*Pen) SetPoints added in v1.0.12

func (c *Pen) SetPoints(to image.Point)

SetPoints 虚线打点

type Rectangle added in v1.0.11

type Rectangle struct {
	// 用来表示矩形框
	Rect image.Rectangle

	// Color of the Rectangle to be drawn.
	Color color.Color

	// Thickness 指定矩形边框的宽度
	Thickness float64
	// contains filtered or unexported fields
}

func NewRectangle added in v1.0.11

func NewRectangle(rect image.Rectangle, color color.Color, thickness float64) *Rectangle

NewRectangle creates a new Rectangle (or ellipsis) filter. It draws an ellipsis whose dimensions fit the given rectangle. You must specify the color and the thickness of the Rectangle to be drawn.

func (*Rectangle) Apply added in v1.0.11

func (c *Rectangle) Apply(image image.Image) image.Image

Apply implements the ImageFilter interface.

func (*Rectangle) SetRect added in v1.0.11

func (c *Rectangle) SetRect(rect image.Rectangle)

type ShieldBlock added in v1.0.11

type ShieldBlock struct {
	// 用来表示矩形框
	Rect image.Rectangle

	// Color of the ShieldBlock to be drawn.
	Color color.Color
}

func NewShieldBlock added in v1.0.11

func NewShieldBlock(rect image.Rectangle, color color.Color) *ShieldBlock

NewShieldBlock creates a new ShieldBlock (or ellipsis) filter. It draws an ellipsis whose dimensions fit the given rectangle. You must specify the color and the thickness of the ShieldBlock to be drawn.

func (*ShieldBlock) Apply added in v1.0.11

func (c *ShieldBlock) Apply(image image.Image) image.Image

Apply implements the ImageFilter interface.

func (*ShieldBlock) SetRect added in v1.0.11

func (c *ShieldBlock) SetRect(rect image.Rectangle)

type StraightLine added in v1.0.2

type StraightLine struct {
	// From, To 直线开始到结束的位置记录:
	From, To image.Point

	// Color 指定直线的颜色.
	Color color.Color

	// Thickness 指定直线的宽度
	Thickness float64
	// contains filtered or unexported fields
}

func NewStraightLine added in v1.0.2

func NewStraightLine(from, to image.Point, color color.Color, thickness float64) *StraightLine

NewStraightLine 创建一个新的直线,接口中国捏必须传入直线的宽度、颜色以及起点.

func (*StraightLine) Apply added in v1.0.2

func (c *StraightLine) Apply(image image.Image) image.Image

Apply 接口ImageFilter的实现. 实现方式,若是需要绘制的图,就替换为当先选中的颜色,若是不是就返回背景颜色 under

func (*StraightLine) SetPoints added in v1.0.2

func (c *StraightLine) SetPoints(from, to image.Point)

SetPoints 图形打点

type Text

type Text struct {
	// Text to render.
	Text string

	// Center (horizontal and vertical) where to draw the text.
	Center image.Point

	// Color of the Text to be drawn.
	Color, Background color.Color

	// Font size.
	Size float64
	// contains filtered or unexported fields
}

func NewText

func NewText(text string, center image.Point, color, background color.Color, size float64) *Text

NewText creates a new Text (or ellipsis) filter. It draws an ellipsis whose dimensions fit the given rectangle. You must specify the color and the thickness of the Text to be drawn.

func (*Text) Apply

func (t *Text) Apply(image image.Image) image.Image

Apply implements the ImageFilter interface.

func (*Text) SetText

func (t *Text) SetText(text string)

type Vec2

type Vec2 [2]float64

Vec2 if a vector of 2 float64s, X and Y.

func (Vec2) X

func (v Vec2) X() float64

func (Vec2) Y

func (v Vec2) Y() float64

Jump to

Keyboard shortcuts

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