gosaic

package module
v0.0.0-...-d4f3427 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SeedImage    string
	OutputImage  string
	OutputSize   int
	TileSize     int
	TilesGlob    string
	CompareSize  int
	CompareDist  float64
	Unique       bool
	SmartCrop    bool
	ProgressBar  bool
	ProgressText bool
	RedisAddr    string
	RedisLabel   string
	HTTPAddr     string
	Workers      int
	User         string
	Password     string
}

type Gosaic

type Gosaic struct {
	SeedImage *image.RGBA
	Tiles     *list.List
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Gosaic, error)

func (*Gosaic) Build

func (g *Gosaic) Build() error

func (*Gosaic) Difference

func (g *Gosaic) Difference(img1, img2 HasAt) (float64, error)

func (*Gosaic) SaveAsJPEG

func (g *Gosaic) SaveAsJPEG(img image.Image, filename string) error

type HasAt

type HasAt interface {
	At(x, y int) color.Color
	ColorModel() color.Model
	Bounds() image.Rectangle
}

type ProgressCounter

type ProgressCounter struct {
	// contains filtered or unexported fields
}

func (*ProgressCounter) Finish

func (c *ProgressCounter) Finish() *pb.ProgressBar

func (*ProgressCounter) Increment

func (c *ProgressCounter) Increment() *pb.ProgressBar

type ProgressIndicator

type ProgressIndicator interface {
	Increment() *pb.ProgressBar
	Finish() *pb.ProgressBar
}

type Seed

type Seed struct {
	Seed        *multipart.FileHeader `form:"seed" binding:"required" json:"seed"`
	Tilesize    int                   `form:"tilesize" binding:"required" json:"tilesize"`
	Comparesize int                   `form:"comparesize" binding:"required" json:"comparesize"`
	RedisLabel  string                `form:"redislabel" binding:"required" json:"redislabel"`
	OutputSize  int                   `form:"outputsize" binding:"required" json:"outputsize"`
	CompareDist float64               `form:"comparedist" binding:"required" json:"comparedist"`
	Unique      bool                  `form:"unique" binding:"-" json:"unique"`
	SmartCrop   bool                  `form:"smartcrop" binding:"-" json:"smartcrop"`
	Progress    bool                  `form:"progress" binding:"-" json:"progress"`
	Workers     int                   `form:"workers" binding:"-" json:"workers"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr, redisAddr, user, password string) (*Server, error)

func (*Server) Run

func (s *Server) Run() error

type Stats

type Stats struct {
	TStart      time.Time
	Comparisons int
	CompareTime time.Duration
	// contains filtered or unexported fields
}

type Tile

type Tile struct {
	Filename string
	Tiny     image.Image
	Average  float64
}

type TileData

type TileData struct {
	X            int
	Y            int
	Average      float64
	CompareImage image.Image
	MinDist      *float64
	Rect         image.Rectangle
	MinTile      *Tile
	TileElem     *list.Element
	MinElem      *list.Element
	CompareTime  *time.Duration
	Tile         *Tile
	Mutex        *sync.Mutex
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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