vrdop

package
v0.0.0-...-df3f4e6 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package vrdop provides tools to efficiently represent image operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(ops ...Op) []byte

Encode encodes a slice of operations into a vrdop operation buffer.

func Transform

func Transform(src image.Image, ops []Op) image.Image

Types

type Brightness

type Brightness struct {
	V float32 `json:"percent"`
}

func (*Brightness) Decode

func (op *Brightness) Decode(p []byte)

func (*Brightness) Encode

func (op *Brightness) Encode(p []byte)

func (Brightness) Kind

func (Brightness) Kind() Kind

func (Brightness) Len

func (Brightness) Len() uint32

type Color

type Color struct {
	R float32 `json:"r"`
	G float32 `json:"g"`
	B float32 `json:"b"`
}

func (*Color) Decode

func (op *Color) Decode(p []byte)

func (*Color) Encode

func (op *Color) Encode(p []byte)

func (Color) Kind

func (Color) Kind() Kind

func (Color) Len

func (Color) Len() uint32

type Contrast

type Contrast struct {
	V float32 `json:"percent"`
}

func (*Contrast) Decode

func (op *Contrast) Decode(p []byte)

func (*Contrast) Encode

func (op *Contrast) Encode(p []byte)

func (Contrast) Kind

func (Contrast) Kind() Kind

func (Contrast) Len

func (Contrast) Len() uint32

type Crop

type Crop struct {
	Rect image.Rectangle `json:"rect"`
}

func (*Crop) Decode

func (op *Crop) Decode(p []byte)

func (*Crop) Encode

func (op *Crop) Encode(p []byte)

func (Crop) Kind

func (Crop) Kind() Kind

func (Crop) Len

func (Crop) Len() uint32

type FlipH

type FlipH struct{}

func (*FlipH) Decode

func (*FlipH) Decode(p []byte)

func (*FlipH) Encode

func (*FlipH) Encode(p []byte)

func (FlipH) Kind

func (FlipH) Kind() Kind

func (FlipH) Len

func (FlipH) Len() uint32

type FlipV

type FlipV struct{}

func (*FlipV) Decode

func (*FlipV) Decode(p []byte)

func (*FlipV) Encode

func (*FlipV) Encode(p []byte)

func (FlipV) Kind

func (FlipV) Kind() Kind

func (FlipV) Len

func (FlipV) Len() uint32

type Gamma

type Gamma struct {
	V float32 `json:"percent"`
}

func (*Gamma) Decode

func (op *Gamma) Decode(p []byte)

func (*Gamma) Encode

func (op *Gamma) Encode(p []byte)

func (Gamma) Kind

func (Gamma) Kind() Kind

func (Gamma) Len

func (Gamma) Len() uint32

type Gray

type Gray struct{}

func (Gray) Decode

func (Gray) Decode(p []byte)

func (Gray) Encode

func (Gray) Encode(p []byte)

func (Gray) Kind

func (Gray) Kind() Kind

func (Gray) Len

func (Gray) Len() uint32

type Hue

type Hue struct {
	V float32 `json:"percent"`
}

func (*Hue) Decode

func (op *Hue) Decode(p []byte)

func (*Hue) Encode

func (op *Hue) Encode(p []byte)

func (Hue) Kind

func (Hue) Kind() Kind

func (Hue) Len

func (Hue) Len() uint32

type ID

type ID struct{}

func (*ID) Decode

func (*ID) Decode(p []byte)

func (*ID) Encode

func (*ID) Encode(p []byte)

func (ID) Kind

func (ID) Kind() Kind

func (ID) Len

func (ID) Len() uint32

type Kind

type Kind uint8
const (
	OpIdentity Kind = iota
	OpRotate
	OpFlipV
	OpFlipH
	OpCrop
	OpColor
	OpBrightness
	OpContrast
	OpGamma
	OpGray
	OpHue
	OpSaturation
	OpSepia
)

type Op

type Op interface {
	Kind() Kind
	Len() uint32
	Encode(p []byte)
	Decode(p []byte)
	// contains filtered or unexported methods
}

func Decode

func Decode(p []byte) ([]Op, error)

Decode decodes a vrdop operation buffer into a slice of operations.

func FromOrientation

func FromOrientation(ori uint8) []Op

FromOrientation converts an EXIF orientation meta data into a set of vrdop operations.

type Rotate

type Rotate struct {
	Angle float32 `json:"angle"`
}

func (*Rotate) Decode

func (op *Rotate) Decode(p []byte)

func (*Rotate) Encode

func (op *Rotate) Encode(p []byte)

func (Rotate) Kind

func (Rotate) Kind() Kind

func (Rotate) Len

func (Rotate) Len() uint32

type Saturation

type Saturation struct {
	V float32 `json:"percent"`
}

func (*Saturation) Decode

func (op *Saturation) Decode(p []byte)

func (*Saturation) Encode

func (op *Saturation) Encode(p []byte)

func (Saturation) Kind

func (Saturation) Kind() Kind

func (Saturation) Len

func (Saturation) Len() uint32

type Sepia

type Sepia struct {
	V float32 `json:"percent"`
}

func (*Sepia) Decode

func (op *Sepia) Decode(p []byte)

func (*Sepia) Encode

func (op *Sepia) Encode(p []byte)

func (Sepia) Kind

func (Sepia) Kind() Kind

func (Sepia) Len

func (Sepia) Len() uint32

Jump to

Keyboard shortcuts

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