filters

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 10 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 implement the starting and final point of the arrow:
	// arrow is pointing to the "To" direction.
	From, To image.Point

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

	// Thickness of the Arrow to be drawn.
	Thickness float64
	// contains filtered or unexported fields
}

func NewArrow

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

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

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 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