model

package
v0.0.0-...-4383a04 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2017 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PixelDecode

func PixelDecode(p Pixel) error

PixelDecode decodes []byte of Data to slice of *Lab and stores in Pixels.

func PixelDist

func PixelDist(p1, p2 Pixel) (float64, error)

func PixelEncode

func PixelEncode(p Pixel) error

PixelEncode encodes slice of Pixels to json-encoded []byte and stores in Data.

Types

type Aspect

type Aspect struct {
	Id      int64 `db:"id"`
	Columns int   `db:"columns"`
	Rows    int   `db:"rows"`
}

func NewAspect

func NewAspect(columns int, rows int) *Aspect

func (*Aspect) Ratio

func (a *Aspect) Ratio() float64

func (*Aspect) RoundHeight

func (a *Aspect) RoundHeight(width int) int

func (*Aspect) RoundWidth

func (a *Aspect) RoundWidth(height int) int

func (*Aspect) Scale

func (a *Aspect) Scale(width, height int) (int, int)

Scale returns a width and height that is closest to the provided width and height, but maintains this exact integer aspect ratio, without rounding

func (*Aspect) ScaleRound

func (a *Aspect) ScaleRound(width, height int) (int, int)

type Cover

type Cover struct {
	Id       int64 `db:"id"`
	AspectId int64 `db:"aspect_id"`
	Width    int   `db:"width"`
	Height   int   `db:"height"`
}

type CoverPartial

type CoverPartial struct {
	Id       int64 `db:"id"`
	CoverId  int64 `db:"cover_id"`
	AspectId int64 `db:"aspect_id"`
	X1       int   `db:"x1"`
	Y1       int   `db:"y1"`
	X2       int   `db:"x2"`
	Y2       int   `db:"y2"`
}

func (*CoverPartial) Area

func (cp *CoverPartial) Area() int

func (*CoverPartial) Height

func (cp *CoverPartial) Height() int

func (*CoverPartial) Pt

func (cp *CoverPartial) Pt() image.Point

func (*CoverPartial) Rectangle

func (cp *CoverPartial) Rectangle() image.Rectangle

func (*CoverPartial) Width

func (cp *CoverPartial) Width() int

type CoverPartialQuadView

type CoverPartialQuadView struct {
	CoverPartial *CoverPartial
	QuadDist     *QuadDist
}

type Gidx

type Gidx struct {
	Id          int64  `db:"id"`
	AspectId    int64  `db:"aspect_id"`
	Path        string `db:"path"`
	Md5sum      string `db:"md5sum"`
	Width       int    `db:"width"`
	Height      int    `db:"height"`
	Orientation int    `db:"orientation"`
}

func (*Gidx) GetHeight

func (g *Gidx) GetHeight() int

func (*Gidx) GetMd5sum

func (g *Gidx) GetMd5sum() string

func (*Gidx) GetOrientation

func (g *Gidx) GetOrientation() int

func (*Gidx) GetPath

func (g *Gidx) GetPath() string

func (*Gidx) GetWidth

func (g *Gidx) GetWidth() int

func (*Gidx) SetHeight

func (g *Gidx) SetHeight(height int)

func (*Gidx) SetMd5sum

func (g *Gidx) SetMd5sum(md5sum string)

func (*Gidx) SetOrientation

func (g *Gidx) SetOrientation(orientation int)

func (*Gidx) SetPath

func (g *Gidx) SetPath(path string)

func (*Gidx) SetWidth

func (g *Gidx) SetWidth(width int)

func (*Gidx) Within

func (gidx *Gidx) Within(threashold float64, aspect *Aspect) bool

type GidxPartial

type GidxPartial struct {
	Id       int64  `db:"id"`
	GidxId   int64  `db:"gidx_id"`
	AspectId int64  `db:"aspect_id"`
	Data     []byte `db:"data"`
	Pixels   []*Lab `db:"-"`
}

func (*GidxPartial) DecodeData

func (p *GidxPartial) DecodeData() error

func (*GidxPartial) EncodePixels

func (p *GidxPartial) EncodePixels() error

func (*GidxPartial) GetData

func (p *GidxPartial) GetData() []byte

func (*GidxPartial) GetPixels

func (p *GidxPartial) GetPixels() []*Lab

func (*GidxPartial) SetData

func (p *GidxPartial) SetData(data []byte)

func (*GidxPartial) SetPixels

func (p *GidxPartial) SetPixels(pixels []*Lab)

type Image

type Image interface {
	GetPath() string
	GetMd5sum() string
	GetWidth() int
	GetHeight() int
	GetOrientation() int
	SetPath(string)
	SetMd5sum(string)
	SetWidth(int)
	SetHeight(int)
	SetOrientation(int)
}

type Lab

type Lab struct {
	L     float64 `json:"l"`
	A     float64 `json:"a"`
	B     float64 `json:"b"`
	Alpha float64 `json:"alpha"`
}

func RgbaToLab

func RgbaToLab(color color.Color) *Lab

func (*Lab) Dist

func (lab1 *Lab) Dist(lab2 *Lab) float64

type Macro

type Macro struct {
	Id          int64  `db:"id"`
	AspectId    int64  `db:"aspect_id"`
	CoverId     int64  `db:"cover_id"`
	Path        string `db:"path"`
	Md5sum      string `db:"md5sum"`
	Width       int    `db:"width"`
	Height      int    `db:"height"`
	Orientation int    `db:"orientation"`
}

func (*Macro) GetHeight

func (g *Macro) GetHeight() int

func (*Macro) GetMd5sum

func (g *Macro) GetMd5sum() string

func (*Macro) GetOrientation

func (g *Macro) GetOrientation() int

func (*Macro) GetPath

func (g *Macro) GetPath() string

func (*Macro) GetWidth

func (g *Macro) GetWidth() int

func (*Macro) SetHeight

func (g *Macro) SetHeight(height int)

func (*Macro) SetMd5sum

func (g *Macro) SetMd5sum(md5sum string)

func (*Macro) SetOrientation

func (g *Macro) SetOrientation(orientation int)

func (*Macro) SetPath

func (g *Macro) SetPath(path string)

func (*Macro) SetWidth

func (g *Macro) SetWidth(width int)

type MacroGidxView

type MacroGidxView struct {
	MacroPartial *MacroPartial
	GidxPartial  *GidxPartial
}

func (*MacroGidxView) PartialComparison

func (macroGidxView *MacroGidxView) PartialComparison() (*PartialComparison, error)

type MacroPartial

type MacroPartial struct {
	Id             int64  `db:"id"`
	MacroId        int64  `db:"macro_id"`
	CoverPartialId int64  `db:"cover_partial_id"`
	AspectId       int64  `db:"aspect_id"`
	Data           []byte `db:"data"`
	Pixels         []*Lab `db:"-"`
}

func (*MacroPartial) DecodeData

func (p *MacroPartial) DecodeData() error

func (*MacroPartial) EncodePixels

func (p *MacroPartial) EncodePixels() error

func (*MacroPartial) GetData

func (p *MacroPartial) GetData() []byte

func (*MacroPartial) GetPixels

func (p *MacroPartial) GetPixels() []*Lab

func (*MacroPartial) SetData

func (p *MacroPartial) SetData(data []byte)

func (*MacroPartial) SetPixels

func (p *MacroPartial) SetPixels(pixels []*Lab)

type Mosaic

type Mosaic struct {
	Id      int64 `db:"id"`
	MacroId int64 `db:"macro_id"`
}

type MosaicPartial

type MosaicPartial struct {
	Id             int64 `db:"id"`
	MosaicId       int64 `db:"mosaic_id"`
	MacroPartialId int64 `db:"macro_partial_id"`
	GidxPartialId  int64 `db:"gidx_partial_id"`
}

type MosaicPartialView

type MosaicPartialView struct {
	MosaicPartialId int64
	Gidx            *Gidx
	CoverPartial    *CoverPartial
}

type PartialComparison

type PartialComparison struct {
	Id             int64   `db:"id"`
	MacroPartialId int64   `db:"macro_partial_id"`
	GidxPartialId  int64   `db:"gidx_partial_id"`
	Dist           float64 `db:"dist"`
}

type Pixel

type Pixel interface {
	GetData() []byte
	GetPixels() []*Lab
	SetData([]byte)
	SetPixels([]*Lab)
}

type Project

type Project struct {
	Id         int64     `db:"id"`
	Name       string    `db:"name"`
	Path       string    `db:"path"`
	CoverPath  string    `db:"cover_path"`
	MacroPath  string    `db:"macro_path"`
	MosaicPath string    `db:"mosaic_path"`
	CoverId    int64     `db:"cover_id"`
	MacroId    int64     `db:"macro_id"`
	MosaicId   int64     `db:"mosaic_id"`
	IsComplete bool      `db:"is_complete"`
	CreatedAt  time.Time `db:"created_at"`
}

type QuadDist

type QuadDist struct {
	Id             int64   `db:"id"`
	MacroPartialId int64   `db:"macro_partial_id"`
	Depth          int     `db:"depth"`
	Area           int     `db:"area"`
	Dist           float64 `db:"dist"`
}

Jump to

Keyboard shortcuts

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